mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemu_monitor: Introduce qemuMonitorGetObjectProps
Now that we've gotten rid of misleading names we can introduce qemuMonitorGetObjectProps() function which queries -object properties. Again, some parts of code can be reused. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
036120209b
commit
d81cf424ca
@ -3932,6 +3932,19 @@ qemuMonitorGetDeviceProps(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorGetObjectProps(qemuMonitorPtr mon,
|
||||
const char *object,
|
||||
char ***props)
|
||||
{
|
||||
VIR_DEBUG("object=%s props=%p", object, props);
|
||||
|
||||
QEMU_CHECK_MONITOR_JSON(mon);
|
||||
|
||||
return qemuMonitorJSONGetObjectProps(mon, object, props);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
qemuMonitorGetTargetArch(qemuMonitorPtr mon)
|
||||
{
|
||||
|
@ -1048,6 +1048,9 @@ int qemuMonitorGetObjectTypes(qemuMonitorPtr mon,
|
||||
int qemuMonitorGetDeviceProps(qemuMonitorPtr mon,
|
||||
const char *device,
|
||||
char ***props);
|
||||
int qemuMonitorGetObjectProps(qemuMonitorPtr mon,
|
||||
const char *object,
|
||||
char ***props);
|
||||
char *qemuMonitorGetTargetArch(qemuMonitorPtr mon);
|
||||
|
||||
int qemuMonitorNBDServerStart(qemuMonitorPtr mon,
|
||||
|
@ -6127,6 +6127,38 @@ int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon,
|
||||
const char *object,
|
||||
char ***props)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValuePtr cmd;
|
||||
virJSONValuePtr reply = NULL;
|
||||
|
||||
*props = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("qom-list-properties",
|
||||
"s:typename", object,
|
||||
NULL)))
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONHasError(reply, "DeviceNotFound")) {
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = qemuMonitorJSONParsePropsList(cmd, reply, props);
|
||||
cleanup:
|
||||
virJSONValueFree(reply);
|
||||
virJSONValueFree(cmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon)
|
||||
{
|
||||
|
@ -445,6 +445,10 @@ int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon,
|
||||
const char *device,
|
||||
char ***props)
|
||||
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||
int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon,
|
||||
const char *object,
|
||||
char ***props)
|
||||
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||
char *qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon);
|
||||
|
||||
int qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon,
|
||||
|
Loading…
Reference in New Issue
Block a user