[Libvir] [PATCH][RFC] Adding Cloning Feature

Kazuki Mizushima mizushima.kazuk at jp.fujitsu.com
Wed Apr 25 08:27:47 UTC 2007

Hi Dan,

Thank you for comment and useful suggestion.

> While this works ok in simple cases, I'm not sure it neccessarily scales
> upto handle the more complex cases easily enough. With this prototype the
> user only has the option of specifying new device names. Conceivably the
> user could want to specify a whole lot more 'new' parameters - eg change
> the VNC port if it was not previously auto-allocated, specify a new MAC
> address (for any/all NICs), specify a UUID, etc. 

Cloning I defined aims at creating a just duplication as it except 
informations that must not overlap as a virtual machine.
But I wanto to specify the more 'new' parameters(name, mac ..) for next.

Thank you for below suggestion. 
Because I want to add  'new' parameters for next,  It is goot way for also me. 
I agree.  I try to propose for this feature for virt-install et-mgmt-tools at redhat.com. 

> I think cloning should be kept separate from the main libvirt API because
> there are simply too many different ways to approach it, depending on your
> application use-cases. The way I like to look at it, is that we've just got
> several different ways to 'install' a guest
>  1. Traditional installation media (eg CDROM, HTTP kickstart)
>  2. Boot a LiveCD which can install itself to disk
>  3. Create from a VM 'template', possibly cloning some base disk
>  4. Cloning an existing provisioned VM
> Now virt-install currently deals with the first option, and there is some
> work going on to experiment with making it do options 2 & 3 too. So I think
> that it'd be worth trying to add some form of cloning capability to virt-install
> too.
> Thinking how it might work..
> Currently to install from HTTP you might do
>   virt-install
>      --name myvm
>      --ram 500
>      --mac 54:24:52:23:55:43
>      --vnc
>      --vncunused
>      --url  http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/
>      --filesize 5
>      --file /var/lib/xen/images/myvm.img
> So, how might it work with cloning ? Basically install of the --url arg to point
> to an install source, we'd allow  '--clone VMNAME' to point to an existing virtual
> machine. The main config would be determined by the settings of that VM, with the
> command line args being used to override specific bits. As a bare minimum
> example one would do
>   virt-install
>      --name othervm
>      --clone myvm
>      --file /var/lib/xen/images/othervm.img
> But for a more complex case one could use all the various args
>  virt-install
>     --name othervm
>     --clone myvm
>     --uuid 2452:ef23:ee3e:2232:442424252525ffe
>     --vncport 5902
>     --mac 42:55:23:66:23:44
>     --file /var/lib/xen/images/myvm.img
>     --file /var/lib/xen/images/myvmdata.img
> Now without prototyping it, I'm not sure how much code re-use we'd get within
> virt-install, so it may turn out that it is simpler to just have a separate
> tool called  virt-clone for this purpose. In either case I reckon we could
> distribute this as part of the main  virtinst codebase, so it is still easy 
> for us to access the functionality from virt-manager.

Kazuki Mizushima

More information about the libvir-list mailing list