]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
Allow shrinking of file based volumes
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 15 Jan 2015 16:40:31 +0000 (16:40 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 12 Feb 2015 11:11:52 +0000 (11:11 +0000)
commitaa9aa6a97521ca38008f7c8d2e5cbb1abc821032
tree728aa48676b530d9a983bab1c0dadc55a76ab4e6
parent9358b63a0dfff6bc5a62698ea45d4fb5db91fa47
Allow shrinking of file based volumes

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