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