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