libvirt/libvirt-qemuMonitorJSONGetCPUModelExpansion-refactor-parsing-functions.patch
Jiri Denemark 2bb6e6a9bc libvirt-10.10.0-12.el9
- qemuMonitorJSONGetCPUModelExpansion: refactor parsing functions (RHEL-89415)
- qemu: parse deprecated-props from query-cpu-model-expansion response (RHEL-89415)
- qemu_capabilities: query deprecated features for host-model (RHEL-89415)
- libvirt-domain: introduce VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES (RHEL-89415)
- qemu_capabilities: filter deprecated features if requested (RHEL-89415)
- virsh: add --disable-deprecated-features flag to domcapabilities (RHEL-89415)
- conf: add deprecated_features attribute (RHEL-89415)
- redhat: Restore hunks in tests/qemucapabilitiesdata/caps_10.0.0_s390x.* (RHEL-89415)

Resolves: RHEL-89415
2025-06-04 14:17:21 +02:00

101 lines
4.1 KiB
Diff

From 19e552685d72cf3c8064c56ee9bce5859303da25 Mon Sep 17 00:00:00 2001
Message-ID: <19e552685d72cf3c8064c56ee9bce5859303da25.1749039441.git.jdenemar@redhat.com>
From: Collin Walling <walling@linux.ibm.com>
Date: Mon, 16 Dec 2024 18:03:52 -0500
Subject: [PATCH] qemuMonitorJSONGetCPUModelExpansion: refactor parsing
functions
Refactor the CPU Model parsing functions within
qemuMonitorJSONGetCPUModelExpansion. The new functions,
qemuMonitorJSONParseCPUModelExpansionData and
qemuMonitorJSONParseCPUModelExpansion invoke the functions they
replace and leave room for a subsequent patch to handle parsing the
(optional) deprecated_props field resulting from the command.
Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 60e407deb5cd88e5f1564d1c9145e374001cf34f)
JIRA: https://issues.redhat.com/browse/RHEL-89415
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
src/qemu/qemu_monitor_json.c | 46 ++++++++++++++++++++++++++++++------
1 file changed, 39 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index be5d3be7e6..5df32922fb 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5125,6 +5125,37 @@ qemuMonitorJSONParseCPUModel(const char *cpu_name,
}
+static int
+qemuMonitorJSONParseCPUModelExpansionData(virJSONValue *data,
+ bool fail_no_props,
+ virJSONValue **cpu_model,
+ virJSONValue **cpu_props,
+ const char **cpu_name)
+{
+ if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion",
+ fail_no_props, cpu_model, cpu_props,
+ cpu_name) < 0)
+ return -1;
+
+ return 0;
+}
+
+
+static int
+qemuMonitorJSONParseCPUModelExpansion(const char *cpu_name,
+ virJSONValue *cpu_props,
+ qemuMonitorCPUModelInfo **model_info)
+{
+ g_autoptr(qemuMonitorCPUModelInfo) expanded_model = NULL;
+
+ if (qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, &expanded_model) < 0)
+ return -1;
+
+ *model_info = g_steal_pointer(&expanded_model);
+ return 0;
+}
+
+
static int
qemuMonitorJSONQueryCPUModelExpansionOne(qemuMonitor *mon,
qemuMonitorCPUModelExpansionType type,
@@ -5195,9 +5226,9 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
if ((rc = qemuMonitorJSONQueryCPUModelExpansionOne(mon, type, &model, &data)) <= 0)
return rc;
- if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion",
- fail_no_props, &cpu_model, &cpu_props,
- &cpu_name) < 0)
+ if (qemuMonitorJSONParseCPUModelExpansionData(data, fail_no_props,
+ &cpu_model, &cpu_props,
+ &cpu_name) < 0)
return -1;
/* QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL requests "full" expansion
@@ -5213,13 +5244,14 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
if ((rc = qemuMonitorJSONQueryCPUModelExpansionOne(mon, type, &fullModel, &fullData)) <= 0)
return rc;
- if (qemuMonitorJSONParseCPUModelData(fullData, "query-cpu-model-expansion",
- fail_no_props, &cpu_model, &cpu_props,
- &cpu_name) < 0)
+ if (qemuMonitorJSONParseCPUModelExpansionData(fullData, fail_no_props,
+ &cpu_model, &cpu_props,
+ &cpu_name) < 0)
return -1;
}
- return qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, model_info);
+ return qemuMonitorJSONParseCPUModelExpansion(cpu_name, cpu_props,
+ model_info);
}
--
2.49.0