[libvirt PATCH] qemu: do not compare missing cpu data

Ján Tomko jtomko at redhat.com
Wed Dec 8 12:24:04 UTC 2021


For x86, we invalidate qemu caps cache if the host CPUID changed.
However other cpu drivers do not have the 'getHostData' function
implemented.

Skip the comparison if we do not have host CPUData available,
since virCPUDataIsIdentical always returns an error in that case.

https://bugzilla.redhat.com/show_bug.cgi?id=2030119

Fixes: 3bc6f46d305ed82f7314ffc4c2a66847b831a6bd
Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/qemu/qemu_capabilities.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 0e6e73774a..51828ead53 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4943,7 +4943,8 @@ virQEMUCapsIsValid(void *data,
             return false;
         }
 
-        if (virCPUDataIsIdentical(priv->cpuData, qemuCaps->cpuData) !=
+        if (priv->cpuData &&
+            virCPUDataIsIdentical(priv->cpuData, qemuCaps->cpuData) !=
             VIR_CPU_COMPARE_IDENTICAL) {
             VIR_DEBUG("Outdated capabilities for '%s': host cpuid changed",
                       qemuCaps->binary);
-- 
2.31.1




More information about the libvir-list mailing list