virt-v2v/0026-convert-windows_virtio...

132 lines
5.1 KiB
Diff

From 887d374cc3a910db9794e12f2b13bd6c2a43d036 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
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 <lersek@redhat.com>
Message-Id: <20220201123219.9317-2-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit be39049582fbd167c92062a4e63d10f13474aea0)
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
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<VIRTIO_WIN>
-This is where virtio drivers for Windows are searched for. It can be
-a directory I<or> point to F<virtio-win.iso> (CD ROM image containing
-drivers).
+This is an override for where virtio drivers for Windows are searched
+for. It can be a directory I<or> point to F<virtio-win.iso> (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<osinfo-db>
+
+Load osinfo data from the default paths, and attempt to find drivers via
+libosinfo lookup. This is the preferred method.
+
=item F</usr/share/virtio-win/virtio-win.iso>
The ISO containing virtio drivers for Windows.
@@ -1530,7 +1540,7 @@ The ISO containing virtio drivers for Windows.
=item F</usr/share/virtio-win>
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