If the virtio-win ISO contains drivers for Windows 11, Windows 2019 or
Windows 2022, and the guest matches these, then copy in the right
drivers. For this to work you will need libguestfs >= 1.49.8 which
allows osinfo to be used to detect Windows versions >= 10.
Side note: virtio-win uses a mix of different path element styles.
In the exploded tree of drivers installed by the RPM:
/usr/share/virtio-win/drivers/amd64$ ls -l
total 0
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win10
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win11
drwxr-xr-x. 2 root root 236 Nov 30 13:28 Win2008R2
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win2012
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win2012R2
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win2016
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win2019
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win2022
drwxr-xr-x. 2 root root 236 Nov 30 13:28 Win7
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win8
drwxr-xr-x. 2 root root 174 Nov 30 13:28 Win8.1
Inside the ISO:
<fs> ll /viostor/
total 28
dr-xr-xr-x 1 root root 2048 Jun 14 2020 2k12
dr-xr-xr-x 1 root root 2048 Jun 14 2020 2k12R2
dr-xr-xr-x 1 root root 2048 Jun 14 2020 2k16
dr-xr-xr-x 1 root root 2048 Jun 14 2020 2k19
dr-xr-xr-x 1 root root 2048 Dec 11 2021 2k22
dr-xr-xr-x 1 root root 2048 Jun 14 2020 2k8R2
dr-xr-xr-x 1 root root 2048 Jun 14 2020 w10
dr-xr-xr-x 1 root root 2048 Dec 11 2021 w11
dr-xr-xr-x 1 root root 2048 Jun 14 2020 w7
dr-xr-xr-x 1 root root 2048 Jun 14 2020 w8
dr-xr-xr-x 1 root root 2048 Jun 14 2020 w8.1
So I have matched both path elements.
Reported-by: Tingting Zheng
Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=2149811
---
convert/windows_virtio.ml | 45 +++++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 18 deletions(-)
diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
index a27cd6a543..3156694d11 100644
--- a/convert/windows_virtio.ml
+++ b/convert/windows_virtio.ml
@@ -50,9 +50,9 @@ let rec install_drivers ((g, _) as reg) inspect =
g#mkdir_p driverdir;
if not (copy_drivers g inspect driverdir) then (
- 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.")
+ warning (f_"there are no virtio drivers available for this version of Windows
(%d.%d %s %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;
+ inspect.i_product_variant inspect.i_osinfo virtio_win;
(IDE, RTL8139, false, false, false, false)
)
else (
@@ -279,7 +279,8 @@ and copy_from_virtio_win g inspect srcdir destdir filter missing =
*)
and virtio_iso_path_matches_guest_os path inspect =
let { i_major_version = os_major; i_minor_version = os_minor;
- i_arch = arch; i_product_variant = os_variant } = inspect in
+ i_arch = arch; i_product_variant = os_variant;
+ i_osinfo = osinfo } = inspect in
try
(* Lowercased path, since the ISO may contain upper or lowercase path
* elements.
@@ -300,37 +301,45 @@ and virtio_iso_path_matches_guest_os path inspect =
let is_client os_variant = os_variant = "Client"
and not_client os_variant = os_variant <> "Client"
- and any_variant os_variant = true in
- let p_os_major, p_os_minor, match_os_variant =
+ and any_variant os_variant = true
+ and any_osinfo osinfo = true in
+ let p_os_major, p_os_minor, match_os_variant, match_osinfo =
if pathelem "xp" || pathelem "winxp" then
- (5, 1, any_variant)
+ (5, 1, any_variant, any_osinfo)
else if pathelem "2k3" || pathelem "win2003" then
- (5, 2, any_variant)
+ (5, 2, any_variant, any_osinfo)
else if pathelem "vista" then
- (6, 0, is_client)
+ (6, 0, is_client, any_osinfo)
else if pathelem "2k8" || pathelem "win2008" then
- (6, 0, not_client)
+ (6, 0, not_client, any_osinfo)
else if pathelem "w7" || pathelem "win7" then
- (6, 1, is_client)
+ (6, 1, is_client, any_osinfo)
else if pathelem "2k8r2" || pathelem "win2008r2" then
- (6, 1, not_client)
+ (6, 1, not_client, any_osinfo)
else if pathelem "w8" || pathelem "win8" then
- (6, 2, is_client)
+ (6, 2, is_client, any_osinfo)
else if pathelem "2k12" || pathelem "win2012" then
- (6, 2, not_client)
+ (6, 2, not_client, any_osinfo)
else if pathelem "w8.1" || pathelem "win8.1" then
- (6, 3, is_client)
+ (6, 3, is_client, any_osinfo)
else if pathelem "2k12r2" || pathelem "win2012r2" then
- (6, 3, not_client)
+ (6, 3, not_client, any_osinfo)
else if pathelem "w10" || pathelem "win10" then
- (10, 0, is_client)
+ (10, 0, is_client, ((=) "win10"))
+ else if pathelem "w11" || pathelem "win11" then
+ (10, 0, is_client, ((=) "win11"))
else if pathelem "2k16" || pathelem "win2016" then
- (10, 0, not_client)
+ (10, 0, not_client, ((=) "win2k16"))
+ else if pathelem "2k19" || pathelem "win2019" then
+ (10, 0, not_client, ((=) "win2k19"))
+ else if pathelem "2k22" || pathelem "win2022" then
+ (10, 0, not_client, ((=) "win2k22"))
else
raise Not_found in
arch = p_arch && os_major = p_os_major && os_minor = p_os_minor
&&
- match_os_variant os_variant
+ match_os_variant os_variant &&
+ match_osinfo osinfo
with Not_found -> false
--
2.37.3