Life would be too simple if we could just call osinfo_os_get_all_devices()
for determining virtio-1.0 support for Windows guests. Now that we've
extracted the libosinfo logic that identifies the "best" virtio driver
(for copying its files into the guest), fetch the list of devices
supported by the same "best driver" as well. Use that list, in addition to
the one from osinfo_os_get_all_devices(), for determining (Q35 and)
virtio-1.0 support.
Thankfully this mess is not needed when converting Linux guests.
With this, we need to revert the data for three Windows-based test cases
to their pre-f0cea012d018 status (modulo intermediary commits 4f6b143c1cb3
("output: -o libvirt, qemu: Use correct device name for vsock",
2022-01-20) and 4c3d0b8b3b4b ("output: -o libvirt: Fix <graphics/> element
port/autoport", 2022-01-20)).
Fixes: f0cea012d0183edf6f7b769c28d5038593f3fe6a
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=2043333
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
convert/convert_windows.ml | 15 ++++++++++++---
tests/test-v2v-cdrom.expected | 2 +-
tests/test-v2v-floppy.expected | 2 +-
tests/test-v2v-i-ova.xml | 8 ++++----
4 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml
index 1c2d17f26543..947775416ef5 100644
--- a/convert/convert_windows.ml
+++ b/convert/convert_windows.ml
@@ -240,17 +240,26 @@ let convert (g : G.guestfs) _ inspect _ static_ips =
let machine, virtio_1_0 =
match inspect.i_arch with
| ("i386"|"x86_64") ->
(try
let os = Libosinfo_utils.get_os_by_short_id inspect.i_osinfo in
- let devices = os#get_devices () in
- debug "libosinfo devices for OS \"%s\":\n%s"
inspect.i_osinfo
+ let devices = os#get_devices ()
+ and drivers = os#get_device_drivers () in
+ let best_drv_devs =
+ try (Libosinfo_utils.best_driver drivers inspect.i_arch).devices
+ with Not_found -> [] in
+ debug "libosinfo internal devices for OS \"%s\":\n%s"
+ inspect.i_osinfo
(Libosinfo_utils.string_of_osinfo_device_list devices);
+ debug "libosinfo \"best driver\" devices for OS
\"%s\":\n%s"
+ inspect.i_osinfo
+ (Libosinfo_utils.string_of_osinfo_device_list best_drv_devs);
let { Libosinfo_utils.q35; vio10 } =
- Libosinfo_utils.os_support_of_osinfo_device_list devices in
+ Libosinfo_utils.os_support_of_osinfo_device_list
+ (devices @ best_drv_devs) in
(if q35 then Q35 else I440FX), vio10
with
| Not_found ->
(* Pivot on the year 2007. Any Windows version from earlier than
* 2007 should use i440fx, anything 2007 or newer should use q35.
* Luckily this coincides almost exactly with the release of NT 6.
diff --git a/tests/test-v2v-cdrom.expected b/tests/test-v2v-cdrom.expected
index b950492969c8..17bd152d8e64 100644
--- a/tests/test-v2v-cdrom.expected
+++ b/tests/test-v2v-cdrom.expected
@@ -1,7 +1,7 @@
- <disk type='file' device='disk'
model='virtio-transitional'>
+ <disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<target dev='vda' bus='virtio'/>
</disk>
<disk device='cdrom' type='file'>
<driver name='qemu' type='raw'/>
<target dev='sdc' bus='sata'/>
diff --git a/tests/test-v2v-floppy.expected b/tests/test-v2v-floppy.expected
index f4b679540c9d..a718c21f94dd 100644
--- a/tests/test-v2v-floppy.expected
+++ b/tests/test-v2v-floppy.expected
@@ -1,7 +1,7 @@
- <disk type='file' device='disk'
model='virtio-transitional'>
+ <disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<target dev='vda' bus='virtio'/>
</disk>
<disk device='floppy' type='file'>
<driver name='qemu' type='raw'/>
<target dev='fda'/>
diff --git a/tests/test-v2v-i-ova.xml b/tests/test-v2v-i-ova.xml
index 1915dd40aff0..6b8cda62f051 100644
--- a/tests/test-v2v-i-ova.xml
+++ b/tests/test-v2v-i-ova.xml
@@ -18,13 +18,13 @@
<type arch='x86_64' machine='q35'>hvm</type>
</os>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
- <disk type='file' device='disk'
model='virtio-transitional'>
+ <disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='TestOva-sda'/>
<target dev='vda' bus='virtio'/>
</disk>
<disk device='cdrom' type='file'>
<driver name='qemu' type='raw'/>
@@ -33,21 +33,21 @@
<disk device='floppy' type='file'>
<driver name='qemu' type='raw'/>
<target dev='fda'/>
</disk>
<interface type='bridge'>
<source bridge='VM Network'/>
- <model type='virtio-transitional'/>
+ <model type='virtio'/>
</interface>
<video>
<model type='vga' vram='16384' heads='1'/>
</video>
<graphics type='vnc' autoport='yes'/>
- <rng model='virtio-transitional'>
+ <rng model='virtio'>
<backend model='random'>/dev/urandom</backend>
</rng>
- <memballoon model='virtio-transitional'/>
+ <memballoon model='virtio'/>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<console type='pty'/>
</devices>
</domain>
--
2.19.1.3.g30247aa5d201