First get the SR
object
sr_ref = self.session.xenapi.SR.get_by_uuid(local_storage_uuid)
Then get the template
object which you want to clone
template = self.session.xenapi.VM.get_by_uuid(template_uuid)
Suggest a name for the VM that would be cloned
vm_id = "Test_Cone_VM"
Now If your template repo
and the cloned VM repo
is same then use Async.VM.clone
. And if the repos are different then use Async.VM.copy
self.session.xenapi.Async.VM.copy(template, vm_id, sr_ref)
or
self.session.xenapi.Async.VM.clone(template, vm_id)
Have a look at the Xenserver API for more info.