Take a look at the host property of VirtualMachineRelocateSpec. It discusses the conditions around clusters vs host.
Just to be sure, you are calling the script against vCenter and not a standalone ESXi host, right? Standalone ESXi host SDK endpoints don't support cloning, it's a vCenter SDK thing. That would be my first guess at the problem based on the NotSupported error.
Thank you for the hints.
Yes, I am calling against the vCenter API and not separate ESXi hosts.
The property looks interesting, especially seeing the script uses it: my $location = VirtualMachineRelocateSpec->new();
I am not sure however what to specify there for the host, it seems to take an object reference, and I am not certain I even need one, and what the different options for it mean:
The target host for the virtual machine. If not specified,
- if resource pool is not specified, current host is used.
- if resource pool is specified, and the target pool represents a stand-alone host, the host is used.
- if resource pool is specified, and the target pool represents a DRS-enabled cluster, a host selected by DRS is used.
- if resource pool is specified and the target pool represents a cluster without DRS enabled, an InvalidArgument exception be thrown.
Keep in mind please, I am not a VMware certified admin, I am the programmer trying to automate what the admin can do in GUI
I will ask tomorrow at work, if any of those things make sense to him as required for DataStoreCluster cloning.
But if it is not? how is the scripts supposed to work? if by default it takes an empty VirtualMachineRelocateSpec object?
Does it work for you?
It's the NotSupported error that's interesting. Can you clone the VM manually (via UI) to the same location?
The admin says that yes, otherwise we would be working on fixing that before doing it via API.
EDIT: by the "same location", I suppose you mean clone to a DataStoreCluster? if so yes.
Hi Everyone ,
Myself also faced the same error while cloning using perl sdk. please check the follows
1). Try to apply stotage DRS recommendations.
2). Please check /change the vmfolder permission/param
Finally clone got created successfully.