diff options
author | Jiri Denemark <jdenemar@redhat.com> | 2017-02-22 16:01:30 +0100 |
---|---|---|
committer | Jiri Denemark <jdenemar@redhat.com> | 2017-03-03 19:57:56 +0100 |
commit | 2fc215dd2ad4b88c1054da804c4c45b3d4e5c2fa (patch) | |
tree | 7a60d8d7a52be198fae41ae93a6a99a42a0578a6 /src/qemu/qemu_monitor.c | |
parent | 03a34f6b84da009291e8651aba71df8a6761d081 (diff) | |
download | libvirt-2fc215dd2ad4b88c1054da804c4c45b3d4e5c2fa.tar.gz |
qemu: Store more types in qemuMonitorCPUModelInfo
While query-cpu-model-expansion returns only boolean features on s390,
but x86_64 reports some integer and string properties which we are
interested in.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Diffstat (limited to 'src/qemu/qemu_monitor.c')
-rw-r--r-- | src/qemu/qemu_monitor.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index b15207a693..4c3f7a20fe 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3661,8 +3661,11 @@ qemuMonitorCPUModelInfoFree(qemuMonitorCPUModelInfoPtr model_info) if (!model_info) return; - for (i = 0; i < model_info->nprops; i++) + for (i = 0; i < model_info->nprops; i++) { VIR_FREE(model_info->props[i].name); + if (model_info->props[i].type == QEMU_MONITOR_CPU_PROPERTY_STRING) + VIR_FREE(model_info->props[i].value.string); + } VIR_FREE(model_info->props); VIR_FREE(model_info->name); @@ -3691,7 +3694,25 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig) if (VIR_STRDUP(copy->props[i].name, orig->props[i].name) < 0) goto error; - copy->props[i].supported = orig->props[i].supported; + copy->props[i].type = orig->props[i].type; + switch (orig->props[i].type) { + case QEMU_MONITOR_CPU_PROPERTY_BOOLEAN: + copy->props[i].value.boolean = orig->props[i].value.boolean; + break; + + case QEMU_MONITOR_CPU_PROPERTY_STRING: + if (VIR_STRDUP(copy->props[i].value.string, + orig->props[i].value.string) < 0) + goto error; + break; + + case QEMU_MONITOR_CPU_PROPERTY_NUMBER: + copy->props[i].value.number = orig->props[i].value.number; + break; + + case QEMU_MONITOR_CPU_PROPERTY_LAST: + break; + } } return copy; |