[libvirt-users] Clone VM

Cole Robinson crobinso at redhat.com
Mon Jan 16 13:06:59 UTC 2012


On 01/16/2012 04:44 AM, Boris Tobotras wrote:
>     Greets,
> 
>     I've began to try libvirt API and looking for most correct way to clone
> existing VM (Xen server if it matters).
> 
>     Since API lacks this functionality how does one usually go about it?
> Thanks in advance,

There isn't a single 'clone' api. You would basically need to copy the guests
underlying storage using something like virStorageVolCreateXMLFrom, and define
a new guest based on an edited version of the original domain XML. You can
check out the virt-clone tool for an example:

http://git.fedorahosted.org/git/?p=python-virtinst.git;a=blob_plain;f=virt-clone;hb=HEAD

And that is only the superficial duplication from outside the VM, no changes
are done to the guest OS.






More information about the libvirt-users mailing list