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