The 'query-blockstats' command does not return statistics for the
explicitly named nodes unless the new argument is specified. Add
infrastrucuture that will allow us to use the new approach if desired.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_block.c | 2 +-
src/qemu/qemu_monitor.c | 8 ++++++--
src/qemu/qemu_monitor.h | 3 ++-
src/qemu/qemu_monitor_json.c | 9 ++++++---
src/qemu/qemu_monitor_json.h | 3 ++-
5 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 7ad79c7e7d..a633bfa0b0 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -356,7 +356,7 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver,
return -1;
data = qemuMonitorQueryNamedBlockNodes(qemuDomainGetMonitor(vm));
- blockstats = qemuMonitorQueryBlockstats(qemuDomainGetMonitor(vm));
+ blockstats = qemuMonitorQueryBlockstats(qemuDomainGetMonitor(vm), false);
if (qemuDomainObjExitMonitor(driver, vm) < 0 || !data || !blockstats)
goto cleanup;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index bc116e4e2d..8618a44f32 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2243,15 +2243,19 @@ qemuMonitorGetBlockInfo(qemuMonitorPtr mon)
/**
* qemuMonitorQueryBlockstats:
* @mon: monitor object
+ * @nodenames: include backing chain nodes with explicitly specified name
*
* Returns data from a call to 'query-blockstats'.
*/
virJSONValuePtr
-qemuMonitorQueryBlockstats(qemuMonitorPtr mon)
+qemuMonitorQueryBlockstats(qemuMonitorPtr mon,
+ bool nodenames)
{
QEMU_CHECK_MONITOR_NULL(mon);
- return qemuMonitorJSONQueryBlockstats(mon);
+ VIR_DEBUG("nodenames: %d", nodenames);
+
+ return qemuMonitorJSONQueryBlockstats(mon, nodenames);
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 81474a04f6..b4b9cf91eb 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -563,7 +563,8 @@ int qemuMonitorSetMemoryStatsPeriod(qemuMonitorPtr mon,
int qemuMonitorBlockIOStatusToError(const char *status);
virHashTablePtr qemuMonitorGetBlockInfo(qemuMonitorPtr mon);
-virJSONValuePtr qemuMonitorQueryBlockstats(qemuMonitorPtr mon);
+virJSONValuePtr qemuMonitorQueryBlockstats(qemuMonitorPtr mon,
+ bool nodenames);
typedef struct _qemuBlockStats qemuBlockStats;
typedef qemuBlockStats *qemuBlockStatsPtr;
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index cc3c8f2dd6..e41c1d47aa 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2326,13 +2326,16 @@ qemuMonitorJSONGetOneBlockStatsInfo(virJSONValuePtr dev,
virJSONValuePtr
-qemuMonitorJSONQueryBlockstats(qemuMonitorPtr mon)
+qemuMonitorJSONQueryBlockstats(qemuMonitorPtr mon,
+ bool nodenames)
{
virJSONValuePtr cmd;
virJSONValuePtr reply = NULL;
virJSONValuePtr ret = NULL;
- if (!(cmd = qemuMonitorJSONMakeCommand("query-blockstats", NULL)))
+ if (!(cmd = qemuMonitorJSONMakeCommand("query-blockstats",
+ "B:query-nodes", nodenames,
+ NULL)))
return NULL;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
@@ -2361,7 +2364,7 @@ qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorPtr mon,
size_t i;
virJSONValuePtr devices;
- if (!(devices = qemuMonitorJSONQueryBlockstats(mon)))
+ if (!(devices = qemuMonitorJSONQueryBlockstats(mon, false)))
return -1;
for (i = 0; i < virJSONValueArraySize(devices); i++) {
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 66536ceb97..a6b6579849 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -82,7 +82,8 @@ int qemuMonitorJSONSetMemoryStatsPeriod(qemuMonitorPtr mon,
int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon,
virHashTablePtr table);
-virJSONValuePtr qemuMonitorJSONQueryBlockstats(qemuMonitorPtr mon);
+virJSONValuePtr qemuMonitorJSONQueryBlockstats(qemuMonitorPtr mon,
+ bool nodenames);
int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorPtr mon,
virHashTablePtr hash,
bool backingChain);
--
2.16.2