NoxDaFox
2015-Jul-20 12:58 UTC
[libvirt-users] Hot Cloning - clone running Virtual Machines
Greetings, I am running a test automation service which makes use of QEMU/KVM. As the tests run for few minutes, the time spent booting the OS (Windows) is quite a waste of resources so I decided to play a bit around the idea of hot cloning running VMs. Following an old discussion I found, I proceeded with saving the VM state through virsh save, edit its XML file with virsh save-image-edit and restore it through virsh restore. The problem comes when I try to change some specific fields in the XML. As I run several instances on the same server, I need to provide different names and UUIDs to avoid collisions. Unfortunately, libvirt forbids this operation issuing the following error message: error: unsupported configuration: Target domain uuid 7c85e288-88fe-43d2-8b9c-89af4c83c10a does not match source 62f28517-8601-4d2e-942c-a20d087f9f4a Same thing applies with the name field. Is this a limitation of the API or it is a designed protection mechanism? Would it be possible to overcome this limit? Thank you.
Daniel P. Berrange
2015-Jul-20 13:02 UTC
Re: [libvirt-users] Hot Cloning - clone running Virtual Machines
On Mon, Jul 20, 2015 at 03:58:26PM +0300, NoxDaFox wrote:> Greetings, > > I am running a test automation service which makes use of QEMU/KVM. As the > tests run for few minutes, the time spent booting the OS (Windows) is quite > a waste of resources so I decided to play a bit around the idea of hot > cloning running VMs. > > Following an old discussion I found, I proceeded with saving the VM state > through virsh save, edit its XML file with virsh save-image-edit and > restore it through virsh restore. > > The problem comes when I try to change some specific fields in the XML. As > I run several instances on the same server, I need to provide different > names and UUIDs to avoid collisions. Unfortunately, libvirt forbids this > operation issuing the following error message: > > error: unsupported configuration: Target domain uuid > 7c85e288-88fe-43d2-8b9c-89af4c83c10a does not match source > 62f28517-8601-4d2e-942c-a20d087f9f4a > > Same thing applies with the name field. > > Is this a limitation of the API or it is a designed protection mechanism? > Would it be possible to overcome this limit?Cloning running VMs is explicitly not supported because there is no practical way to safely update guest OS state that must remain unique (eg encryption keys, unique identifiers, etc) nor update hardware that has unique properties (eg BIOS UUID, NIC mac address, and more), nor deal with things like established network connections Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|