[libvirt] How to clone a domain using Java API?

Couldn't find any Java API or even any function in libvirt documentation: http://libvirt.org/html/libvirt-libvirt.html In case there is no API present can someone please point how this can be achieved using existing Java APIs to get the same behavior as virt-clone? Thanks, -Ganesh

On Thu, Jul 08, 2010 at 05:37:21PM +0530, Ganesh Pagade wrote:
Couldn't find any Java API or even any function in libvirt documentation: http://libvirt.org/html/libvirt-libvirt.html In case there is no API present can someone please point how this can be achieved using existing Java APIs to get the same behavior as virt-clone?
There's no libvirt function to clone VMs, but there are some tools around. virt-clone can make an identical copy, adjusting the libvirt configuration. virt-resize can resize an existing VM, which you could also use for copying. 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

On 07/08/2010 11:35 PM, Richard W.M. Jones wrote:
On Thu, Jul 08, 2010 at 05:37:21PM +0530, Ganesh Pagade wrote:
Couldn't find any Java API or even any function in libvirt documentation: http://libvirt.org/html/libvirt-libvirt.html In case there is no API present can someone please point how this can be achieved using existing Java APIs to get the same behavior as virt-clone?
There's no libvirt function to clone VMs, but there are some tools around.
virt-clone can make an identical copy, adjusting the libvirt configuration.
virt-resize can resize an existing VM, which you could also use for copying.
In theory, you should also be able to create a new snapshot volume, using the original as a backing store. This should be very fast to create, and only stores changed blocks in the new volume. With the newly created volume in hand, you could then dump the XML of an existing guest, change the name/uuid/volume, and then use this new changed XML to create your cloned guest. Might be more effort than you want to go to however, but the benefit should be that its *very* quick to create clones. Regards and best wishes, Justin Clift
Rich.
-- Salasaga - Open Source eLearning IDE http://www.salasaga.org
participants (3)
-
Ganesh Pagade
-
Justin Clift
-
Richard W.M. Jones