Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c2722c39da..59d1caa053 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10054,7 +10054,6 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, qemuBlockStats **retstats) { qemuDomainObjPrivate *priv = vm->privateData; - bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); virDomainDiskDef *disk = NULL; g_autoptr(GHashTable) blockstats = NULL; qemuBlockStats *stats; @@ -10090,12 +10089,8 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); nstats = qemuMonitorGetAllBlockStatsInfo(priv->mon, &blockstats); - if (capacity && nstats >= 0) { - if (blockdev) - rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, blockstats); - else - rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, blockstats); - } + if (capacity && nstats >= 0) + rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, blockstats); qemuDomainObjExitMonitor(vm); @@ -10105,6 +10100,8 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, *retstats = g_new0(qemuBlockStats, 1); if (entryname) { + qemuBlockStats *capstats; + if (!(stats = virHashLookup(blockstats, entryname))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find statistics for device '%s'"), entryname); @@ -10113,18 +10110,14 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, **retstats = *stats; - if (blockdev) { - /* capacity are reported only per node-name so we need to transfer them */ - qemuBlockStats *capstats; - - if (disk && disk->src && - (capstats = virHashLookup(blockstats, disk->src->nodeformat))) { - (*retstats)->capacity = capstats->capacity; - (*retstats)->physical = capstats->physical; - (*retstats)->wr_highest_offset = capstats->wr_highest_offset; - (*retstats)->wr_highest_offset_valid = capstats->wr_highest_offset_valid; - (*retstats)->write_threshold = capstats->write_threshold; - } + /* capacity are reported only per node-name so we need to transfer them */ + if (disk && disk->src && + (capstats = virHashLookup(blockstats, disk->src->nodeformat))) { + (*retstats)->capacity = capstats->capacity; + (*retstats)->physical = capstats->physical; + (*retstats)->wr_highest_offset = capstats->wr_highest_offset; + (*retstats)->wr_highest_offset_valid = capstats->wr_highest_offset_valid; + (*retstats)->write_threshold = capstats->write_threshold; } } else { for (i = 0; i < vm->def->ndisks; i++) { -- 2.36.1