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

Peter Krempa posted 55 patches 7 years, 6 months ago
There is a newer version of this series
[libvirt] [PATCH 49/55] qemu: Report frontend stats only for the frontend entry
Posted by Peter Krempa 7 years, 6 months ago
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@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list