]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Report frontend stats only for the frontend entry
authorPeter Krempa <pkrempa@redhat.com>
Fri, 3 Aug 2018 12:19:46 +0000 (14:19 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 21 Aug 2018 13:46:06 +0000 (15:46 +0200)
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>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c

index 53c2fc5ddf69f2c17e55ab768c2dfe92b98a7bde..8fbc4dd75e9daafb995175e99e3cb9c678d94380 100644 (file)
@@ -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,