[libvirt] [PATCH] qemu: Don't overwrite stats in qemuDomainBlocksStatsGather

Peter Krempa pkrempa at redhat.com
Thu Aug 30 15:28:35 UTC 2018


The size/capacity stats gathered in qemuDomainBlocksStatsGather when
using -blockdev would be overwritten by assigning/copying the transfered
data statistics at the end. Fix it by moving the assignment prior to
fetching the capacity data.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_driver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a0f7c71675..07ea5473b6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11114,6 +11114,8 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver,
             goto cleanup;
         }

+        **retstats = *stats;
+
         if (blockdev) {
             /* capacity are reported only per node-name so we need to transfer them */
             qemuBlockStatsPtr capstats;
@@ -11127,8 +11129,6 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver,
                 (*retstats)->write_threshold = capstats->write_threshold;
             }
         }
-
-        **retstats = *stats;
     } else {
         for (i = 0; i < vm->def->ndisks; i++) {
             disk = vm->def->disks[i];
-- 
2.16.2




More information about the libvir-list mailing list