virt-v2v/0039-convert-windows-Copy-d...

78 lines
3.1 KiB
Diff

From 94217004b0ea3292686397e29434a4cff1134e5e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 1 Dec 2022 12:29:43 +0000
Subject: [PATCH] convert: windows: Copy drivers for Windows 11, Windows 2019 &
Windows 2022
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
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit 7b49177e2b0c769b947ed19fa029c80282a2b93b)
---
convert/windows_virtio.ml | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
index 0f71fa94..76c94790 100644
--- a/convert/windows_virtio.ml
+++ b/convert/windows_virtio.ml
@@ -326,9 +326,15 @@ and virtio_iso_path_matches_guest_os path inspect =
else if pathelem "2k12r2" || pathelem "win2012r2" then
(6, 3, not_client, any_osinfo)
else if pathelem "w10" || pathelem "win10" then
- (10, 0, is_client, any_osinfo)
+ (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, any_osinfo)
+ (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