In order to replace QXL with Standard_VGA in small steps, bisectably,
first just introduce the Standard_VGA constructor.
Extend the string_of_video function at once ("stdvga"). The value returned
by this function is only used for debug logging (indirectly, via the
string_of_guestcaps and string_of_requested_guestcaps functions).
The virt-v2v build flags turn "non-exhaustive pattern matching" warnings
into errors. Match the new "Standard_VGA" constructor with a constant
false assertion wherever an expression of type "guestcaps_video_type" is
matched, in order to make this patch bisectable. These assertions will be
gradually replaced with actual logic in the rest of this patch set.
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1961107
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
convert/convert_linux.ml | 6 +++++-
convert/windows_virtio.ml | 2 ++
lib/types.ml | 3 ++-
lib/types.mli | 2 +-
output/create_json.ml | 1 +
output/create_libvirt_xml.ml | 1 +
output/openstack_image_properties.ml | 1 +
output/output.ml | 6 +++++-
8 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
index 057cf9dff7da..85d8c5ae0e92 100644
--- a/convert/convert_linux.ml
+++ b/convert/convert_linux.ml
@@ -829,7 +829,11 @@ let convert (g : G.guestfs) source inspect keep_serial_console rcaps
_ =
true
and configure_display_driver video =
- let video_driver = match video with QXL -> "qxl" | Cirrus ->
"cirrus" in
+ let video_driver =
+ match video with
+ | Standard_VGA -> assert false
+ | QXL -> "qxl"
+ | Cirrus -> "cirrus" in
let updated = ref false in
diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
index f843dae2d77f..1851fe2f3292 100644
--- a/convert/windows_virtio.ml
+++ b/convert/windows_virtio.ml
@@ -51,6 +51,7 @@ let rec install_drivers ((g, _) as reg) inspect rcaps =
if not (copy_drivers g inspect driverdir) then (
match rcaps with
+ | { rcaps_video = Some Standard_VGA } -> assert false
| { rcaps_block_bus = Some Virtio_blk | Some Virtio_SCSI }
| { rcaps_net_bus = Some Virtio_net }
| { rcaps_video = Some QXL } ->
@@ -159,6 +160,7 @@ let rec install_drivers ((g, _) as reg) inspect rcaps =
g#exists (driverdir // "qxl.inf") ||
g#exists (driverdir // "qxldod.inf") in
match rcaps.rcaps_video, has_qxl with
+ | Some Standard_VGA, _ -> assert false
| Some QXL, false ->
error (f_"there is no QXL driver for this version of Windows (%d.%d %s).
virt-v2v looks for this driver in %s")
inspect.i_major_version inspect.i_minor_version
diff --git a/lib/types.ml b/lib/types.ml
index 72d10d1ec774..0156d55954e9 100644
--- a/lib/types.ml
+++ b/lib/types.ml
@@ -429,7 +429,7 @@ and requested_guestcaps = {
}
and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE
and guestcaps_net_type = Virtio_net | E1000 | RTL8139
-and guestcaps_video_type = QXL | Cirrus
+and guestcaps_video_type = Standard_VGA | QXL | Cirrus
and guestcaps_machine = I440FX | Q35 | Virt
let string_of_block_type = function
@@ -441,6 +441,7 @@ let string_of_net_type = function
| E1000 -> "e1000"
| RTL8139 -> "rtl8139"
let string_of_video = function
+ | Standard_VGA -> "stdvga"
| QXL -> "qxl"
| Cirrus -> "cirrus"
let string_of_machine = function
diff --git a/lib/types.mli b/lib/types.mli
index 0bae445d8393..19790f375035 100644
--- a/lib/types.mli
+++ b/lib/types.mli
@@ -293,7 +293,7 @@ and requested_guestcaps = {
and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE
and guestcaps_net_type = Virtio_net | E1000 | RTL8139
-and guestcaps_video_type = QXL | Cirrus
+and guestcaps_video_type = Standard_VGA | QXL | Cirrus
and guestcaps_machine = I440FX | Q35 | Virt
val string_of_guestcaps : guestcaps -> string
diff --git a/output/create_json.ml b/output/create_json.ml
index 5fa2805a2dcd..aae4d09c59bd 100644
--- a/output/create_json.ml
+++ b/output/create_json.ml
@@ -204,6 +204,7 @@ let create_json_metadata source inspect
| RTL8139 -> "rtl8139" in
let video =
match guestcaps.gcaps_video with
+ | Standard_VGA -> assert false
| QXL -> "qxl"
| Cirrus -> "cirrus" in
let machine =
diff --git a/output/create_libvirt_xml.ml b/output/create_libvirt_xml.ml
index 64f1b0888cd6..ec1cd455ef13 100644
--- a/output/create_libvirt_xml.ml
+++ b/output/create_libvirt_xml.ml
@@ -421,6 +421,7 @@ let create_libvirt_xml ?pool source inspect
let video =
let video_model =
match guestcaps.gcaps_video with
+ | Standard_VGA -> assert false
| QXL -> e "model" [ "type", "qxl";
"ram", "65536" ] []
| Cirrus -> e "model" [ "type", "cirrus";
"vram", "9216" ] [] in
append_attr ("heads", "1") video_model;
diff --git a/output/openstack_image_properties.ml b/output/openstack_image_properties.ml
index 66f5399212c8..592da3e40e44 100644
--- a/output/openstack_image_properties.ml
+++ b/output/openstack_image_properties.ml
@@ -44,6 +44,7 @@ let create source inspect { target_buses; guestcaps; target_firmware }
=
| RTL8139 -> "rtl8139");
"hw_video_model",
(match guestcaps.gcaps_video with
+ | Standard_VGA -> assert false
| QXL -> "qxl"
| Cirrus -> "cirrus");
"hw_machine_type",
diff --git a/output/output.ml b/output/output.ml
index 9c2d8853bfef..93dbd4a62865 100644
--- a/output/output.ml
+++ b/output/output.ml
@@ -1539,7 +1539,11 @@ and qemu_finalize dir source inspect target_meta
"addr=127.0.0.1"]
);
arg "-vga"
- (match guestcaps.gcaps_video with Cirrus -> "cirrus" | QXL ->
"qxl")
+ (match guestcaps.gcaps_video with
+ | Standard_VGA -> assert false
+ | Cirrus -> "cirrus"
+ | QXL -> "qxl"
+ )
);
(* Add a sound card. *)
--
2.19.1.3.g30247aa5d201