[libvirt] [PATCH 6/5] qemu: Avoid probing non-native binaries all the time

Andrea Bolognani abologna at redhat.com
Mon Sep 17 11:22:59 UTC 2018


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 at redhat.com>
---
A better spot would be between 3/5 and 4/5, but the order
doesn't make any difference functionality-wise so 6/5 it is
for the sake of mailing list archives :)

 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 3d99c95a6a..04c2adcfb5 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3916,6 +3916,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.17.1




More information about the libvir-list mailing list