6d3351
From 4370d50dff22e172b84e543018d0858b5a169880 Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <4370d50dff22e172b84e543018d0858b5a169880@dist-git>
6d3351
From: John Ferlan <jferlan@redhat.com>
6d3351
Date: Wed, 12 Jul 2017 16:31:10 +0200
6d3351
Subject: [PATCH] qemu: Fix qemuDomainGetBlockInfo allocation value setting
6d3351
6d3351
https://bugzilla.redhat.com/show_bug.cgi?id=1467826
6d3351
6d3351
Commit id 'b9b1aa639' was supposed to add logic to set the allocation
6d3351
for sparse files when wr_highest_offset was zero; however, an unconditional
6d3351
setting was done just prior. For block devices, this means allocation is
6d3351
always returning 0 since 'actual-size' will be zero.
6d3351
6d3351
Remove the unconditional setting and add the note about it being possible
6d3351
to still be zero for block devices. As soon as the guest starts writing to
6d3351
the volume, the allocation value will then be obtainable from qemu via
6d3351
the wr_highest_offset.
6d3351
6d3351
(cherry picked from commit fde654be5307a570b7b0f31537e18e70a274cd50)
6d3351
6d3351
https://bugzilla.redhat.com/show_bug.cgi?id=1470127 [7.4.z - 0day]
6d3351
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
(cherry picked from commit 0220b2fed9ab4b07f32e8ebe4ab048d64a27e948)
6d3351
6d3351
https://bugzilla.redhat.com/show_bug.cgi?id=1473706
6d3351
---
6d3351
 src/qemu/qemu_driver.c | 3 +--
6d3351
 1 file changed, 1 insertion(+), 2 deletions(-)
6d3351
6d3351
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
6d3351
index a2fb41b91a..b6d72303ca 100644
6d3351
--- a/src/qemu/qemu_driver.c
6d3351
+++ b/src/qemu/qemu_driver.c
6d3351
@@ -11715,10 +11715,9 @@ qemuDomainGetBlockInfo(virDomainPtr dom,
6d3351
      * Additionally, if qemu hasn't written to the file yet, then set the
6d3351
      * allocation to whatever qemu returned for physical (e.g. the "actual-
6d3351
      * size" from the json query) as that will match the expected allocation
6d3351
-     * value for this API. */
6d3351
+     * value for this API. NB: May still be 0 for block. */
6d3351
     if (entry->physical == 0 || info->allocation == 0 ||
6d3351
         info->allocation == entry->physical) {
6d3351
-        info->allocation = entry->physical;
6d3351
         if (info->allocation == 0)
6d3351
             info->allocation = entry->physical;
6d3351
 
6d3351
-- 
6d3351
2.13.3
6d3351