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