virt-v2v/0027-convert-windows_virtio...

61 lines
2.3 KiB
Diff

From 5f32e9ac9f501ce9bcae3ddcc8fa8ea8a1e873e0 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
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 <lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20220201123219.9317-3-lersek@redhat.com>
(cherry picked from commit 70d77100eee2c341359bcd76962478419d1f0548)
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
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