[PATCH 13/14] qemu: Let qemuMonitorJSONGetCPUProperties also return disabled features

Jiri Denemark via Devel posted 14 patches 3 days, 9 hours ago
[PATCH 13/14] qemu: Let qemuMonitorJSONGetCPUProperties also return disabled features
Posted by Jiri Denemark via Devel 3 days, 9 hours ago
From: Jiri Denemark <jdenemar@redhat.com>

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_monitor_json.c | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 6b736aefd0..f8be1a79b1 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -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();
@@ -6698,8 +6700,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;
 }
 
 
@@ -6760,17 +6770,11 @@ qemuMonitorJSONGetGuestCPU(qemuMonitor *mon,
         return -1;
 
     if (qemuMonitorJSONGetCPUProperties(mon, qomListGet, cpuQOMPath,
-                                        &propsEnabled) < 0)
+                                        &propsEnabled, &propsDisabled) < 0)
         return -1;
 
-    if (qemuMonitorJSONCPUDataAddFeatures(cpuEnabled, propsEnabled, translate) < 0)
-        return -1;
-
-    if (qemuMonitorJSONGetStringListProperty(mon, cpuQOMPath,
-                                             "unavailable-features", &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);
-- 
2.51.0