]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Don't overwrite stats in qemuDomainBlocksStatsGather
authorPeter Krempa <pkrempa@redhat.com>
Thu, 30 Aug 2018 08:30:09 +0000 (10:30 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 4 Sep 2018 06:11:09 +0000 (08:11 +0200)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c

index a0f7c71675df69764ec4ca5df2cb871bf42ae2f3..07ea5473b6825b88bcc3d1a7da44fb0563506645 100644 (file)
@@ -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];