[libvirt] [PATCH] Allow shrinking of file based volumes

Peter Krempa pkrempa at redhat.com
Fri Jan 16 08:52:27 UTC 2015


On Thu, Jan 15, 2015 at 16:42:32 +0000, Daniel Berrange wrote:
> While the main storage driver code allows the flag
> VIR_STORAGE_VOL_RESIZE_SHRINK to be set, none of the backend
> drivers are supporting it. At the very least this can work
> for plain file based volumes since we just ftruncate() them
> to the new size. It does not work with qcow2 volumes, but we
> can arguably delegate to qemu-img for error reporting for that
> instead of second guessing this for ourselves:
> 
> $ virsh vol-resize --shrink /home/berrange/VirtualMachines/demo.qcow2 2G
> error: Failed to change size of volume 'demo.qcow2' to 2G
> 
> error: internal error: Child process (/usr/bin/qemu-img resize /home/berrange/VirtualMachines/demo.qcow2 2147483648) unexpected exit status 1: qemu-img: qcow2 doesn't support shrinking images yet
> qemu-img: This image does not support resize
> 
> See also https://bugzilla.redhat.com/show_bug.cgi?id=1021802
> ---
>  src/storage/storage_backend_fs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

ACK,

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150116/2b1dd893/attachment-0001.sig>


More information about the libvir-list mailing list