uname -a Linux phx2.in.ibm.com 3.9.5-301.fc19.x86_64-EINJ #1 SMP Wed Sep 18 05:55:39 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux cat /etc/issue Fedora release 19 (Schrödinger’s Cat) Kernel \r on an \m (\l) libvirtd --version libvirtd (libvirt) 1.1.3 git log | head commit 8ebd3d889296b03fc51f34b2f6f5c5d523694559 Author: Chen Hanxiao <chenhanxiao.com> Date: Fri Oct 18 10:12:00 2013 +0800 daemon: don't free domain if it's null If we fail to get domain, we had to judge whether it's null or not when doing 'cleanup'. Signed-off-by: Chen Hanxiao <chenhanxiao.com> qemu-system-x86_64 --version QEMU emulator version 1.6.50, Copyright (c) 2003-2008 Fabrice Bellard virsh vol-resize does not works for shrink option. git log | head commit 1680d485777ecf436d724631ea8722cc0c66990e Merge: ded77da f8da40a Author: Anthony Liguori <aliguori> Date: Mon Oct 14 09:59:59 2013 -0700 Merge remote-tracking branch 'rth/tcg-ldst-6' into staging # By Richard Henderson # Via Richard Henderson * rth/tcg-ldst-6: Steps to reproduce: 1. Create a volume of 1G size ---Vol created----------------------------------->OK 2. Increase the volume to 3G using virsh vol-resize ---Size increased------------------------------->OK 3. Decrease the volume to 2G using virsh vol-resize ---Error------------------------------------------------> NOK [Asks for --shrink option to be provided, if provided, it gives error again] Steps performed: virsh vol-create-as --pool temp_pool temp_vol 1G Vol temp_vol created virsh vol-list --details --pool temp_pool Name Path Type Capacity Allocation ------------------------------------------------------------------------------- temp_vol /home/sath/virt_test/tmp/virsh_volume/temp_vol file 1.00 GiB 1.00 GiB qemu-img info /home/sath/virt_test/tmp/virsh_volume/temp_vol image: /home/sath/virt_test/tmp/virsh_volume/temp_vol file format: raw virtual size: 1.0G (1073741824 bytes) disk size: 1.0G virsh vol-resize temp_vol --pool temp_pool 3G Size of volume 'temp_vol' successfully changed to 3G [root@ltczhyp2 vm1.libvirt-qemu]# qemu-img info /home/sath/virt_test/tmp/virsh_volume/temp_vol image: /home/sath/virt_test/tmp/virsh_volume/temp_vol file format: raw virtual size: 3.0G (3221225472 bytes) disk size: 1.0G [root@ltczhyp2 vm1.libvirt-qemu]# virsh vol-list --details --pool temp_pool Name Path Type Capacity Allocation ------------------------------------------------------------------------------- temp_vol /home/sath/virt_test/tmp/virsh_volume/temp_vol file 3.00 GiB 1.00 GiB virsh vol-resize temp_vol --pool temp_pool 2G error: Failed to change size of volume 'temp_vol' to 2G error: invalid argument: Can't shrink capacity below current capacity with shrink flag explicitly specified virsh vol-resize temp_vol --pool temp_pool 2G --shrink error: Failed to change size of volume 'temp_vol' to 2G error: unsupported flags (0x4) in function virStorageBackendFileSystemVolResize---------------------NOK
libvirt-1.1.3.4-4.fc20.x86_64 -- still
Any update on this bug?
Afraid it looks like it is still broken in master.
It was trivial to make this work for plain raw files, but it isn't currently doable for qcow2 https://www.redhat.com/archives/libvir-list/2015-January/msg00552.html
commit aa9aa6a97521ca38008f7c8d2e5cbb1abc821032 Author: Daniel P. Berrange <berrange> AuthorDate: 2015-01-15 16:40:31 +0000 Commit: Daniel P. Berrange <berrange> CommitDate: 2015-02-12 11:11:52 +0000 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 git describe: v1.2.12-123-gaa9aa6a contains: v1.2.13-rc1~76