mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 07:42:56 +00:00
qemu: monitor: Add monitor infrastructure for query-named-block-nodes
Add monitor tooling for calling query-named-block-nodes. The monitor returns the data as the raw JSON array that is returned from the monitor. Unfortunately the logic to extract the node names for a complete backing chain will be so complex that I won't be able to extract any meaningful subset of the data in the monitor code.
This commit is contained in:
parent
e2b05c9a8d
commit
d92d7f6b52
@ -4219,3 +4219,14 @@ qemuMonitorSetBlockThreshold(qemuMonitorPtr mon,
|
||||
|
||||
return qemuMonitorJSONSetBlockThreshold(mon, nodename, threshold);
|
||||
}
|
||||
|
||||
|
||||
virJSONValuePtr
|
||||
qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon)
|
||||
{
|
||||
VIR_DEBUG("mon=%p", mon);
|
||||
|
||||
QEMU_CHECK_MONITOR_JSON_NULL(mon);
|
||||
|
||||
return qemuMonitorJSONQueryNamedBlockNodes(mon);
|
||||
}
|
||||
|
@ -1083,5 +1083,6 @@ int qemuMonitorSetBlockThreshold(qemuMonitorPtr mon,
|
||||
const char *nodename,
|
||||
unsigned long long threshold);
|
||||
|
||||
virJSONValuePtr qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon);
|
||||
|
||||
#endif /* QEMU_MONITOR_H */
|
||||
|
@ -7557,3 +7557,29 @@ qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon,
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
virJSONValuePtr
|
||||
qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon)
|
||||
{
|
||||
virJSONValuePtr cmd;
|
||||
virJSONValuePtr reply = NULL;
|
||||
virJSONValuePtr ret = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("query-named-block-nodes", NULL)))
|
||||
return NULL;
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = virJSONValueObjectStealArray(reply, "return");
|
||||
|
||||
cleanup:
|
||||
virJSONValueFree(cmd);
|
||||
virJSONValueFree(reply);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -518,4 +518,7 @@ int qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon,
|
||||
unsigned long long threshold)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
|
||||
virJSONValuePtr qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
#endif /* QEMU_MONITOR_JSON_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user