qemu: monitor: Add 'flat' parameter for qemuMonitorJSONQueryNamedBlockNodes

Modern qemu allows to skip the nested redundant data in the output of
query-named-block-nodes. Plumb in the support for the argument that
enables it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-01-21 16:42:49 +01:00
parent 63610bd5fb
commit 855211bbf3
3 changed files with 10 additions and 6 deletions

View File

@ -4247,7 +4247,7 @@ qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon)
{
QEMU_CHECK_MONITOR_NULL(mon);
return qemuMonitorJSONQueryNamedBlockNodes(mon);
return qemuMonitorJSONQueryNamedBlockNodes(mon, false);
}

View File

@ -2862,7 +2862,7 @@ qemuMonitorJSONBlockStatsUpdateCapacityBlockdev(qemuMonitorPtr mon,
virJSONValuePtr nodes;
int ret = -1;
if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon)))
if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon, false)))
return -1;
if (virJSONValueArrayForeachSteal(nodes,
@ -3018,7 +3018,7 @@ qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon)
{
g_autoptr(virJSONValue) nodes = NULL;
if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon)))
if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon, false)))
return NULL;
return qemuMonitorJSONBlockGetNamedNodeDataJSON(nodes);
@ -8740,12 +8740,15 @@ qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon,
virJSONValuePtr
qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon)
qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon,
bool flat)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("query-named-block-nodes", NULL)))
if (!(cmd = qemuMonitorJSONMakeCommand("query-named-block-nodes",
"B:flat", flat,
NULL)))
return NULL;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)

View File

@ -584,7 +584,8 @@ int qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon,
unsigned long long threshold)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
virJSONValuePtr qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon)
virJSONValuePtr qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon,
bool flat)
ATTRIBUTE_NONNULL(1);
int qemuMonitorJSONSetWatchdogAction(qemuMonitorPtr mon,