Le 18. 02. 11 14:11, Matthias Bolte a écrit :
2011/2/18 Cédric Penas <cedric penas hesge ch>:Hi, I am currently working on a project where I must develop a function to clone domain for the driver ESX. I immediately saw that the function cloneVM_Task () from VMware API was not supported for standalone ESX.Do you mean that the ESX driver doesn't use CloneVM_Task() or that the ESX server returns an NotImplemented fault for a call to CloneVM_Task()?
I tried to use CloneVM_Task() but the ESX server returns the following error:
It seems that we should have "vCenter" to use this function.
Does anyone know the best way to still implement this function or a workaround ? Why is it not already implemented ?It's not implemented in libvirt, because libvirt doesn't have a virDomainClone() function, so there is no way for the ESX driver to use CloneVM_Task(). The virt-clone tool uses several libvirt functions to perform a clone operation. The basics steps are: - get the domain XML description of the domain to clone - determine the storage volumes to clone - issue a virStorageVolCreateXMLFrom() for each storage volume to be cloned - update the storage volume references in the domain XML description; remove the uuid and mac addresses to get new ones - define a new domain from the edited domain XML description You should be able to implement a clone operation for ESX on top of libvirt without the need to change libvirt. Or try to use virt-clone for ESX. IIRC virt-clone currently doesn't handle the VMware path format properly so it might need some tweaks. Matthias
Yes I know this is not implemented and that is what I would to do.
Now, I created a function virDomainClone () in Libvirt and I have implemented the function only for ESX driver. This function creates a new directory, copies the virtualdisk of the source domain in this new directory and creates the VM cloned from this virtualdisk.
Your proposal seems better but what is the difference ? Would you have a link to documentations about the XML description because I've never used it.
Sorry if my questions are stupids and thank you for your answers;)