On Mon, Apr 16, 2018 at 01:06:57AM -0500, Chris Venteicher wrote:
Function qemuMonitorJSONBuildCPUModelInfoJSON builds Json of form
{"model": {"name": "IvyBridge", "props": {}}}
from pointer to qemuMonitorCPUModelInfo.
---
src/qemu/qemu_monitor_json.c | 49 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
...
+
+ switch (prop->type) {
+ case QEMU_MONITOR_CPU_PROPERTY_BOOLEAN:
+ if (virJSONValueObjectAppendBoolean(cpu_props, prop->name,
prop->value.boolean) < 0)
+ goto cleanup;
+ break;
+
+ case QEMU_MONITOR_CPU_PROPERTY_STRING:
+ if (virJSONValueObjectAppendString(cpu_props, prop->name,
prop->value.string) < 0)
+ goto cleanup;
+ break;
+
+ case QEMU_MONITOR_CPU_PROPERTY_NUMBER:
+ if (virJSONValueObjectAppendNumberLong(cpu_props, prop->name,
prop->value.number) < 0)
+ goto cleanup;
+ break;
+
+ case QEMU_MONITOR_CPU_PROPERTY_LAST:
+ break;
The most recent "correct" way to write switches in libvirt is to do the
following:
case QEMU_MONITOR_CPU_PROPERTY_LAST:
default:
virReportEnumRangeError(qemuMonitorCPUPropertyPtr, prop->type);
goto cleanup;
Erik