On 01/28/22 18:02, Richard W.M. Jones wrote:
On Fri, Jan 28, 2022 at 05:12:13PM +0100, Laszlo Ersek wrote:
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> --- convert/windows_virtio.ml | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml index d21ee6814458..1faba8a874c0 100644 --- a/convert/windows_virtio.ml +++ b/convert/windows_virtio.ml @@ -412,12 +412,17 @@ and copy_from_libosinfo g inspect destdir = List.iter ( fun d -> debug "\t%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
Sort of the reverse of Std_utils.normalize_arch,
yeah :)
but I understand why it's being done here. (I wonder if we want to call it "libosinfo_arch" to avoid confusion?) Anyway, ACK
The "X_of_y" scheme looks common, so "osinfo_arch_of_<whatever>_arch" would be an option. However, I tried to see if this mapping was needed anywhere else, and it looked too much "one-off" for turning into an API. This bit of code is going to be moved around in a later patch, but it will remain internal to its outer function, so I'd like to keep it this ad-hoc for now. Thanks! Laszlo
Rich.
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: -- 2.19.1.3.g30247aa5d201
_______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs