提交 d92d7f6b 编写于 作者: P Peter Krempa

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.
上级 e2b05c9a
......@@ -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 */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册