Hide Forgot
Description of problem: Creating a volume and specify allocation size with zero, then failed to clone the volume with virsh vol-clone. Version-Release number of selected component (if applicable): qemu-kvm-0.12.1.2-2.129.el6.x86_64 libvirt-0.8.7-2.el6.x86_64 How reproducible: Always Steps to Reproduce: # virsh vol-create-as --pool default --name foo --capacity 6G --allocation 0 --format qcow2 Vol foo created # virsh vol-info --pool default foo Name: foo Type: file Capacity: 6.00 GB Allocation: 140.00 KB # virsh vol-clone --pool default --vol foo --newname foo1 error: Failed to clone vol from foo error: Cannot run /usr/bin/qemu-img to create /var/lib/libvirt/images/foo1: Invalid argument Actual results: The error occurs. Expected results: The volume should be cloned successfully. Additional info: Successful case: # virsh vol-create-as --pool default --name foo --capacity 6G --allocation 1G --format qcow2 Vol foo created # virsh vol-clone --pool default --vol foo --newname foo1 Vol foo1 cloned from foo
What's the version of qemu-img? And could you try to clone the vol from following qemu-img command? (/var/lib/libvirt/images/foo is the zero size vol you created.) /usr/bin/qemu-img convert -f qcow2 -O qcow2 /var/lib/libvirt/images/foo /var/lib/libvirt/images/foo1
(In reply to comment #1) > What's the version of qemu-img? > > And could you try to clone the vol from following qemu-img command? > (/var/lib/libvirt/images/foo is the zero size vol you created.) > > /usr/bin/qemu-img convert -f qcow2 -O qcow2 /var/lib/libvirt/images/foo > /var/lib/libvirt/images/foo1 Command above is what libvirt uses to clone the qcow2 vol, it works for me on newer qemu-img. [root@Osier ~]# /usr/bin/qemu-img convert -f qcow2 -O qcow2 /var/lib/libvirt/images/foo /var/lib/libvirt/images/foo1 [root@Osier ~]# echo $? 0 So, if it doesn't work on your qemu-img version, that's a bug of qemu-img, will reassign.
[root@Osier ~]# rpm -q qemu-img qemu-img-0.13.0-1.fc14.x86_64
I just tried both qemu-img and virsh command, it works well. It is curious that it can't be reproduced after rebooting my machine.