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 function). 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@redhat.com> --- Notes: v1: - drop the "convert/convert_linux.ml" and "convert/windows_virtio.ml" hunks, as those files don't match "guestcaps_video_type" expressions since commit b28cd1dcfeb4 ("Remove requested_guestcaps / rcaps", 2021-11-08) [Rich] - remove the "string_of_requested_guestcaps" reference from the commit message, due to the same commit [Rich] - contextual conflict, due to commit f0afc4395248 ("Remove guestcaps_block_type Virtio_SCSI", 2021-11-08), auto-resolved in "lib/types.mli" and "lib/types.ml" 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 +++++- 6 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/types.ml b/lib/types.ml index aeb7d71ae0a3..e7fc8b38787c 100644 --- a/lib/types.ml +++ b/lib/types.ml @@ -424,7 +424,7 @@ type guestcaps = { } and guestcaps_block_type = Virtio_blk | 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 @@ -435,6 +435,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 3aab1ea7e4f2..3a2ba9fecf9a 100644 --- a/lib/types.mli +++ b/lib/types.mli @@ -284,7 +284,7 @@ type guestcaps = { and guestcaps_block_type = Virtio_blk | 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 211cd5d648c0..3cadf6b43378 100644 --- a/output/create_json.ml +++ b/output/create_json.ml @@ -203,6 +203,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 bca0766e28c1..72f3e9d9261d 100644 --- a/output/openstack_image_properties.ml +++ b/output/openstack_image_properties.ml @@ -43,6 +43,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