For use on the monitor we need to format certain parts of the vcpu
private definition into a JSON object. Add a helper.
---
Notes:
v2:
- already ACKed
src/qemu/qemu_command.c | 30 ++++++++++++++++++++++++++++++
src/qemu/qemu_command.h | 3 +++
2 files changed, 33 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a6dea6a..28e5a7e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9799,3 +9799,33 @@ qemuBuildChrDeviceStr(char **deviceStr,
return ret;
}
+
+
+virJSONValuePtr
+qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
+{
+ qemuDomainVcpuPrivatePtr vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu);
+ virJSONValuePtr ret = NULL;
+
+ if (virJSONValueObjectCreate(&ret, "s:driver", vcpupriv->type,
+ "s:id", vcpupriv->alias, NULL) <
0)
+ goto error;
+
+ if (vcpupriv->socket_id != -1 &&
+ virJSONValueObjectAdd(ret, "i:socket-id", vcpupriv->socket_id, NULL)
< 0)
+ goto error;
+
+ if (vcpupriv->core_id != -1 &&
+ virJSONValueObjectAdd(ret, "i:core-id", vcpupriv->core_id, NULL)
< 0)
+ goto error;
+
+ if (vcpupriv->thread_id != -1 &&
+ virJSONValueObjectAdd(ret, "i:thread-id", vcpupriv->thread_id, NULL)
< 0)
+ goto error;
+
+ return ret;
+
+ error:
+ virJSONValueFree(ret);
+ return NULL;
+}
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index dcf9ba6..9b9ccb6 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -179,4 +179,7 @@ bool qemuCheckCCWS390AddressSupport(const virDomainDef *def,
virQEMUCapsPtr qemuCaps,
const char *devicename);
+virJSONValuePtr qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
+ ATTRIBUTE_NONNULL(1);
+
#endif /* __QEMU_COMMAND_H__*/
--
2.8.2