Bug 671104 - virsh: vol-clone failed with the vol of allocation size with zero
Summary: virsh: vol-clone failed with the vol of allocation size with zero
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.1
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: rc
: ---
Assignee: Osier Yang
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-20 11:23 UTC by Nan Zhang
Modified: 2011-04-14 05:35 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-01-24 05:20:53 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Nan Zhang 2011-01-20 11:23:33 UTC
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

Comment 1 Osier Yang 2011-01-22 04:22:18 UTC
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

Comment 2 Osier Yang 2011-01-22 04:27:40 UTC
(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.

Comment 3 Osier Yang 2011-01-22 04:32:53 UTC
[root@Osier ~]# rpm -q qemu-img
qemu-img-0.13.0-1.fc14.x86_64

Comment 4 Nan Zhang 2011-01-24 05:20:53 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.