How to create multiple clones of a VM in KVM/libvirt

cloningkvm-virtualizationlibvirt

I (will) have a VM in libvirt (using QEMU/KVM) that I will set up and consider the "gold master". I would then like to be able to clone it 'n' times to create multiple systems. What is the best way to do this, and how best to "individualize" the cloned systems after they are instantiated? The hypervisor platform is:

OS: Ubuntu 12.04.2

Hypervisor pkg: qemu-kvm 1.0+noroms-0ubuntu14.8

Libvirt: 1.0.4 (compiled from source)

I am managing the VMs from another system (Fedora 18 OS) using virt-manager 0.9.5

I know I can shut down the VM and then use virt-manager's "Clone…" function, but am wondering if there is a better way (especially if I could do multiple clones at once, not sure if that's possible or not…)

Best Answer

To massively clone (baseline or even customized) installations I would say that the best method is to set up a PXE+TFTP server and provide a preseed/kickstart file.

Add your config management tool of choice (puppet/chef/cfengine/other) to the mix and you will have a powerful framework to deploy as many clones as you need. Moreover, add local mirrored repositories to increase speed.

The upper limit for simultaneously deployed clones will be the ethernet and I/O throughput you can sustain.