[libvirt] [PATCHv2 56/62] qemu: Report frontend stats only for the frontend entry

Peter Krempa pkrempa at redhat.com
Mon Aug 13 16:00:30 UTC 2018


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 <pkrempa at redhat.com>
---
 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 e8e8bdbb14..c09108b57e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -20209,9 +20209,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,
-- 
2.16.2




More information about the libvir-list mailing list