mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: command: Add helper to convert vcpu definition to JSON props
For use on the monitor we need to format certain parts of the vcpu private definition into a JSON object. Add a helper.
This commit is contained in:
parent
48e3d42889
commit
8807f28b85
@ -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;
|
||||
}
|
||||
|
@ -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__*/
|
||||
|
Loading…
Reference in New Issue
Block a user