[pve-devel] RFC: vm cloning implementation proposal

Alexandre DERUMIER aderumier at odiso.com
Thu Oct 4 10:55:12 CEST 2012


>>We need to define the terms we use: 
>>
>>a.) live-snapshot (qemu-server snapshot, saved inside VM configuration) 
>>b.) volume snapshot (storage internal snapshot of a volume) 
>>
>>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.




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

}



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
net0:...
clones: vmid,vmid,vmid,....



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

}


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

}




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)



what do you think ?



----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre DERUMIER" <aderumier at odiso.com> 
Cc: pve-devel at pve.proxmox.com 
Envoyé: Jeudi 4 Octobre 2012 10:20:19 
Objet: RE: [pve-devel] RFC: vm cloning implementation proposal 

> could you give an example for sheepdog,rbd? (as we need a snapshot of the 
> disk) What happen to the original vm when you create the template ? 
> 
> Does it create a snapshot of the disks, and snapshot name(on the storage) is 
> the template name ? 

We need to define the terms we use: 

a.) live-snapshot (qemu-server snapshot, saved inside VM configuration) 
b.) volume snapshot (storage internal snapshot of a volume) 

When you create a template, you only need to create a volume snapshot. 

Is that more clear now? 



More information about the pve-devel mailing list