Always fetch the stats for all backing chain members. Callers from qemu_driver.c already always passed 'true' and the caller from the migration code won't mind when we fetch all stats. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 5 ++--- src/qemu/qemu_migration_cookie.c | 2 +- src/qemu/qemu_monitor.c | 7 ++----- src/qemu/qemu_monitor.h | 3 +-- src/qemu/qemu_monitor_json.c | 16 +++++----------- src/qemu/qemu_monitor_json.h | 3 +-- 6 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 587a673efc..6997dc7dea 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10057,7 +10057,7 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, if (blockdev) rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, blockstats); else - rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, blockstats, true); + rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, blockstats); } if (qemuDomainObjExitMonitor(driver, vm) < 0 || nstats < 0 || rc < 0) @@ -18483,8 +18483,7 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver, if (blockdev) rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, stats); else - ignore_value(qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, - true)); + ignore_value(qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats)); } if (fetchnodedata) diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c index c7b010f0a0..cc4cc39b32 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -495,7 +495,7 @@ qemuMigrationCookieAddNBD(qemuMigrationCookie *mig, if (blockdev) rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, stats); else - rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false); + rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats); if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) return -1; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 166f7958f0..9af9d3cf63 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2084,14 +2084,11 @@ qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon, /* Updates "stats" to fill virtual and physical size of the image */ int qemuMonitorBlockStatsUpdateCapacity(qemuMonitor *mon, - GHashTable *stats, - bool backingChain) + GHashTable *stats) { - VIR_DEBUG("stats=%p, backing=%d", stats, backingChain); - QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONBlockStatsUpdateCapacity(mon, stats, backingChain); + return qemuMonitorJSONBlockStatsUpdateCapacity(mon, stats); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index e28d45cc4a..f452d0d306 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -742,8 +742,7 @@ int qemuMonitorGetAllBlockStatsInfo(qemuMonitor *mon, ATTRIBUTE_NONNULL(2); int qemuMonitorBlockStatsUpdateCapacity(qemuMonitor *mon, - GHashTable *stats, - bool backingChain) + GHashTable *stats) ATTRIBUTE_NONNULL(2); int qemuMonitorBlockStatsUpdateCapacityBlockdev(qemuMonitor *mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index af673b5ba6..7bf3a9981b 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2617,8 +2617,7 @@ static int qemuMonitorJSONBlockStatsUpdateCapacityOne(virJSONValue *image, const char *dev_name, int depth, - GHashTable *stats, - bool backingChain) + GHashTable *stats) { g_autofree char *entry_name = qemuDomainStorageAlias(dev_name, depth); virJSONValue *backing; @@ -2627,13 +2626,11 @@ qemuMonitorJSONBlockStatsUpdateCapacityOne(virJSONValue *image, stats, NULL) < 0) return -1; - if (backingChain && - (backing = virJSONValueObjectGetObject(image, "backing-image")) && + if ((backing = virJSONValueObjectGetObject(image, "backing-image")) && qemuMonitorJSONBlockStatsUpdateCapacityOne(backing, dev_name, depth + 1, - stats, - true) < 0) + stats) < 0) return -1; return 0; @@ -2642,8 +2639,7 @@ qemuMonitorJSONBlockStatsUpdateCapacityOne(virJSONValue *image, int qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *mon, - GHashTable *stats, - bool backingChain) + GHashTable *stats) { size_t i; g_autoptr(virJSONValue) devices = NULL; @@ -2668,9 +2664,7 @@ qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *mon, !(image = virJSONValueObjectGetObject(inserted, "image"))) continue; - if (qemuMonitorJSONBlockStatsUpdateCapacityOne(image, dev_name, 0, - stats, - backingChain) < 0) + if (qemuMonitorJSONBlockStatsUpdateCapacityOne(image, dev_name, 0, stats) < 0) return -1; } diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index c60f079d06..f9e01e5bf5 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -79,8 +79,7 @@ virJSONValue *qemuMonitorJSONQueryBlockstats(qemuMonitor *mon); int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon, GHashTable *hash); int qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *mon, - GHashTable *stats, - bool backingChain); + GHashTable *stats); int qemuMonitorJSONBlockStatsUpdateCapacityBlockdev(qemuMonitor *mon, GHashTable *stats); -- 2.31.1