diff --git a/0001-output-o-json-Allow-oo-output-options-to-work.patch b/0001-output-o-json-Allow-oo-output-options-to-work.patch
index f918f5f..0c1e428 100644
--- a/0001-output-o-json-Allow-oo-output-options-to-work.patch
+++ b/0001-output-o-json-Allow-oo-output-options-to-work.patch
@@ -27,5 +27,5 @@ index 770eb8ca..bb0cdfeb 100644
let output_name = get_output_name options source in
let disks = get_disks dir in
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0002-input-xen-Fix-assertion-error-when-importing-from-re.patch b/0002-input-xen-Fix-assertion-error-when-importing-from-remote-block-device.patch
similarity index 99%
rename from 0002-input-xen-Fix-assertion-error-when-importing-from-re.patch
rename to 0002-input-xen-Fix-assertion-error-when-importing-from-remote-block-device.patch
index d8049ab..bafe3fe 100644
--- a/0002-input-xen-Fix-assertion-error-when-importing-from-re.patch
+++ b/0002-input-xen-Fix-assertion-error-when-importing-from-remote-block-device.patch
@@ -96,5 +96,5 @@ index 5bb46bde..cb8b1f91 100644
let cor = dir // "convert" in
let bandwidth = options.bandwidth in
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0003-Restore-message-about-setting-up-the-input-and-outpu.patch b/0003-Restore-message-about-setting-up-the-input-and-output.patch
similarity index 99%
rename from 0003-Restore-message-about-setting-up-the-input-and-outpu.patch
rename to 0003-Restore-message-about-setting-up-the-input-and-output.patch
index 4f77cd1..58a8d05 100644
--- a/0003-Restore-message-about-setting-up-the-input-and-outpu.patch
+++ b/0003-Restore-message-about-setting-up-the-input-and-output.patch
@@ -545,5 +545,5 @@ index 47e6e937..d74cc21f 100644
(* Debug the v2vdir. *)
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0004-output-o-libvirt-Fix-graphics-element-port-autoport.patch b/0004-output-o-libvirt-Fix-graphics-element-port-autoport.patch
index a5befe4..b493464 100644
--- a/0004-output-o-libvirt-Fix-graphics-element-port-autoport.patch
+++ b/0004-output-o-libvirt-Fix-graphics-element-port-autoport.patch
@@ -74,5 +74,5 @@ index 2b6a8de0..e72c1db3 100644
/dev/urandom
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0005-output-o-libvirt-qemu-Use-correct-device-name-for-vs.patch b/0005-output-o-libvirt-qemu-Use-correct-device-name-for-vsock.patch
similarity index 99%
rename from 0005-output-o-libvirt-qemu-Use-correct-device-name-for-vs.patch
rename to 0005-output-o-libvirt-qemu-Use-correct-device-name-for-vsock.patch
index f79ef89..ca71deb 100644
--- a/0005-output-o-libvirt-qemu-Use-correct-device-name-for-vs.patch
+++ b/0005-output-o-libvirt-qemu-Use-correct-device-name-for-vsock.patch
@@ -65,5 +65,5 @@ index e72c1db3..1915dd40 100644
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0006-tests-Drop-some-obsolete-Fedora-versions-start-testi.patch b/0006-tests-Drop-some-obsolete-Fedora-versions-start-testing-F35.patch
similarity index 98%
rename from 0006-tests-Drop-some-obsolete-Fedora-versions-start-testi.patch
rename to 0006-tests-Drop-some-obsolete-Fedora-versions-start-testing-F35.patch
index 03ca77a..c9bfa9d 100644
--- a/0006-tests-Drop-some-obsolete-Fedora-versions-start-testi.patch
+++ b/0006-tests-Drop-some-obsolete-Fedora-versions-start-testing-F35.patch
@@ -37,5 +37,5 @@ index 222b5872..b4d3a5b5 100644
test-v2v-conversion-of-opensuse-13.2.sh \
test-v2v-conversion-of-opensuse-42.1.sh \
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0007-tests-Drop-test-of-centos-6.patch b/0007-tests-Drop-test-of-centos-6.patch
index 9082154..47c8e4c 100644
--- a/0007-tests-Drop-test-of-centos-6.patch
+++ b/0007-tests-Drop-test-of-centos-6.patch
@@ -33,5 +33,5 @@ index b4d3a5b5..11c29676 100644
test-v2v-conversion-of-debian-6.sh \
test-v2v-conversion-of-debian-7.sh \
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0008-tests-Drop-ancient-Ubuntu-versions-add-Ubuntu-20.04-.patch b/0008-tests-Drop-ancient-Ubuntu-versions-add-Ubuntu-20.04-LTS.patch
similarity index 98%
rename from 0008-tests-Drop-ancient-Ubuntu-versions-add-Ubuntu-20.04-.patch
rename to 0008-tests-Drop-ancient-Ubuntu-versions-add-Ubuntu-20.04-LTS.patch
index 7c382b7..4681310 100644
--- a/0008-tests-Drop-ancient-Ubuntu-versions-add-Ubuntu-20.04-.patch
+++ b/0008-tests-Drop-ancient-Ubuntu-versions-add-Ubuntu-20.04-LTS.patch
@@ -29,5 +29,5 @@ index 11c29676..3e828558 100644
test-v2v-conversion-of-windows-6.3-server.sh \
test-v2v-conversion-of-windows-10.0-server.sh
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0009-tests-Drop-old-and-add-newer-RHEL-versions-to-the-te.patch b/0009-tests-Drop-old-and-add-newer-RHEL-versions-to-the-tests.patch
similarity index 98%
rename from 0009-tests-Drop-old-and-add-newer-RHEL-versions-to-the-te.patch
rename to 0009-tests-Drop-old-and-add-newer-RHEL-versions-to-the-tests.patch
index ed711f1..b2717e4 100644
--- a/0009-tests-Drop-old-and-add-newer-RHEL-versions-to-the-te.patch
+++ b/0009-tests-Drop-old-and-add-newer-RHEL-versions-to-the-tests.patch
@@ -33,5 +33,5 @@ index 3e828558..4b66cb0d 100644
test-v2v-conversion-of-ubuntu-18.04.sh \
test-v2v-conversion-of-ubuntu-20.04.sh \
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0010-tests-Don-t-use-virt-builder-update-when-testing-Win.patch b/0010-tests-Don-t-use-virt-builder-update-when-testing-Windows-conversions.patch
similarity index 98%
rename from 0010-tests-Don-t-use-virt-builder-update-when-testing-Win.patch
rename to 0010-tests-Don-t-use-virt-builder-update-when-testing-Windows-conversions.patch
index e07bf23..5bf9425 100644
--- a/0010-tests-Don-t-use-virt-builder-update-when-testing-Win.patch
+++ b/0010-tests-Don-t-use-virt-builder-update-when-testing-Windows-conversions.patch
@@ -48,5 +48,5 @@ index 232c6300..5a974d1b 100755
# Create some minimal test metadata.
cat > "$xml" < (module Output_rhv_upload.RHVUpload)
| `RHV -> (module Output_rhv.RHV)
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0022-RHEL-Remove-the-in-place-option.patch b/0022-RHEL-Remove-the-in-place-option.patch
index b04a022..166dd93 100644
--- a/0022-RHEL-Remove-the-in-place-option.patch
+++ b/0022-RHEL-Remove-the-in-place-option.patch
@@ -148,5 +148,5 @@ index 0a69c8e5..1c74f01f 100644
pr "mac-option\n";
pr "bandwidth-option\n";
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0023-input-libvirt-Share-a-single-connection-to-the-sourc.patch b/0023-input-libvirt-Share-a-single-connection-to-the-source-NBD-server.patch
similarity index 98%
rename from 0023-input-libvirt-Share-a-single-connection-to-the-sourc.patch
rename to 0023-input-libvirt-Share-a-single-connection-to-the-source-NBD-server.patch
index 59ec98b..9b4a7c2 100644
--- a/0023-input-libvirt-Share-a-single-connection-to-the-sourc.patch
+++ b/0023-input-libvirt-Share-a-single-connection-to-the-source-NBD-server.patch
@@ -41,5 +41,5 @@ index 33f61086..42050c15 100644
(* --exit-with-parent should ensure nbdkit is cleaned
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0024-v2v-Send-nbdinfo-debug-information-to-stderr-not-std.patch b/0024-v2v-Send-nbdinfo-debug-information-to-stderr-not-stdout.patch
similarity index 98%
rename from 0024-v2v-Send-nbdinfo-debug-information-to-stderr-not-std.patch
rename to 0024-v2v-Send-nbdinfo-debug-information-to-stderr-not-stdout.patch
index 7258f66..0d778be 100644
--- a/0024-v2v-Send-nbdinfo-debug-information-to-stderr-not-std.patch
+++ b/0024-v2v-Send-nbdinfo-debug-information-to-stderr-not-stdout.patch
@@ -48,5 +48,5 @@ index 1c74f01f..92546940 100644
ignore (Sys.command cmd)
--
-2.31.1
+2.19.1.3.g30247aa5d201
diff --git a/0025-input-Require-ip-password-for-vCenter-over-HTTPS.patch b/0025-input-Require-ip-password-for-vCenter-over-HTTPS.patch
new file mode 100644
index 0000000..3d662a4
--- /dev/null
+++ b/0025-input-Require-ip-password-for-vCenter-over-HTTPS.patch
@@ -0,0 +1,112 @@
+From 0210e940c9bd7bbfda9654feea13cb3baccb1a00 Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones"
+Date: Tue, 1 Feb 2022 09:54:06 +0000
+Subject: [PATCH] input: Require -ip password for vCenter over HTTPS
+
+As far as I've ever seen, you always need a password to access the
+/folder directory of a VMware server. If the password isn't specified
+to virt-v2v using the -ip option then it used to try to ask for it
+interactively when virt-v2v started. Actually it asked for the
+password several times -- at least twice.
+
+After we added the cookie-script feature (commit 2b9a11743b "v2v:
+vcenter: Implement cookie scripts.") it tries to ask interactively at
+random points during the conversion, which is obviously bad from a UI
+point of view but also because the password is requested without a
+prompt looks like a hang.
+
+We could solve this by prompting for a password. But virt-v2v is not
+primarily an interactive tool and it's an easier fix is to require the
+caller to use the -ip passwordfile option (in this particular mode).
+
+Reported-by: Xinyu Li
+Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1960087
+(cherry picked from commit 8abc07a8589a48c79cc65159640e0d8ab3c9b261)
+Signed-off-by: Laszlo Ersek
+---
+ docs/virt-v2v-input-vmware.pod | 12 ++++++++++++
+ input/input_vcenter_https.ml | 12 +++++++++---
+ 2 files changed, 21 insertions(+), 3 deletions(-)
+
+diff --git a/docs/virt-v2v-input-vmware.pod b/docs/virt-v2v-input-vmware.pod
+index d0a3f742..584eba38 100644
+--- a/docs/virt-v2v-input-vmware.pod
++++ b/docs/virt-v2v-input-vmware.pod
+@@ -24,6 +24,7 @@ virt-v2v-input-vmware - Using virt-v2v to convert guests from VMware
+
+ virt-v2v
+ -ic 'vpx://root@vcenter.example.com/Datacenter/esxi?no_verify=1'
++ -ip passwordfile
+ "GUEST NAME" [-o* options]
+
+ =head1 DESCRIPTION
+@@ -389,6 +390,9 @@ will need to URI-escape that character using C<%5c>: C
+ (5c is the hexadecimal ASCII code for backslash.) Other punctuation
+ may also have to be escaped.
+
++The user's password must be supplied in a local file using the
++separate I<-ip> parameter.
++
+ =item C
+
+ is the vCenter Server (I hypervisor).
+@@ -472,11 +476,19 @@ B. Fix your libvirt configuration and/or your VMware
+ vCenter Server before continuing.
+
++=head2 vCenter: Supplying the password
++
++The vCenter password (usually for the root account, or the account
++specified by C in the vpx URL) has to be written to a local
++file, and the name of that file specified on the virt-v2v command line
++using I<-ip passwordfile>.
++
+ =head2 vCenter: Importing a guest
+
+ To import a particular guest from vCenter Server, do:
+
+ $ virt-v2v -ic 'vpx://root@vcenter.example.com/Datacenter/esxi?no_verify=1' \
++ -ip passwordfile \
+ "Windows 2003" \
+ -o local -os /var/tmp
+
+diff --git a/input/input_vcenter_https.ml b/input/input_vcenter_https.ml
+index bcefed16..fd5b4017 100644
+--- a/input/input_vcenter_https.ml
++++ b/input/input_vcenter_https.ml
+@@ -53,6 +53,13 @@ let rec vcenter_https_source dir options args =
+ | _ ->
+ error (f_"-i libvirt: expecting a libvirt guest name on the command line") in
+
++ (* -ip is required in this mode, see RHBZ#1960087 *)
++ let password_file =
++ match options.input_password with
++ | Some file -> file
++ | None ->
++ error (f_"-i libvirt: expecting -ip passwordfile parameter for vCenter connection") in
++
+ (* -ic must be set and it must contain a server. This is
+ * enforced by virt-v2v.
+ *)
+@@ -76,8 +83,7 @@ let rec vcenter_https_source dir options args =
+
+ (* Connect to the hypervisor. *)
+ let conn =
+- let auth = Libvirt_utils.auth_for_password_file
+- ?password_file:options.input_password () in
++ let auth = Libvirt_utils.auth_for_password_file ~password_file () in
+ Libvirt.Connect.connect_auth ~name:input_conn auth in
+
+ (* Parse the libvirt XML. *)
+@@ -109,7 +115,7 @@ let rec vcenter_https_source dir options args =
+ let cor = dir // "convert" in
+ let pid = VCenter.start_nbdkit_for_path
+ ?bandwidth:options.bandwidth
+- ~cor ?password_file:options.input_password
++ ~cor ~password_file
+ dcPath uri server path socket in
+ On_exit.kill pid
+ ) disks;
+--
+2.19.1.3.g30247aa5d201
+
diff --git a/0026-convert-windows_virtio-fix-copy_from_libosinfo-VIRTIO_WIN-priority.patch b/0026-convert-windows_virtio-fix-copy_from_libosinfo-VIRTIO_WIN-priority.patch
new file mode 100644
index 0000000..448b12f
--- /dev/null
+++ b/0026-convert-windows_virtio-fix-copy_from_libosinfo-VIRTIO_WIN-priority.patch
@@ -0,0 +1,131 @@
+From 887d374cc3a910db9794e12f2b13bd6c2a43d036 Mon Sep 17 00:00:00 2001
+From: Laszlo Ersek
+Date: Tue, 1 Feb 2022 13:32:13 +0100
+Subject: [PATCH] convert/windows_virtio: fix copy_from_libosinfo <->
+ VIRTIO_WIN priority
+
+Commit 258e4b718d5d introduced the "copy_from_libosinfo" branch in
+"copy_drivers" with higher priority than the existent
+"copy_from_virtio_win".
+
+This introduced a conflict with the documentation ("docs/virt-v2v.pod").
+The documentation stated (and still states) that the VIRTIO_WIN env var,
+when set, dictates where virt-v2v look for the virtio-win drivers. The
+conflict is that, even in case we set VIRTIO_WIN, virt-v2v still consults
+libosinfo first.
+
+Skip the "copy_from_libosinfo" branch in case VIRTIO_WIN is set, plus
+explain in the documentation that VIRTIO_WIN, when set, overrides
+libosinfo.
+
+NOTE: the necessity of this fix is made apparent by the next patch in the
+series. Namely, "copy_from_libosinfo" has a bug in the architecture
+filter. Once we fix that bug in the next patch, *and* install (e.g.)
+"virtio-win-1.9.24-4.el8.noarch" on the conversion host, the "i-ova" test
+case will suddenly prefer the virtio drivers exposed via libosinfo, in
+spite of the "tests/test-v2v-i-ova.sh" script explicitly setting
+VIRTIO_WIN to "test-data/fake-virtio-win". The symptom is that the pvpanic
+device will be enabled in the domain XML, due to it being supported by the
+actual (not fake) virtio-win drivers.
+
+Fixes: 258e4b718d5d80c79634fe864c8c52b12e41777c
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2043333
+Signed-off-by: Laszlo Ersek
+Message-Id: <20220201123219.9317-2-lersek@redhat.com>
+Acked-by: Richard W.M. Jones
+(cherry picked from commit be39049582fbd167c92062a4e63d10f13474aea0)
+Signed-off-by: Laszlo Ersek
+---
+ convert/windows_virtio.ml | 12 ++++++------
+ docs/virt-v2v.pod | 24 +++++++++++++++++-------
+ 2 files changed, 23 insertions(+), 13 deletions(-)
+
+diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
+index b3a35a0a..46e6350a 100644
+--- a/convert/windows_virtio.ml
++++ b/convert/windows_virtio.ml
+@@ -29,14 +29,14 @@ open Utils
+
+ module G = Guestfs
+
+-let virtio_win =
+- try Sys.getenv "VIRTIO_WIN"
++let virtio_win, virtio_win_from_env =
++ try Sys.getenv "VIRTIO_WIN", true
+ with Not_found ->
+- try Sys.getenv "VIRTIO_WIN_DIR" (* old name for VIRTIO_WIN *)
++ try Sys.getenv "VIRTIO_WIN_DIR" (* old name for VIRTIO_WIN *), true
+ with Not_found ->
+ let iso = Config.datadir // "virtio-win" // "virtio-win.iso" in
+- if Sys.file_exists iso then iso
+- else Config.datadir // "virtio-win"
++ (if Sys.file_exists iso then iso
++ else Config.datadir // "virtio-win"), false
+
+ let scsi_class_guid = "{4D36E97B-E325-11CE-BFC1-08002BE10318}"
+ let viostor_legacy_pciid = "VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00"
+@@ -228,7 +228,7 @@ and ddb_regedits inspect drv_name drv_pciid =
+ * been copied.
+ *)
+ and copy_drivers g inspect driverdir =
+- [] <> copy_from_libosinfo g inspect driverdir ||
++ (not virtio_win_from_env && [] <> copy_from_libosinfo g inspect driverdir) ||
+ [] <> copy_from_virtio_win g inspect "/" driverdir
+ virtio_iso_path_matches_guest_os
+ (fun () ->
+diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
+index 4f89d2b2..2836b509 100644
+--- a/docs/virt-v2v.pod
++++ b/docs/virt-v2v.pod
+@@ -875,7 +875,12 @@ below.
+ Ubuntu 10.04+ All versions support virtio
+
+ Windows Drivers are installed from the ISO or directory pointed
+- to by "VIRTIO_WIN" environment variable if present
++ to by the "VIRTIO_WIN" environment variable if present.
++ If the "VIRTIO_WIN" environment variable is absent
++ (which is the recommended setting), then libosinfo is
++ consulted first, for driver files that are locally
++ available on the conversion host.
++
+
+ =head2 RHEL 4: SELinux relabel appears to hang forever
+
+@@ -1514,15 +1519,20 @@ I<--firstboot> or I<--firstboot-command> options with Windows guests.
+
+ =item C
+
+-This is where virtio drivers for Windows are searched for. It can be
+-a directory I point to F (CD ROM image containing
+-drivers).
++This is an override for where virtio drivers for Windows are searched
++for. It can be a directory I point to F (CD ROM
++image containing drivers).
+
+-If unset, then we look for drivers in whichever of these paths
+-is found first:
++If unset, then we look for drivers via whichever of these methods
++succeeds first:
+
+ =over 4
+
++=item C
++
++Load osinfo data from the default paths, and attempt to find drivers via
++libosinfo lookup. This is the preferred method.
++
+ =item F
+
+ The ISO containing virtio drivers for Windows.
+@@ -1530,7 +1540,7 @@ The ISO containing virtio drivers for Windows.
+ =item F
+
+ The exploded tree of virtio drivers for Windows. This is
+-usually incomplete, hence the ISO is preferred.
++usually incomplete, hence the least preferred method.
+
+ =back
+
+--
+2.19.1.3.g30247aa5d201
+
diff --git a/0027-convert-windows_virtio-map-32-bit-arch-name-from-libguestfs-to-osinfo.patch b/0027-convert-windows_virtio-map-32-bit-arch-name-from-libguestfs-to-osinfo.patch
new file mode 100644
index 0000000..86ad3df
--- /dev/null
+++ b/0027-convert-windows_virtio-map-32-bit-arch-name-from-libguestfs-to-osinfo.patch
@@ -0,0 +1,60 @@
+From 5f32e9ac9f501ce9bcae3ddcc8fa8ea8a1e873e0 Mon Sep 17 00:00:00 2001
+From: Laszlo Ersek
+Date: Tue, 1 Feb 2022 13:32:14 +0100
+Subject: [PATCH] convert/windows_virtio: map 32-bit arch name from libguestfs
+ to osinfo
+
+For Windows guests, the "inspect.i_arch" field is ultimately determined in
+libguestfs, on the following call path:
+
+ inspect_os [daemon/inspect.ml]
+ check_for_filesystem_on [daemon/inspect_fs.ml]
+ check_filesystem [daemon/inspect_fs.ml]
+ check_windows_root [daemon/inspect_fs_windows.ml]
+ check_windows_arch [daemon/inspect_fs_windows.ml]
+ file_architecture [daemon/filearch.ml]
+ file_architecture_of_magic [daemon/filearch.ml]
+
+where the last function maps "PE32 executable" to "i386".
+
+(As of libguestfs commit 5858c2cf6c24.)
+
+However, in osinfo-db (as of commit 72c69622e6db), the
+"data/schema/osinfo.rng.in" schema calls the same architecture "i686".
+
+Perform this mapping in the "copy_from_libosinfo" function explicitly: the
+filter currently throws away all "i686" drivers from libosinfo because
+they don't match "i386" from libguestfs.
+
+(There is no such problem with "x86_64".)
+
+Fixes: 258e4b718d5d80c79634fe864c8c52b12e41777c
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2043333
+Signed-off-by: Laszlo Ersek
+Acked-by: Richard W.M. Jones
+Message-Id: <20220201123219.9317-3-lersek@redhat.com>
+(cherry picked from commit 70d77100eee2c341359bcd76962478419d1f0548)
+Signed-off-by: Laszlo Ersek
+---
+ convert/windows_virtio.ml | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
+index 46e6350a..1d8b0cb0 100644
+--- a/convert/windows_virtio.ml
++++ b/convert/windows_virtio.ml
+@@ -416,6 +416,11 @@ and copy_from_libosinfo g inspect destdir =
+ )
+ in
+ let { i_osinfo = osinfo; i_arch = arch } = inspect in
++ (* The architecture that "inspect.i_arch" from libguestfs
++ * ("daemon/filearch.ml") calls "i386", the osinfo-db schema
++ * ("data/schema/osinfo.rng.in") calls "i686".
++ *)
++ let arch = if arch = "i386" then "i686" else arch in
+ try
+ let os = Libosinfo_utils.get_os_by_short_id osinfo in
+ let drivers = os#get_device_drivers () in
+--
+2.19.1.3.g30247aa5d201
+
diff --git a/0028-convert-libosinfo-factor-out-v2v_osinfo_device_list_to_value_list.patch b/0028-convert-libosinfo-factor-out-v2v_osinfo_device_list_to_value_list.patch
new file mode 100644
index 0000000..2667bca
--- /dev/null
+++ b/0028-convert-libosinfo-factor-out-v2v_osinfo_device_list_to_value_list.patch
@@ -0,0 +1,176 @@
+From b6bfcce0340b2c602b42df8fceff68be83db3fe9 Mon Sep 17 00:00:00 2001
+From: Laszlo Ersek
+Date: Tue, 1 Feb 2022 13:32:15 +0100
+Subject: [PATCH] convert/libosinfo: factor out
+ v2v_osinfo_device_list_to_value_list()
+
+Move the guts of v2v_osinfo_os_get_all_devices() to a new static function
+called v2v_osinfo_device_list_to_value_list().
+
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2043333
+Signed-off-by: Laszlo Ersek
+Acked-by: Richard W.M. Jones
+Message-Id: <20220201123219.9317-4-lersek@redhat.com>
+(cherry picked from commit 9045c87d3a6f43a4063f6b52d05c6dcf7e051319)
+Signed-off-by: Laszlo Ersek
+---
+ convert/libosinfo-c.c | 126 +++++++++++++++++++++++-------------------
+ 1 file changed, 68 insertions(+), 58 deletions(-)
+
+diff --git a/convert/libosinfo-c.c b/convert/libosinfo-c.c
+index ec7c06d3..bc5816f6 100644
+--- a/convert/libosinfo-c.c
++++ b/convert/libosinfo-c.c
+@@ -210,59 +210,6 @@ glist_to_value_list (GList *list)
+ CAMLreturn (rv);
+ }
+
+-value
+-v2v_osinfo_os_get_device_drivers (value osv)
+-{
+- CAMLparam1 (osv);
+- CAMLlocal4 (rv, v, vi, copyv);
+- OsinfoDeviceDriverList *list;
+- gint i, len;
+-
+- list = osinfo_os_get_device_drivers (OsinfoOs_t_val (osv));
+- len = osinfo_list_get_length (OSINFO_LIST(list));
+-
+- rv = Val_emptylist;
+- for (i = len - 1; i >= 0; --i) {
+- OsinfoDeviceDriver *driver;
+- const gchar *str;
+- gboolean b;
+- GList *l;
+- gint64 i64;
+-
+- driver = OSINFO_DEVICE_DRIVER(osinfo_list_get_nth (OSINFO_LIST(list), i));
+-
+- vi = caml_alloc (6, 0);
+- str = osinfo_device_driver_get_architecture (driver);
+- copyv = caml_copy_string (str);
+- Store_field (vi, 0, copyv);
+- str = osinfo_device_driver_get_location (driver);
+- copyv = caml_copy_string (str);
+- Store_field (vi, 1, copyv);
+- b = osinfo_device_driver_get_pre_installable (driver);
+- Store_field (vi, 2, Val_bool (b));
+- b = osinfo_device_driver_get_signed (driver);
+- Store_field (vi, 3, Val_bool (b));
+-#if IS_LIBOSINFO_VERSION(1, 7, 0)
+- i64 = osinfo_device_driver_get_priority (driver);
+-#else
+- /* Same as OSINFO_DEVICE_DRIVER_DEFAULT_PRIORITY in libosinfo 1.7.0+. */
+- i64 = 50;
+-#endif
+- copyv = caml_copy_int64 (i64);
+- Store_field (vi, 4, copyv);
+- l = osinfo_device_driver_get_files (driver);
+- Store_field (vi, 5, glist_to_value_list (l));
+- g_list_free (l);
+-
+- v = caml_alloc (2, 0);
+- Store_field (v, 0, vi);
+- Store_field (v, 1, rv);
+- rv = v;
+- }
+-
+- CAMLreturn (rv);
+-}
+-
+ /* Collect OsinfoDevice properties from two levels:
+ *
+ * - The OSINFO_ENTITY_PROP_ID property, originating from the OsinfoEntity base
+@@ -288,17 +235,15 @@ static const char * const device_prop[] = {
+ };
+ #define NUM_DEVICE_PROPS (sizeof device_prop / sizeof device_prop[0])
+
+-value
+-v2v_osinfo_os_get_all_devices (value osv)
++static value
++v2v_osinfo_device_list_to_value_list (OsinfoDeviceList *dev_list)
+ {
+- CAMLparam1 (osv);
++ CAMLparam0 ();
+ CAMLlocal4 (retvalv, linkv, propsv, copyv);
+- g_autoptr (OsinfoDeviceList) dev_list = NULL;
+ OsinfoList *ent_list;
+ gint ent_nr;
+
+ retvalv = Val_emptylist;
+- dev_list = osinfo_os_get_all_devices (OsinfoOs_t_val (osv), NULL);
+ ent_list = OSINFO_LIST (dev_list);
+ ent_nr = osinfo_list_get_length (ent_list);
+
+@@ -328,3 +273,68 @@ v2v_osinfo_os_get_all_devices (value osv)
+
+ CAMLreturn (retvalv);
+ }
++
++value
++v2v_osinfo_os_get_device_drivers (value osv)
++{
++ CAMLparam1 (osv);
++ CAMLlocal4 (rv, v, vi, copyv);
++ OsinfoDeviceDriverList *list;
++ gint i, len;
++
++ list = osinfo_os_get_device_drivers (OsinfoOs_t_val (osv));
++ len = osinfo_list_get_length (OSINFO_LIST(list));
++
++ rv = Val_emptylist;
++ for (i = len - 1; i >= 0; --i) {
++ OsinfoDeviceDriver *driver;
++ const gchar *str;
++ gboolean b;
++ GList *l;
++ gint64 i64;
++
++ driver = OSINFO_DEVICE_DRIVER(osinfo_list_get_nth (OSINFO_LIST(list), i));
++
++ vi = caml_alloc (6, 0);
++ str = osinfo_device_driver_get_architecture (driver);
++ copyv = caml_copy_string (str);
++ Store_field (vi, 0, copyv);
++ str = osinfo_device_driver_get_location (driver);
++ copyv = caml_copy_string (str);
++ Store_field (vi, 1, copyv);
++ b = osinfo_device_driver_get_pre_installable (driver);
++ Store_field (vi, 2, Val_bool (b));
++ b = osinfo_device_driver_get_signed (driver);
++ Store_field (vi, 3, Val_bool (b));
++#if IS_LIBOSINFO_VERSION(1, 7, 0)
++ i64 = osinfo_device_driver_get_priority (driver);
++#else
++ /* Same as OSINFO_DEVICE_DRIVER_DEFAULT_PRIORITY in libosinfo 1.7.0+. */
++ i64 = 50;
++#endif
++ copyv = caml_copy_int64 (i64);
++ Store_field (vi, 4, copyv);
++ l = osinfo_device_driver_get_files (driver);
++ Store_field (vi, 5, glist_to_value_list (l));
++ g_list_free (l);
++
++ v = caml_alloc (2, 0);
++ Store_field (v, 0, vi);
++ Store_field (v, 1, rv);
++ rv = v;
++ }
++
++ CAMLreturn (rv);
++}
++
++value
++v2v_osinfo_os_get_all_devices (value osv)
++{
++ CAMLparam1 (osv);
++ CAMLlocal1 (retvalv);
++ g_autoptr (OsinfoDeviceList) dev_list = NULL;
++
++ dev_list = osinfo_os_get_all_devices (OsinfoOs_t_val (osv), NULL);
++ retvalv = v2v_osinfo_device_list_to_value_list (dev_list);
++ CAMLreturn (retvalv);
++}
+--
+2.19.1.3.g30247aa5d201
+
diff --git a/0029-convert-libosinfo-retrieve-the-device-list-for-OsinfoDeviceDriver.patch b/0029-convert-libosinfo-retrieve-the-device-list-for-OsinfoDeviceDriver.patch
new file mode 100644
index 0000000..2b2c259
--- /dev/null
+++ b/0029-convert-libosinfo-retrieve-the-device-list-for-OsinfoDeviceDriver.patch
@@ -0,0 +1,130 @@
+From a90a23fe48225775bef65829b83c14b3c940d093 Mon Sep 17 00:00:00 2001
+From: Laszlo Ersek
+Date: Tue, 1 Feb 2022 13:32:16 +0100
+Subject: [PATCH] convert/libosinfo: retrieve the device list for
+ OsinfoDeviceDriver
+
+The OsinfoDeviceDriver class supports the
+osinfo_device_driver_get_devices() method, we've just had no use for that
+thus far.
+
+Using the previously extracted v2v_osinfo_device_list_to_value_list()
+function, we can now relatively easily OCaml-ify the list of devices that
+a driver supports. (We'll use this functionality in a subsequent patch.)
+
+(Notably, osinfo_device_driver_get_devices() is marked "transfer none",
+unlike osinfo_os_get_all_devices(), which is marked "transfer full".)
+
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2043333
+Signed-off-by: Laszlo Ersek
+Acked-by: Richard W.M. Jones
+Message-Id: <20220201123219.9317-5-lersek@redhat.com>
+(cherry picked from commit 27816bd952b609b45e98670fe538b621f3d254e4)
+Signed-off-by: Laszlo Ersek
+---
+ convert/libosinfo-c.c | 6 ++++++
+ convert/libosinfo.ml | 19 ++++++++++---------
+ convert/libosinfo.mli | 19 ++++++++++---------
+ 3 files changed, 26 insertions(+), 18 deletions(-)
+
+diff --git a/convert/libosinfo-c.c b/convert/libosinfo-c.c
+index bc5816f6..93357fd9 100644
+--- a/convert/libosinfo-c.c
++++ b/convert/libosinfo-c.c
+@@ -292,6 +292,7 @@ v2v_osinfo_os_get_device_drivers (value osv)
+ gboolean b;
+ GList *l;
+ gint64 i64;
++ OsinfoDeviceList *dev_list;
+
+ driver = OSINFO_DEVICE_DRIVER(osinfo_list_get_nth (OSINFO_LIST(list), i));
+
+@@ -317,6 +318,11 @@ v2v_osinfo_os_get_device_drivers (value osv)
+ l = osinfo_device_driver_get_files (driver);
+ Store_field (vi, 5, glist_to_value_list (l));
+ g_list_free (l);
++ dev_list = osinfo_device_driver_get_devices (driver);
++ v = (dev_list == NULL) ?
++ Val_emptylist :
++ v2v_osinfo_device_list_to_value_list (dev_list);
++ Store_field (vi, 6, v);
+
+ v = caml_alloc (2, 0);
+ Store_field (v, 0, vi);
+diff --git a/convert/libosinfo.ml b/convert/libosinfo.ml
+index 78271be2..8ea0a279 100644
+--- a/convert/libosinfo.ml
++++ b/convert/libosinfo.ml
+@@ -23,15 +23,6 @@ open Common_gettext.Gettext
+ type osinfo_db_t
+ type osinfo_os_t
+
+-type osinfo_device_driver = {
+- architecture : string;
+- location : string;
+- pre_installable : bool;
+- signed : bool;
+- priority : int64;
+- files : string list;
+-}
+-
+ type osinfo_device = {
+ id : string;
+ vendor : string;
+@@ -44,6 +35,16 @@ type osinfo_device = {
+ subsystem : string;
+ }
+
++type osinfo_device_driver = {
++ architecture : string;
++ location : string;
++ pre_installable : bool;
++ signed : bool;
++ priority : int64;
++ files : string list;
++ devices : osinfo_device list;
++}
++
+ external osinfo_os_get_id : osinfo_os_t -> string = "v2v_osinfo_os_get_id"
+ external osinfo_os_get_device_drivers : osinfo_os_t -> osinfo_device_driver list = "v2v_osinfo_os_get_device_drivers"
+ external osinfo_os_get_devices : osinfo_os_t -> osinfo_device list = "v2v_osinfo_os_get_all_devices"
+diff --git a/convert/libosinfo.mli b/convert/libosinfo.mli
+index 1ece7b41..aa436370 100644
+--- a/convert/libosinfo.mli
++++ b/convert/libosinfo.mli
+@@ -20,15 +20,6 @@
+
+ type osinfo_os_t
+
+-type osinfo_device_driver = {
+- architecture : string;
+- location : string;
+- pre_installable : bool;
+- signed : bool;
+- priority : int64;
+- files : string list;
+-}
+-
+ type osinfo_device = {
+ id : string;
+ vendor : string;
+@@ -41,6 +32,16 @@ type osinfo_device = {
+ subsystem : string;
+ }
+
++type osinfo_device_driver = {
++ architecture : string;
++ location : string;
++ pre_installable : bool;
++ signed : bool;
++ priority : int64;
++ files : string list;
++ devices : osinfo_device list;
++}
++
+ class osinfo_os : osinfo_os_t -> object
+ method get_id : unit -> string
+ (** Return the ID. *)
+--
+2.19.1.3.g30247aa5d201
+
diff --git a/0030-convert-libosinfo_utils-debug-log-the-devices-supported-by-a-driver.patch b/0030-convert-libosinfo_utils-debug-log-the-devices-supported-by-a-driver.patch
new file mode 100644
index 0000000..993103a
--- /dev/null
+++ b/0030-convert-libosinfo_utils-debug-log-the-devices-supported-by-a-driver.patch
@@ -0,0 +1,96 @@
+From 61a0a01b1f6166bb03e04ef7dcb23f0559ea08fe Mon Sep 17 00:00:00 2001
+From: Laszlo Ersek
+Date: Tue, 1 Feb 2022 13:32:17 +0100
+Subject: [PATCH] convert/libosinfo_utils: debug-log the devices supported by a
+ driver
+
+While at it, put each file of a driver "pack" on a separate line, and
+print "Driver:", "Files:" and "Devices:" headers as well.
+
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2043333
+Signed-off-by: Laszlo Ersek
+Acked-by: Richard W.M. Jones
+Message-Id: <20220201123219.9317-6-lersek@redhat.com>
+(cherry picked from commit 32e3d19e9fe437e957591fa3b18ec981053e9196)
+Signed-off-by: Laszlo Ersek
+---
+ convert/libosinfo_utils.ml | 21 +++++++++++----------
+ convert/libosinfo_utils.mli | 6 +++---
+ convert/windows_virtio.ml | 2 +-
+ 3 files changed, 15 insertions(+), 14 deletions(-)
+
+diff --git a/convert/libosinfo_utils.ml b/convert/libosinfo_utils.ml
+index 77f22272..f0d70ffd 100644
+--- a/convert/libosinfo_utils.ml
++++ b/convert/libosinfo_utils.ml
+@@ -33,16 +33,6 @@ let get_os_by_short_id os =
+ debug "libosinfo: loaded OS: %s" (os#get_id ());
+ os
+
+-let string_of_osinfo_device_driver { Libosinfo.architecture; location;
+- pre_installable; signed; priority;
+- files } =
+- Printf.sprintf "%s: [%s, %s, %s, priority %Ld] %s"
+- location architecture
+- (if pre_installable then "pre-installable" else "not pre-installable")
+- (if signed then "signed" else "unsigned")
+- priority
+- (String.concat " " files)
+-
+ let string_of_osinfo_device_list dev_list =
+
+ (* Turn the fields of an "osinfo_device" record into a list. *)
+@@ -78,6 +68,17 @@ let string_of_osinfo_device_list dev_list =
+ String.concat "\n"
+ (List.map (fun dev -> columnate (listify dev) max_widths) dev_list)
+
++let string_of_osinfo_device_driver { Libosinfo.architecture; location;
++ pre_installable; signed; priority;
++ files; devices } =
++ Printf.sprintf "%s: [%s, %s, %s, priority %Ld]\nFiles:\n%s\nDevices:\n%s"
++ location architecture
++ (if pre_installable then "pre-installable" else "not pre-installable")
++ (if signed then "signed" else "unsigned")
++ priority
++ (String.concat "\n" files)
++ (string_of_osinfo_device_list devices)
++
+ type os_support = {
+ q35 : bool;
+ vio10 : bool;
+diff --git a/convert/libosinfo_utils.mli b/convert/libosinfo_utils.mli
+index ab77ec97..67be16c4 100644
+--- a/convert/libosinfo_utils.mli
++++ b/convert/libosinfo_utils.mli
+@@ -25,12 +25,12 @@ val get_os_by_short_id : string -> Libosinfo.osinfo_os
+ Raise [Not_found] in case there is no matching OS.
+ *)
+
+-val string_of_osinfo_device_driver : Libosinfo.osinfo_device_driver -> string
+-(** Convert a [osinfo_device_driver] to a printable string for debugging. *)
+-
+ val string_of_osinfo_device_list : Libosinfo.osinfo_device list -> string
+ (** Convert an [osinfo_device] list to a printable string for debugging. *)
+
++val string_of_osinfo_device_driver : Libosinfo.osinfo_device_driver -> string
++(** Convert a [osinfo_device_driver] to a printable string for debugging. *)
++
+ type os_support = {
+ q35 : bool;
+ vio10 : bool;
+diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
+index 1d8b0cb0..3e542631 100644
+--- a/convert/windows_virtio.ml
++++ b/convert/windows_virtio.ml
+@@ -412,7 +412,7 @@ and copy_from_libosinfo g inspect destdir =
+ let debug_drivers =
+ List.iter (
+ fun d ->
+- debug "\t%s" (Libosinfo_utils.string_of_osinfo_device_driver d)
++ debug "Driver: %s" (Libosinfo_utils.string_of_osinfo_device_driver d)
+ )
+ in
+ let { i_osinfo = osinfo; i_arch = arch } = inspect in
+--
+2.19.1.3.g30247aa5d201
+
diff --git a/0031-convert-libosinfo_utils-extract-best_driver-from-windows_virtio.ml.patch b/0031-convert-libosinfo_utils-extract-best_driver-from-windows_virtio.ml.patch
new file mode 100644
index 0000000..9019d35
--- /dev/null
+++ b/0031-convert-libosinfo_utils-extract-best_driver-from-windows_virtio.ml.patch
@@ -0,0 +1,154 @@
+From 9725e53665bc64858ce3dd17aa1e365a3bb6e9da Mon Sep 17 00:00:00 2001
+From: Laszlo Ersek
+Date: Tue, 1 Feb 2022 13:32:18 +0100
+Subject: [PATCH] convert/libosinfo_utils: extract "best_driver" from
+ "windows_virtio.ml"
+
+The "copy_from_libosinfo" function in "windows_virtio.ml" filters and
+sorts the driver list from libosinfo in order to find the best driver.
+Move this logic to a separate function (called "best_driver") in the
+Libosinfo_utils module.
+
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2043333
+Signed-off-by: Laszlo Ersek
+Acked-by: Richard W.M. Jones
+Message-Id: <20220201123219.9317-7-lersek@redhat.com>
+(cherry picked from commit 42c4bf8ea222d50cf562e9e49568a70fb2d05bca)
+Signed-off-by: Laszlo Ersek
+---
+ convert/libosinfo_utils.ml | 35 +++++++++++++++++++++++++++++
+ convert/libosinfo_utils.mli | 12 ++++++++++
+ convert/windows_virtio.ml | 44 +------------------------------------
+ 3 files changed, 48 insertions(+), 43 deletions(-)
+
+diff --git a/convert/libosinfo_utils.ml b/convert/libosinfo_utils.ml
+index f0d70ffd..8504e2b2 100644
+--- a/convert/libosinfo_utils.ml
++++ b/convert/libosinfo_utils.ml
+@@ -79,6 +79,41 @@ let string_of_osinfo_device_driver { Libosinfo.architecture; location;
+ (String.concat "\n" files)
+ (string_of_osinfo_device_list devices)
+
++let best_driver drivers arch =
++ let debug_drivers =
++ List.iter (fun d -> debug "Driver: %s" (string_of_osinfo_device_driver d))
++ (* The architecture that "inspect.i_arch" from libguestfs
++ * ("daemon/filearch.ml") calls "i386", the osinfo-db schema
++ * ("data/schema/osinfo.rng.in") calls "i686".
++ *)
++ and arch = if arch = "i386" then "i686" else arch in
++ debug "libosinfo drivers before filtering:";
++ debug_drivers drivers;
++ let drivers =
++ List.filter (
++ fun { Libosinfo.architecture; location; pre_installable } ->
++ if architecture <> arch || not pre_installable then
++ false
++ else
++ try
++ (match Xml.parse_uri location with
++ | { Xml.uri_scheme = Some scheme;
++ Xml.uri_path = Some _ } when scheme = "file" -> true
++ | _ -> false
++ )
++ with Invalid_argument _ -> false
++ ) drivers in
++ debug "libosinfo drivers after filtering:";
++ debug_drivers drivers;
++ let drivers =
++ List.sort (
++ fun { Libosinfo.priority = prioA } { Libosinfo.priority = prioB } ->
++ compare prioB prioA
++ ) drivers in
++ if drivers = [] then
++ raise Not_found;
++ List.hd drivers
++
+ type os_support = {
+ q35 : bool;
+ vio10 : bool;
+diff --git a/convert/libosinfo_utils.mli b/convert/libosinfo_utils.mli
+index 67be16c4..14991bc2 100644
+--- a/convert/libosinfo_utils.mli
++++ b/convert/libosinfo_utils.mli
+@@ -31,6 +31,18 @@ val string_of_osinfo_device_list : Libosinfo.osinfo_device list -> string
+ val string_of_osinfo_device_driver : Libosinfo.osinfo_device_driver -> string
+ (** Convert a [osinfo_device_driver] to a printable string for debugging. *)
+
++val best_driver : Libosinfo.osinfo_device_driver list ->
++ string ->
++ Libosinfo.osinfo_device_driver
++(** [best_driver drivers arch] picks the best driver from [drivers] as follows:
++ - filters out drivers that:
++ - target a different architecture,
++ - are not pre-installable,
++ - have an invalid or non-local URL;
++ - sorts the remaining drivers by priority, like libosinfo does;
++ - picks the top driver of the sorted list.
++ Raises Not_found if no driver in [drivers] survives filtering. *)
++
+ type os_support = {
+ q35 : bool;
+ vio10 : bool;
+diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
+index 3e542631..301f7544 100644
+--- a/convert/windows_virtio.ml
++++ b/convert/windows_virtio.ml
+@@ -409,53 +409,11 @@ and virtio_iso_path_matches_qemu_ga path inspect =
+ * Returns list of copied files.
+ *)
+ and copy_from_libosinfo g inspect destdir =
+- let debug_drivers =
+- List.iter (
+- fun d ->
+- debug "Driver: %s" (Libosinfo_utils.string_of_osinfo_device_driver d)
+- )
+- in
+ let { i_osinfo = osinfo; i_arch = arch } = inspect in
+- (* The architecture that "inspect.i_arch" from libguestfs
+- * ("daemon/filearch.ml") calls "i386", the osinfo-db schema
+- * ("data/schema/osinfo.rng.in") calls "i686".
+- *)
+- let arch = if arch = "i386" then "i686" else arch in
+ try
+ let os = Libosinfo_utils.get_os_by_short_id osinfo in
+ let drivers = os#get_device_drivers () in
+- debug "libosinfo drivers before filtering:"; debug_drivers drivers;
+- (*
+- * Filter out drivers that we cannot use:
+- * - for a different architecture
+- * - non-pre-installable ones
+- * - location is an invalid URL, or a non-local one
+- *)
+- let drivers =
+- List.filter (
+- fun { Libosinfo.architecture; location; pre_installable } ->
+- if architecture <> arch || not pre_installable then
+- false
+- else
+- try
+- (match Xml.parse_uri location with
+- | { Xml.uri_scheme = Some scheme;
+- Xml.uri_path = Some _ } when scheme = "file" -> true
+- | _ -> false
+- )
+- with Invalid_argument _ -> false
+- ) drivers in
+- debug "libosinfo drivers after filtering:"; debug_drivers drivers;
+- (* Sort the drivers by priority, like libosinfo does. *)
+- let drivers =
+- List.sort (
+- fun { Libosinfo.priority = prioA } { Libosinfo.priority = prioB } ->
+- compare prioB prioA
+- ) drivers in
+- (* Any driver available? *)
+- if drivers = [] then
+- raise Not_found;
+- let driver = List.hd drivers in
++ let driver = Libosinfo_utils.best_driver drivers arch in
+ let uri = Xml.parse_uri driver.Libosinfo.location in
+ let basedir =
+ match uri.Xml.uri_path with
+--
+2.19.1.3.g30247aa5d201
+
diff --git a/0032-convert-convert_windows-consult-best-driver-s-dev-list-for-virtio-1.0.patch b/0032-convert-convert_windows-consult-best-driver-s-dev-list-for-virtio-1.0.patch
new file mode 100644
index 0000000..f3f0868
--- /dev/null
+++ b/0032-convert-convert_windows-consult-best-driver-s-dev-list-for-virtio-1.0.patch
@@ -0,0 +1,152 @@
+From 728dab8031b59bb3fd5f8e53786b05df51d35311 Mon Sep 17 00:00:00 2001
+From: Laszlo Ersek
+Date: Tue, 1 Feb 2022 13:32:19 +0100
+Subject: [PATCH] convert/convert_windows: consult "best driver"'s dev list for
+ virtio-1.0
+
+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 element
+port/autoport", 2022-01-20)). The reason is that those tests all set the
+VIRTIO_WIN environment variable, in which case we simply assume
+"virtio_1_0 = true" on the fallback ("Not_found" exception) branch.
+
+Fixes: f0cea012d0183edf6f7b769c28d5038593f3fe6a
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2043333
+Signed-off-by: Laszlo Ersek
+Message-Id: <20220201123219.9317-8-lersek@redhat.com>
+Acked-by: Richard W.M. Jones
+(cherry picked from commit cacedec64072609c5203437a378aea2ab9a0e659)
+Signed-off-by: Laszlo Ersek
+---
+ convert/convert_windows.ml | 26 +++++++++++++++++++++++---
+ convert/windows_virtio.mli | 6 +++++-
+ tests/test-v2v-cdrom.expected | 2 +-
+ tests/test-v2v-floppy.expected | 2 +-
+ tests/test-v2v-i-ova.xml | 8 ++++----
+ 5 files changed, 34 insertions(+), 10 deletions(-)
+
+diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml
+index 1c2d17f2..7bdcaf52 100644
+--- a/convert/convert_windows.ml
++++ b/convert/convert_windows.ml
+@@ -242,12 +242,32 @@ let convert (g : G.guestfs) _ inspect _ static_ips =
+ match inspect.i_arch with
+ | ("i386"|"x86_64") ->
+ (try
++ (* Fall back to the decision that's based on the year that the OS
++ * was released in under three circumstances:
++ * - the user specified the location of the Windows virtio drivers
++ * through an environment variable, or
++ * - "Libosinfo_utils.get_os_by_short_id" fails to look up the OS,
++ * or
++ * - "Libosinfo_utils.best_driver" cannot find any matching driver.
++ * In each of these cases, a "Not_found" exception is raised. This
++ * behavior exactly mirrors that of "Windows_virtio.copy_drivers".
++ *)
++ if Windows_virtio.virtio_win_from_env then
++ raise Not_found;
+ 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 =
++ (Libosinfo_utils.best_driver drivers inspect.i_arch).devices 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 ->
+diff --git a/convert/windows_virtio.mli b/convert/windows_virtio.mli
+index 53603d24..a92cc01d 100644
+--- a/convert/windows_virtio.mli
++++ b/convert/windows_virtio.mli
+@@ -16,7 +16,11 @@
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+-(** Functions for installing Windows virtio drivers. *)
++(** Values and functions for installing Windows virtio drivers. *)
++
++val virtio_win_from_env : bool
++(** [virtio_win_from_env] is true iff at least one of the VIRTIO_WIN and
++ VIRTIO_WIN_DIR variables is present in the environment. *)
+
+ val install_drivers
+ : Registry.t -> Types.inspect ->
+diff --git a/tests/test-v2v-cdrom.expected b/tests/test-v2v-cdrom.expected
+index b9504929..17bd152d 100644
+--- a/tests/test-v2v-cdrom.expected
++++ b/tests/test-v2v-cdrom.expected
+@@ -1,4 +1,4 @@
+-
++
+
+
+
+diff --git a/tests/test-v2v-floppy.expected b/tests/test-v2v-floppy.expected
+index f4b67954..a718c21f 100644
+--- a/tests/test-v2v-floppy.expected
++++ b/tests/test-v2v-floppy.expected
+@@ -1,4 +1,4 @@
+-
++
+
+
+
+diff --git a/tests/test-v2v-i-ova.xml b/tests/test-v2v-i-ova.xml
+index 1915dd40..6b8cda62 100644
+--- a/tests/test-v2v-i-ova.xml
++++ b/tests/test-v2v-i-ova.xml
+@@ -21,7 +21,7 @@
+ restart
+ restart
+
+-
++
+
+
+
+@@ -36,16 +36,16 @@
+
+
+
+-
++
+
+
+
+-
++
+ /dev/urandom
+
+-
++
+
+
+
+--
+2.19.1.3.g30247aa5d201
+
diff --git a/virt-v2v.spec b/virt-v2v.spec
index 330e5c5..f3b506b 100644
--- a/virt-v2v.spec
+++ b/virt-v2v.spec
@@ -15,7 +15,7 @@
Name: virt-v2v
Epoch: 1
Version: 1.45.97
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPLv2+
@@ -52,29 +52,37 @@ ExclusiveArch: x86_64
%if 0%{?rhel}
# Patches.
Patch0001: 0001-output-o-json-Allow-oo-output-options-to-work.patch
-Patch0002: 0002-input-xen-Fix-assertion-error-when-importing-from-re.patch
-Patch0003: 0003-Restore-message-about-setting-up-the-input-and-outpu.patch
+Patch0002: 0002-input-xen-Fix-assertion-error-when-importing-from-remote-block-device.patch
+Patch0003: 0003-Restore-message-about-setting-up-the-input-and-output.patch
Patch0004: 0004-output-o-libvirt-Fix-graphics-element-port-autoport.patch
-Patch0005: 0005-output-o-libvirt-qemu-Use-correct-device-name-for-vs.patch
-Patch0006: 0006-tests-Drop-some-obsolete-Fedora-versions-start-testi.patch
+Patch0005: 0005-output-o-libvirt-qemu-Use-correct-device-name-for-vsock.patch
+Patch0006: 0006-tests-Drop-some-obsolete-Fedora-versions-start-testing-F35.patch
Patch0007: 0007-tests-Drop-test-of-centos-6.patch
-Patch0008: 0008-tests-Drop-ancient-Ubuntu-versions-add-Ubuntu-20.04-.patch
-Patch0009: 0009-tests-Drop-old-and-add-newer-RHEL-versions-to-the-te.patch
-Patch0010: 0010-tests-Don-t-use-virt-builder-update-when-testing-Win.patch
-Patch0011: 0011-tests-test-v2v-trim.sh-Use-of-qcow2-to-preserve-outp.patch
-Patch0012: 0012-lib-qemuNBD.ml-Use-qemu-nbd-shared-0-flag-to-allow-m.patch
+Patch0008: 0008-tests-Drop-ancient-Ubuntu-versions-add-Ubuntu-20.04-LTS.patch
+Patch0009: 0009-tests-Drop-old-and-add-newer-RHEL-versions-to-the-tests.patch
+Patch0010: 0010-tests-Don-t-use-virt-builder-update-when-testing-Windows-conversions.patch
+Patch0011: 0011-tests-test-v2v-trim.sh-Use-of-qcow2-to-preserve-output-format.patch
+Patch0012: 0012-lib-qemuNBD.ml-Use-qemu-nbd-shared-0-flag-to-allow-multiple-connections.patch
Patch0013: 0013-lib-qemuNBD.ml-Use-qemu-nbd-discard-unmap.patch
-Patch0014: 0014-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
-Patch0015: 0015-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
-Patch0016: 0016-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
+Patch0014: 0014-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-RHBZ-1147313.patch
+Patch0015: 0015-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-RHBZ-1147313.patch
+Patch0016: 0016-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL-qemu-RHBZ-1176493.patch
Patch0017: 0017-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0018: 0018-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0019: 0019-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
-Patch0020: 0020-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
+Patch0020: 0020-RHEL-point-to-KB-for-supported-v2v-hypervisors-guests.patch
Patch0021: 0021-RHEL-Disable-o-glance.patch
Patch0022: 0022-RHEL-Remove-the-in-place-option.patch
-Patch0023: 0023-input-libvirt-Share-a-single-connection-to-the-sourc.patch
-Patch0024: 0024-v2v-Send-nbdinfo-debug-information-to-stderr-not-std.patch
+Patch0023: 0023-input-libvirt-Share-a-single-connection-to-the-source-NBD-server.patch
+Patch0024: 0024-v2v-Send-nbdinfo-debug-information-to-stderr-not-stdout.patch
+Patch0025: 0025-input-Require-ip-password-for-vCenter-over-HTTPS.patch
+Patch0026: 0026-convert-windows_virtio-fix-copy_from_libosinfo-VIRTIO_WIN-priority.patch
+Patch0027: 0027-convert-windows_virtio-map-32-bit-arch-name-from-libguestfs-to-osinfo.patch
+Patch0028: 0028-convert-libosinfo-factor-out-v2v_osinfo_device_list_to_value_list.patch
+Patch0029: 0029-convert-libosinfo-retrieve-the-device-list-for-OsinfoDeviceDriver.patch
+Patch0030: 0030-convert-libosinfo_utils-debug-log-the-devices-supported-by-a-driver.patch
+Patch0031: 0031-convert-libosinfo_utils-extract-best_driver-from-windows_virtio.ml.patch
+Patch0032: 0032-convert-convert_windows-consult-best-driver-s-dev-list-for-virtio-1.0.patch
%endif
%if 0%{patches_touch_autotools}
@@ -316,6 +324,16 @@ popd
%changelog
+* Wed Feb 2 2022 Laszlo Ersek - 1:1.45.97-4
+- v2v import from vCenter fails when using interactive password because
+ cookie-script tries to be interactive
+ (pick commit 8abc07a8589a)
+ resolves: rhbz#1960087
+- model='virtio-transitional' is wrongly added when converting windows
+ guest to local by rhel9 v2v
+ (pick commit range commit range 8abc07a8589a..cacedec64072)
+ resolves: rhbz#2043333
+
* Wed Jan 26 2022 Richard W.M. Jones - 1:1.45.97-3
- Rebase to upstream 1.45.97.
resolves: rhbz#2011713