From d9d48602daa653635b061ef9d16d9bc5140626ce Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Tue, 26 Mar 2019 17:10:38 +0100
Subject: [PATCH] v2v: try to pick the right arch for qemu-ga pkgs
Right now the code copies, and then tries to install, all the files
found for the directory of a distro. This does not take into account
differences in the architectures of the packages available, so a x86_64
package must be installed only on x86_64 guests.
As solution, filter the packages using the typical suffix used by
packages (so architecture + file extension), to pick only packages
compatible with the current guest.
(cherry picked from commit 78f08a15faca826d4f3320834eb06309ccf3ec94)
---
v2v/windows_virtio.ml | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml
index 92bf3ec60..a499fcf8a 100644
--- a/v2v/windows_virtio.ml
+++ b/v2v/windows_virtio.ml
@@ -203,10 +203,19 @@ and install_linux_tools g inspect =
| Some os ->
let src_path = "linux" // os in
let dst_path = "/var/tmp" in
+ let pkg_arch = Linux.architecture_string inspect in
+ let pkg_ext = Linux.binary_package_extension inspect in
+ let package_suffixes = [
+ sprintf ".%s.%s" pkg_arch pkg_ext;
+ sprintf "_%s.%s" pkg_arch pkg_ext;
+ ] in
+ let package_filter path _ =
+ List.exists (String.is_suffix path) package_suffixes
+ in
debug "locating packages in %s" src_path;
let packages =
copy_from_virtio_win g inspect src_path dst_path
- (fun _ _ -> true)
+ package_filter
(fun () ->
warning (f_"guest tools directory ā%sā is missing from the virtio-win directory or ISO.\n\nGuest tools are only provided in the RHV Guest Tools ISO, so this can happen if you are using the version of virtio-win which contains just the virtio drivers. In this case only virtio drivers can be installed in the guest, and installation of Guest Tools will be skipped.")
src_path) in
--
2.21.0