Blame SOURCES/0008-v2v-try-to-pick-the-right-arch-for-qemu-ga-pkgs.patch

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