[pve-devel] RFC: vm cloning implementation proposal

Dietmar Maurer dietmar at proxmox.com
Thu Oct 4 11:10:19 CEST 2012


> >>When you create a template, you only need to create a volume snapshot.
> >>
> >>Is that more clear now?
> 
> Yes,ok. So snapshot tabs on vm only display live-snapshots, and not all
> volume snapshots.

yes.
 
> For implementation, that give us something like this (oversimplified): ?
> 
> 
> create_template($vmid){
> 
> generate $templateid
> 
> for all disk{
>   volume_snasphot(snapname=$templateid) if storage support clone
> (rbd,sheepdog,nexenta)
>   copy disk files to template storage if storage nfs,dir.
> }
> 
> copy $vmid config to $templateid + update disk config
> 
> }

Yes. Maybe we let user choose 'templateid' 

> template config sample:
> ------------------------
> bootdisk: virtio0
> cores: 1
> memory: 512
> name: templatename
> ostype: l26
> sockets: 1
> virtio0: dir,nfs:templates/$templateid-disk-1
> virtio0: sheepdog,rbd,nexenta:vm-$vmid-disk-1@$templateid

we need to find a good template naming schema.

> net0:...
> clones: vmid,vmid,vmid,....

not sure if we need to track that here.

> clone_template($templateid){
> 
> generate a $newvmid
> 
> for all disk{
>   volume_clone(volume,$newvmid)
> 
> }
> 
> -copy $templateid config to $newvmid
> -generate new mac address for network card
> 
> }

yes

> 
> copy_template($templateid){
> 
> generate a $newvmid
> 
> for all disk{
>   volume_copy(volume,$newvmid,targetstorage)
> 
> }
> 
> -copy $templateid config to $newvmid
> -generate new mac address for network card
> 
> }

What is that (we talked about 'Copy VM', not 'Copy Template')? 

> Also,where do we need to keep relationship between:
> 
> - originalvm -> template ?    (we can't delete the originalvm is a template is
> made from it (sheepdog,rbd,nexenta)

why not (we have a snaphot)? - those drivers do not allow that?



More information about the pve-devel mailing list