99cbc7
From 1172018ff6df4618a02fd05a46d33dbdb06131bf Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <1172018ff6df4618a02fd05a46d33dbdb06131bf@dist-git>
99cbc7
From: Andrea Bolognani <abologna@redhat.com>
99cbc7
Date: Fri, 5 Apr 2019 10:57:41 +0200
99cbc7
Subject: [PATCH] qemu: Avoid probing non-native binaries all the time
99cbc7
99cbc7
A side effect of recent changes is that we would always try
99cbc7
to regenerate the capabilities cache for non-native QEMU
99cbc7
binaries based on /dev/kvm availability, which is of course
99cbc7
complete nonsense. Make sure that doesn't happen.
99cbc7
99cbc7
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
99cbc7
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
99cbc7
(cherry picked from commit 55e5eb94788be06dd366de4987523bbc731672db)
99cbc7
99cbc7
https://bugzilla.redhat.com/show_bug.cgi?id=1628469
99cbc7
99cbc7
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
99cbc7
Message-Id: <20190405085744.8179-5-abologna@redhat.com>
99cbc7
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
99cbc7
---
99cbc7
 src/qemu/qemu_capabilities.c | 8 ++++++++
99cbc7
 1 file changed, 8 insertions(+)
99cbc7
99cbc7
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
99cbc7
index c31c991a6f..ca044564e5 100644
99cbc7
--- a/src/qemu/qemu_capabilities.c
99cbc7
+++ b/src/qemu/qemu_capabilities.c
99cbc7
@@ -3906,6 +3906,14 @@ virQEMUCapsIsValid(void *data,
99cbc7
         return false;
99cbc7
     }
99cbc7
 
99cbc7
+    if (!virQEMUCapsGuestIsNative(priv->hostArch, qemuCaps->arch)) {
99cbc7
+        VIR_DEBUG("Guest arch (%s) is not native to host arch (%s), "
99cbc7
+                  "skipping KVM-related checks",
99cbc7
+                  virArchToString(qemuCaps->arch),
99cbc7
+                  virArchToString(priv->hostArch));
99cbc7
+        return true;
99cbc7
+    }
99cbc7
+
99cbc7
     kvmUsable = virFileAccessibleAs("/dev/kvm", R_OK | W_OK,
99cbc7
                                     priv->runUid, priv->runGid) == 0;
99cbc7
 
99cbc7
-- 
99cbc7
2.21.0
99cbc7