The "guestcaps_video_type" variant type now has a single (non-parametric) constructor (namely "Standard_VGA"). Replace all uses of this type / constructor with (simpler) constant expressions, wherever values are necessary. Remove "guestcaps_video_type" from dependent types, where it effectively no longer carries any information. (The "string_of_video" function is only used for debugging, via "string_of_guestcaps", in "do_convert" [convert/convert.ml]).
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1961107 Signed-off-by: Laszlo Ersek <[email protected]> --- Notes: v1: - new in v1 convert/convert_linux.ml | 1 - convert/convert_windows.ml | 2 -- convert/windows_virtio.ml | 4 ++-- convert/windows_virtio.mli | 11 +++++------ lib/types.ml | 6 ------ lib/types.mli | 11 ++++------- output/create_json.ml | 4 +--- output/create_libvirt_xml.ml | 3 +-- output/openstack_image_properties.ml | 4 +--- output/output.ml | 5 +---- 10 files changed, 15 insertions(+), 36 deletions(-) diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml index f0213f06eec2..8dc648169dcb 100644 --- a/convert/convert_linux.ml +++ b/convert/convert_linux.ml @@ -148,7 +148,6 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ = let guestcaps = { gcaps_block_bus = block_type; gcaps_net_bus = net_type; - gcaps_video = Standard_VGA; gcaps_virtio_rng = kernel.ki_supports_virtio_rng; gcaps_virtio_balloon = kernel.ki_supports_virtio_balloon; gcaps_isa_pvpanic = kernel.ki_supports_isa_pvpanic; diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml index 1a653b88e7fa..0ebffb156633 100644 --- a/convert/convert_windows.ml +++ b/convert/convert_windows.ml @@ -211,7 +211,6 @@ let convert (g : G.guestfs) _ inspect _ static_ips = (* Open the system hive for writes and update it. *) let block_driver, net_driver, - video_driver, virtio_rng_supported, virtio_ballon_supported, isa_pvpanic_supported, @@ -253,7 +252,6 @@ let convert (g : G.guestfs) _ inspect _ static_ips = let guestcaps = { gcaps_block_bus = block_driver; gcaps_net_bus = net_driver; - gcaps_video = video_driver; gcaps_virtio_rng = virtio_rng_supported; gcaps_virtio_balloon = virtio_ballon_supported; gcaps_isa_pvpanic = isa_pvpanic_supported; diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml index 77aeac2d4a9f..1c5c148e65fd 100644 --- a/convert/windows_virtio.ml +++ b/convert/windows_virtio.ml @@ -53,7 +53,7 @@ let rec install_drivers ((g, _) as reg) inspect = warning (f_"there are no virtio drivers available for this version of Windows (%d.%d %s %s). virt-v2v looks for drivers in %s\n\nThe guest will be configured to use slower emulated devices.") inspect.i_major_version inspect.i_minor_version inspect.i_arch inspect.i_product_variant virtio_win; - (IDE, RTL8139, Standard_VGA, false, false, false, false) + (IDE, RTL8139, false, false, false, false) ) else ( (* Can we install the block driver? *) @@ -109,7 +109,7 @@ let rec install_drivers ((g, _) as reg) inspect = let isa_pvpanic_supported = g#exists (driverdir // "pvpanic.inf") in let virtio_socket_supported = g#exists (driverdir // "viosock.inf") in - (block, net, Standard_VGA, + (block, net, virtio_rng_supported, virtio_ballon_supported, isa_pvpanic_supported, virtio_socket_supported) ) diff --git a/convert/windows_virtio.mli b/convert/windows_virtio.mli index b314d01da6cb..53603d240553 100644 --- a/convert/windows_virtio.mli +++ b/convert/windows_virtio.mli @@ -20,7 +20,7 @@ val install_drivers : Registry.t -> Types.inspect -> - Types.guestcaps_block_type * Types.guestcaps_net_type * Types.guestcaps_video_type * bool * bool * bool * bool + Types.guestcaps_block_type * Types.guestcaps_net_type * bool * bool * bool * bool (** [install_drivers reg inspect] installs virtio drivers from the driver directory or driver ISO into the guest driver directory and updates the registry @@ -29,11 +29,10 @@ val install_drivers [reg] is the system hive which is open for writes when this function is called. - This returns the tuple [(block_driver, net_driver, video_driver, - virtio_rng_supported, virtio_ballon_supported, isa_pvpanic_supported, - virtio_socket_supported)] reflecting what devices are now required by the - guest, either virtio devices if we managed to install those, or legacy - devices if we didn't. *) + This returns the tuple [(block_driver, net_driver, virtio_rng_supported, + virtio_ballon_supported, isa_pvpanic_supported, virtio_socket_supported)] + reflecting what devices are now required by the guest, either virtio + devices if we managed to install those, or legacy devices if we didn't. *) val install_linux_tools : Guestfs.guestfs -> Types.inspect -> unit (** installs QEMU Guest Agent on Linux guest OS from the driver directory or diff --git a/lib/types.ml b/lib/types.ml index 37696ebbabdd..acca0d989b91 100644 --- a/lib/types.ml +++ b/lib/types.ml @@ -413,7 +413,6 @@ type target_nics = source_nic list type guestcaps = { gcaps_block_bus : guestcaps_block_type; gcaps_net_bus : guestcaps_net_type; - gcaps_video : guestcaps_video_type; gcaps_virtio_rng : bool; gcaps_virtio_balloon : bool; gcaps_isa_pvpanic : bool; @@ -424,7 +423,6 @@ type guestcaps = { } and guestcaps_block_type = Virtio_blk | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 -and guestcaps_video_type = Standard_VGA and guestcaps_machine = I440FX | Q35 | Virt let string_of_block_type = function @@ -434,8 +432,6 @@ let string_of_net_type = function | Virtio_net -> "virtio-net" | E1000 -> "e1000" | RTL8139 -> "rtl8139" -let string_of_video = function - | Standard_VGA -> "stdvga" let string_of_machine = function | I440FX -> "i440fx" | Q35 -> "q35" @@ -445,13 +441,11 @@ let string_of_guestcaps gcaps = sprintf "\ gcaps_block_bus = %s gcaps_net_bus = %s -gcaps_video = %s gcaps_machine = %s gcaps_arch = %s gcaps_acpi = %b " (string_of_block_type gcaps.gcaps_block_bus) (string_of_net_type gcaps.gcaps_net_bus) - (string_of_video gcaps.gcaps_video) (string_of_machine gcaps.gcaps_machine) gcaps.gcaps_arch gcaps.gcaps_acpi diff --git a/lib/types.mli b/lib/types.mli index 8d48c300ec17..e0ef222e0455 100644 --- a/lib/types.mli +++ b/lib/types.mli @@ -265,12 +265,10 @@ type target_nics = source_nic list type guestcaps = { gcaps_block_bus : guestcaps_block_type; gcaps_net_bus : guestcaps_net_type; - gcaps_video : guestcaps_video_type; - (** Best block device, network device and video device guest can - access. These are determined during conversion by inspecting the - guest (and in some cases conversion can actually enhance these by - installing drivers). Thus this is not known until after - conversion. *) + (** Best block device and network device guest can access. These are + determined during conversion by inspecting the guest (and in some cases + conversion can actually enhance these by installing drivers). Thus this + is not known until after conversion. *) gcaps_virtio_rng : bool; (** Guest supports virtio-rng. *) gcaps_virtio_balloon : bool; (** Guest supports virtio balloon. *) @@ -284,7 +282,6 @@ type guestcaps = { and guestcaps_block_type = Virtio_blk | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 -and guestcaps_video_type = Standard_VGA 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 3f6a734c9f8e..b48902b7d221 100644 --- a/output/create_json.ml +++ b/output/create_json.ml @@ -201,9 +201,7 @@ let create_json_metadata source inspect | Virtio_net -> "virtio-net" | E1000 -> "e1000" | RTL8139 -> "rtl8139" in - let video = - match guestcaps.gcaps_video with - | Standard_VGA -> "vga" in + let video = "vga" in let machine = match guestcaps.gcaps_machine with | I440FX -> "i440fx" diff --git a/output/create_libvirt_xml.ml b/output/create_libvirt_xml.ml index 041643969c23..9413cc0bf884 100644 --- a/output/create_libvirt_xml.ml +++ b/output/create_libvirt_xml.ml @@ -420,8 +420,7 @@ let create_libvirt_xml ?pool source inspect *) let video = let video_model = - match guestcaps.gcaps_video with - | Standard_VGA -> e "model" [ "type", "vga"; "vram", "16384" ] [] in + e "model" [ "type", "vga"; "vram", "16384" ] [] in append_attr ("heads", "1") video_model; e "video" [] [ video_model ] in List.push_back devices video; diff --git a/output/openstack_image_properties.ml b/output/openstack_image_properties.ml index 0a7d366967b6..c75d72fe6942 100644 --- a/output/openstack_image_properties.ml +++ b/output/openstack_image_properties.ml @@ -41,9 +41,7 @@ let create source inspect { target_buses; guestcaps; target_firmware } = | Virtio_net -> "virtio" | E1000 -> "e1000" | RTL8139 -> "rtl8139"); - "hw_video_model", - (match guestcaps.gcaps_video with - | Standard_VGA -> "vga"); + "hw_video_model", "vga"; "hw_machine_type", (match guestcaps.gcaps_machine with | I440FX -> "pc" diff --git a/output/output.ml b/output/output.ml index 340883d97717..41a816108847 100644 --- a/output/output.ml +++ b/output/output.ml @@ -1538,10 +1538,7 @@ and qemu_finalize dir source inspect target_meta | Some p -> p); "addr=127.0.0.1"] ); - arg "-vga" - (match guestcaps.gcaps_video with - | Standard_VGA -> "std" - ) + arg "-vga" "std" ); (* Add a sound card. *) -- 2.19.1.3.g30247aa5d201 _______________________________________________ Libguestfs mailing list [email protected] https://listman.redhat.com/mailman/listinfo/libguestfs
