Preserve the "alias-of" information of the qemu response that indicates
that the cpu model is merely an alternate name for another cpu model.
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/qemu/qemu_monitor.c | 2 ++
src/qemu/qemu_monitor.h | 1 +
src/qemu/qemu_monitor_json.c | 3 +++
3 files changed, 6 insertions(+)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index fda5d2f368..ccea577ebc 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3363,6 +3363,7 @@ qemuMonitorCPUDefsFree(qemuMonitorCPUDefs *defs)
for (i = 0; i < defs->ncpus; i++) {
g_strfreev(defs->cpus[i].blockers);
g_free(defs->cpus[i].name);
+ g_free(defs->cpus[i].alias);
g_free(defs->cpus[i].type);
}
@@ -3400,6 +3401,7 @@ qemuMonitorCPUDefsCopy(qemuMonitorCPUDefs *src)
cpuDst->usable = cpuSrc->usable;
cpuDst->name = g_strdup(cpuSrc->name);
+ cpuDst->alias = g_strdup(cpuSrc->alias);
cpuDst->type = g_strdup(cpuSrc->type);
cpuDst->blockers = g_strdupv(cpuSrc->blockers);
cpuDst->deprecated = cpuSrc->deprecated;
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 95267ec6c7..6cb4ff1e22 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1150,6 +1150,7 @@ typedef struct _qemuMonitorCPUDefInfo qemuMonitorCPUDefInfo;
struct _qemuMonitorCPUDefInfo {
virDomainCapsCPUUsable usable;
char *name;
+ char *alias;
char *type;
char **blockers; /* NULL-terminated string list */
bool deprecated;
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 3aad2ab212..4ffd3bbed7 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5274,6 +5274,9 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitor *mon,
cpu->name = g_strdup(tmp);
+ if ((tmp = virJSONValueObjectGetString(child, "alias-of")) &&
*tmp)
+ cpu->alias = g_strdup(tmp);
+
if ((tmp = virJSONValueObjectGetString(child, "typename")) &&
*tmp)
cpu->type = g_strdup(tmp);
--
2.31.1