From 855211bbf3ed45a73159f45eba1b15f05d771b76 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 21 Jan 2020 16:42:49 +0100 Subject: [PATCH] qemu: monitor: Add 'flat' parameter for qemuMonitorJSONQueryNamedBlockNodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- src/qemu/qemu_monitor.c | 2 +- src/qemu/qemu_monitor_json.c | 11 +++++++---- src/qemu/qemu_monitor_json.h | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 6c0a658def..6a543a3093 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4247,7 +4247,7 @@ qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon) { QEMU_CHECK_MONITOR_NULL(mon); - return qemuMonitorJSONQueryNamedBlockNodes(mon); + return qemuMonitorJSONQueryNamedBlockNodes(mon, false); } diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a2f253f731..5ae8d783ee 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -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) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index fd2e09025e..71aaa471e1 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -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,