[pve-devel] RFC: vm cloning implementation proposal

Alexandre DERUMIER aderumier at odiso.com
Wed Oct 3 06:09:19 CEST 2012


Hi,
Now that we have vm snapshots, I would like to work on vm cloning in the coming weeks (for proxmox 2.3 as 2.2 will be release soon).


Vm cloning is instant duplicate vm config and disk (qm clone sourcevmid targetvmid).



2 types Storage which support cloning:

1)-sheepdog,rbd (>=0.52),nexenta : 
   - the clone is made from a snapshot
   - can be done when sourcevm is online
   - we can use source vm after cloning
   - we can't delete a snapshot if a clone is made from the snapshot
   - we can't delete the sourcevm is clone exist

2)-raw,qcow2 :
it's a little different,we don't clone from a snapshot, but from a whole base file.

 "qemu-img create -b base-linux.raw -f qcow2 clone.qcow2"
or
"qemu-img create -b base-linux.qcow -f qcow2 clone.qcow2"

   - the clone is made from a base file
   - The source vm must be offline.
   - we can't use source vm after cloning, the base file must be readonly!!!
     So we need to implement some protection, forbid to start or modify it.
   - we can't delete the sourcevm if clone exist
   - migration : both base and clone must be accesible from the guest.
       If storage is not shared, we need to forbid migration of a vm with clones or cloned.
       (or find a way to sync and maintain the base image to each node)


Clone of clone of clone.... is also possible, do we wan't to implement that (performance?) ?



We need to add a way to keep relationship between sourcevm and cloned vm.


Here a proposal

On the sourcevm,
add a field

clones: vmid1,vmid2,vmdid3,...

in the snapshot config section(rbd,sheepdog,nexenta) or main config (qcow2,raw).


on the targetvm:

clonesource: vmidsource




What do you think about it?

Regards,

Alexandre



More information about the pve-devel mailing list