[libvirt-users] I can't virt-clone into an existing LVM now (ERROR: clone onto existing storage volume is not supported:) - i could in previous lbvirt versions? (deployment scripts no longer work...)

Hi To deploy KVM vms I use a KVM template + script - which is cloned, then cloned again and resized - using virt-resize. i.e ---------------------------------------------------- virt-clone --original debian6template-DONTSTART --name NAME.test -f /dev/vgpool/NAME.test virsh vol-create-as vgpool NAME 8G virt-clone --original NAME.test --name NAME -f /dev/vgpool/NAME virt-resize --expand /dev/sda1 /dev/vgpool/NAME.test /dev/vgpool/NAME ---------------------------------------------------- The reason I clone twice is because I know that virt-clone does things to prep it for a new install, also the whole point was to be able to specify a size to be clone into (hence the use of virt-resize) This worked fine on our Ubuntu 11.10 server, however in Ubuntu 12.04 when I try to do the same I get the error 'ERROR Clone onto existing storage volume is not supported: '/dev/vgpool/test' If I can't virt-clone into an existing LVM I know I can clone once - then resize with LVM, then virt-resize into the partition (then virt-sysprep) - however the issue with that is that it is far more fiddly to mange... Previously could just make a 20GB partition and use virt-resize to expand into - using the above method I would have to increase the LVM to the value I want minus the size of the template.. i.e I have to specify - the amount to increase by, rather than the final size I want.... The templates also change size (when I update them, etc) which would mean re-writting the script after every update. Is there a way I can re-enable being able to virt-clone to an existing LVM partition ? As mentioned it works 100% fine in Ubuntu 10.04 Regards

[adding virt-tools-list] On 07/11/2012 04:36 AM, Morgan Cox wrote:
Hi
To deploy KVM vms I use a KVM template + script - which is cloned, then cloned again and resized - using virt-resize.
i.e
----------------------------------------------------
virt-clone --original debian6template-DONTSTART --name NAME.test -f /dev/vgpool/NAME.test
virsh vol-create-as vgpool NAME 8G
virt-clone --original NAME.test --name NAME -f /dev/vgpool/NAME
virt-resize --expand /dev/sda1 /dev/vgpool/NAME.test /dev/vgpool/NAME
----------------------------------------------------
The reason I clone twice is because I know that virt-clone does things to prep it for a new install, also the whole point was to be able to specify a size to be clone into (hence the use of virt-resize)
This worked fine on our Ubuntu 11.10 server, however in Ubuntu 12.04 when I try to do the same I get the error
'ERROR Clone onto existing storage volume is not supported: '/dev/vgpool/test'
virt-clone is a separate package from libvirt, I'm hoping that someone on the virt-tools-list has more insight into whether this was an accidental regression.
If I can't virt-clone into an existing LVM I know I can clone once - then resize with LVM, then virt-resize into the partition (then virt-sysprep) - however the issue with that is that it is far more fiddly to mange...
Previously could just make a 20GB partition and use virt-resize to expand into - using the above method I would have to increase the LVM to the value I want minus the size of the template.. i.e I have to specify - the amount to increase by, rather than the final size I want.... The templates also change size (when I update them, etc) which would mean re-writting the script after every update.
Is there a way I can re-enable being able to virt-clone to an existing LVM partition ? As mentioned it works 100% fine in Ubuntu 10.04
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Wed, Jul 11, 2012 at 08:38:31AM -0600, Eric Blake wrote:
On 07/11/2012 04:36 AM, Morgan Cox wrote:
'ERROR Clone onto existing storage volume is not supported: '/dev/vgpool/test'
virt-clone is a separate package from libvirt, I'm hoping that someone on the virt-tools-list has more insight into whether this was an accidental regression.
I think an important thing to point out is that virt-clone is just a fancy way of copying (ie. dd) the data, plus it makes a handful of changes to the libvirt config. You can do most of this by alternate means.
Previously could just make a 20GB partition and use virt-resize to expand into - using the above method I would have to increase the LVM to the value I want minus the size of the template.. i.e I have to specify - the amount to increase by, rather than the final size I want.... The templates also change size (when I update them, etc) which would mean re-writting the script after every update.
So I'm not really clear why you don't just use virt-resize as before. There's not much point in doing virt-clone + virt-resize, since virt-resize itself does a copy. Maybe you should explain exactly what overall goal you're trying to achieve, instead of how you're currently trying to do it. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw

Hi I was under the impression that virt-clone would create new UUId,s etc where as virt-resize doesn't ? All I am trying to do is use a VM (in LVM) as a template to use to clone . The templates are only about 3GB - so to deploy the template I need to resize them. This is why i did this TEMPLATE -> [virt-clone] -> new_vm.tmp (to create new UUIDs , etc) new_vm.tmp -> [virt-clone] -> new_vm (a clone of the vm with new uuids - this creates .xml for qemu, etc, correct name . etc) new_vm.tmp -> [virt-resize] -> new_vm - new vm has correct partition size. If there is a more sensible way of doing this I would like to know ! Anyway is there a way of forcing being able to copy to an existing LVM partition ?? As mentioned I could do it fine in Ubuntu 10.04 not 12.04 - i.e do I need to recompile libvirt, etc ? Any help will be welcomed

On Wed, Jul 18, 2012 at 11:22:00AM +0100, Morgan Cox wrote:
Hi
I was under the impression that virt-clone would create new UUId,s etc where as virt-resize doesn't ?
In my previous message I said: "[...] plus it [virt-clone] makes a handful of changes to the libvirt config. You can do most of this by alternate means."
All I am trying to do is use a VM (in LVM) as a template to use to clone .
The templates are only about 3GB - so to deploy the template I need to resize them.
This is why i did this
TEMPLATE -> [virt-clone] -> new_vm.tmp (to create new UUIDs , etc)
If virt-clone doesn't work then you should just copy and resize the disk image using one step of virt-resize, create a new libvirt XML configuration, and finally 'virsh define' the new guest. This would involve just a single copy and is about the most efficient way of doing it (even using qcow2 or LUN clones / FlexClone is unlikely to be better).
If there is a more sensible way of doing this I would like to know !
See above.
Anyway is there a way of forcing being able to copy to an existing LVM partition ?? As mentioned I could do it fine in Ubuntu 10.04 not 12.04 - i.e do I need to recompile libvirt, etc ?
$ virt-resize /dev/vg/lv_template /dev/vg/lv_new Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
participants (3)
-
Eric Blake
-
Morgan Cox
-
Richard W.M. Jones