From: Jiri Denemark Date: Thu, 4 Sep 2025 13:16:01 +0000 (+0200) Subject: qemu: Let qemuMonitorJSONGetCPUProperties also return disabled features X-Git-Tag: v11.8.0-rc1~87 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e18bc302361ac9a7cf8c5cca43c35ec1a726679e;p=thirdparty%2Flibvirt.git qemu: Let qemuMonitorJSONGetCPUProperties also return disabled features Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index f42bfb3d58..c139edaf15 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(); @@ -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);