VMware {code} Community
Anandraj
Contributor
Contributor

CloneVM_Task throws error "The request refers to an unexpected or unknown type."

Hi,

I trying to Clone a VM, It works perfect when i specify host managed object Reference(MOR) in VirtualMachineRelocateSpec.

http://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.vm.RelocateSpec.html

When i try with Cluster managed object Reference (MOR) I'm getting this error "The request refers to an unexpected or unknown type."

   // Get clone specifications

  VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();

     relocSpec.datastore = targetDataStore;

     relocSpec.pool = resourcePoolRootRef;

// assgining cluster compute resource pool...

relocSpec.host = hostParentCompResRef;

If i change it to Host it works fine...

relocSpec.host = hostRef;

I don't want to specify particular host, the Cluster is DRS enabled ....

Still I get this error can anyone help...

Anand.

0 Kudos
3 Replies
robertleewhite
Contributor
Contributor

Anand, did you have any luck solving this? I know this was a long time ago...

I believe the way to clone to a cluster is to use the StorageResourceManager.RecommendDatastores(), however I'm getting the same error you're getting, so I'm not much closer. Smiley Sad

BTW, for anyone who is confused by this, a datastore cluster is called a "StoragePod" in the .NET API.

-Robert

0 Kudos
lamw
Community Manager
Community Manager

@robertleewhite,

The issue mentioned on this thread is slightly different than a datastore cluster, at least the way I read it, it's regarding a regulard DRS enabled cluster.

Per the API documentation - http://pubs.vmware.com/vsphere-50/index.jsp?topic=/com.vmware.wssdk.apiref.doc_50/vim.vm.RelocateSpe... You need to get a reference to the Cluster and it's resourcePool http://pubs.vmware.com/vsphere-50/index.jsp?topic=/com.vmware.wssdk.apiref.doc_50/vim.ComputeResourc...

For creating/cloning VMs to a datastoreCluster, instead of using CreateVM_Task() you need to use the new RecommendDatastores() as you have mentioned. The parameters are mostly the same from CreateVM_Task() with the exception of the storagePod (datastoreCluster object).

BTW - StoragePod is not just in the .NET SDK, it's in the vSphere API. If you are interested in the vSphere 5 object model, be sure to check out this blog post http://blogs.vmware.com/vsphere/2012/02/introduction-to-the-vsphere-api-part-2-object-model.html

0 Kudos
srajsenthil
Contributor
Contributor

Hi Anandraj, could you solve your issue? I am also trying to use the cluster instead of a specific host and getting the same error?

Please share.

0 Kudos