[libvirt] [PATCH 49/55] qemu: Report frontend stats only for the frontend entry

Peter Krempa pkrempa at redhat.com
Tue Aug 7 14:22:40 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 d0a680629e..ee401eb702 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -20223,9 +20223,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