[libvirt] [PATCH] qemu: Fix qemuDomainGetBlockInfo allocation value setting

John Ferlan posted 1 patch 115 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20170706200211.24596-1-jferlan@redhat.com
src/qemu/qemu_driver.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

[libvirt] [PATCH] qemu: Fix qemuDomainGetBlockInfo allocation value setting

Posted by John Ferlan 115 weeks ago
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.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 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 cdb727b..66fb80a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11711,10 +11711,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.9.4

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

Re: [libvirt] [PATCH] qemu: Fix qemuDomainGetBlockInfo allocation value setting

Posted by Michal Privoznik 114 weeks ago
On 07/06/2017 10:02 PM, John Ferlan wrote:
> 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.
> 
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
>  src/qemu/qemu_driver.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

ACK

Michal

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