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

Peter Krempa posted 1 patch 5 years, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/f151e4ef9af84588ff723ec1888cd39ce32793ba.1535642915.git.pkrempa@redhat.com
Test syntax-check passed
src/qemu/qemu_driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[libvirt] [PATCH] qemu: Don't overwrite stats in qemuDomainBlocksStatsGather
Posted by Peter Krempa 5 years, 6 months ago
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>
---
 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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Don't overwrite stats in qemuDomainBlocksStatsGather
Posted by Ján Tomko 5 years, 6 months ago
On Thu, Aug 30, 2018 at 05:28:35PM +0200, Peter Krempa wrote:
>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>
>---
> src/qemu/qemu_driver.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

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