]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Let qemuMonitorJSONGetCPUProperties also return disabled features
authorJiri Denemark <jdenemar@redhat.com>
Thu, 4 Sep 2025 13:16:01 +0000 (15:16 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 8 Sep 2025 13:32:48 +0000 (15:32 +0200)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_monitor_json.c

index f42bfb3d582339ef8f7a70f9f3785d92f61316e2..c139edaf158a6424797c2f0dab4295ae199f3e8b 100644 (file)
@@ -6641,7 +6641,8 @@ static int
 qemuMonitorJSONGetCPUProperties(qemuMonitor *mon,
                                 bool qomListGet,
                                 const char *cpuQOMPath,
-                                char ***props)
+                                char ***propsEnabled,
+                                char ***propsDisabled)
 {
     g_autoptr(virJSONValue) cmd = NULL;
     g_autoptr(virJSONValue) reply = NULL;
@@ -6652,7 +6653,8 @@ qemuMonitorJSONGetCPUProperties(qemuMonitor *mon,
         .cpuQOMPath = cpuQOMPath,
     };
 
-    *props = NULL;
+    *propsEnabled = NULL;
+    *propsDisabled = NULL;
 
     if (qomListGet) {
         g_autoptr(virJSONValue) paths = virJSONValueNewArray();
@@ -6697,8 +6699,16 @@ qemuMonitorJSONGetCPUProperties(qemuMonitor *mon,
         }
     }
 
-    return qemuMonitorJSONParsePropsList(array, qemuMonitorJSONCPUPropsFilter,
-                                         &filterData, props);
+    if (qemuMonitorJSONParsePropsList(array, qemuMonitorJSONCPUPropsFilter,
+                                      &filterData, propsEnabled) < 0)
+        return -1;
+
+    if (qemuMonitorJSONGetStringListProperty(mon, cpuQOMPath,
+                                             "unavailable-features",
+                                             propsDisabled) < 0)
+        return -1;
+
+    return 0;
 }
 
 
@@ -6759,17 +6769,11 @@ qemuMonitorJSONGetGuestCPU(qemuMonitor *mon,
         return -1;
 
     if (qemuMonitorJSONGetCPUProperties(mon, qomListGet, cpuQOMPath,
-                                        &propsEnabled) < 0)
-        return -1;
-
-    if (qemuMonitorJSONCPUDataAddFeatures(cpuEnabled, propsEnabled, translate) < 0)
-        return -1;
-
-    if (qemuMonitorJSONGetStringListProperty(mon, cpuQOMPath,
-                                             "unavailable-features", &propsDisabled) < 0)
+                                        &propsEnabled, &propsDisabled) < 0)
         return -1;
 
-    if (qemuMonitorJSONCPUDataAddFeatures(cpuDisabled, propsDisabled, translate) < 0)
+    if (qemuMonitorJSONCPUDataAddFeatures(cpuEnabled, propsEnabled, translate) < 0 ||
+        qemuMonitorJSONCPUDataAddFeatures(cpuDisabled, propsDisabled, translate) < 0)
         return -1;
 
     *enabled = g_steal_pointer(&cpuEnabled);