[libvirt PATCH] qemu: fix recording of CPU deprecations

Daniel P. Berrangé berrange at redhat.com
Thu Mar 17 17:53:22 UTC 2022


The code parsing thue query-cpu-definitions response will short-circuit
the for loop in the case where usable=yes, resulting in us failing to
parse the CPU deprecation flag.

IOW, we only reported deprecations in domain capabilities for CPU models
which were not runnable on the host.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 src/qemu/qemu_monitor_json.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 27c5e1c992..d5622bd6d9 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5309,10 +5309,9 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitor *mon,
             if (g_strv_length(cpu->blockers) == 0) {
                 cpu->usable = VIR_DOMCAPS_CPU_USABLE_YES;
                 g_clear_pointer(&cpu->blockers, g_strfreev);
-                continue;
+            } else {
+                cpu->usable = VIR_DOMCAPS_CPU_USABLE_NO;
             }
-
-            cpu->usable = VIR_DOMCAPS_CPU_USABLE_NO;
         }
 
         if (virJSONValueObjectHasKey(child, "deprecated") &&
-- 
2.34.1



More information about the libvir-list mailing list