From 419c7e12c7c79752c9466b31c1fd0bb0b03e159a Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 3 Aug 2018 14:19:46 +0200 Subject: [PATCH] qemu: Report frontend stats only for the frontend entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When reporting stats for the backing chain some of them make sense only for the topmost entry as they are actually tied to the frontend device. We unfortunately can't change that fact, but we can stop reporting all zero stats for the backing chain members where they don't make any sense. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_driver.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 53c2fc5ddf..8fbc4dd75e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20206,9 +20206,12 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk, records, nrecords) < 0) goto cleanup; - if (qemuDomainGetStatsBlockExportFrontend(alias, stats, *recordnr, - records, nrecords) < 0) - goto cleanup; + /* The following stats make sense only for the frontend device */ + if (n == disk->src) { + if (qemuDomainGetStatsBlockExportFrontend(alias, stats, *recordnr, + records, nrecords) < 0) + goto cleanup; + } if (qemuDomainGetStatsOneBlock(driver, cfg, dom, records, nrecords, alias, n, *recordnr,