VMware Cloud Community
ChristianWehner
VMware Employee
VMware Employee

CloneVm to SDRS Cluster / Storage Pod

Hi there,

we try to change our deployment scripts from old cloneVm to new recommendDatastores. We need this to provision VMs to SDRS Clusters. As documented within API reference, old CloneVm was now replaced by VcStorageResourceManager.recommendDatastores:

http://www.vmware.com/support/orchestrator/doc/vco_vsphere51_api/html/VcStorageResourceManager.html#...

Now we build the following scriptable task:

var myVcVirtualMachineConfigSpec            = new VcVirtualMachineConfigSpec();
var myVcResourceAllocationInfo                = new VcResourceAllocationInfo();
var myVcStoragePlacementSpec                = new VcStoragePlacementSpec();
var myVcStorageDrsPodSelectionSpec            = new VcStorageDrsPodSelectionSpec();
var myVcStorageResourceManager                = input_Datacenter.sdkConnection.storageResourceManager();
var myVcRessourcePool                        = input_RessourcePool;
var myVcVirtualMachineCustomSpec            = input_VirtualMachineCustomSpec;


myVcStorageDrsPodSelectionSpec.storagePod    = input_StoragePod;


myVcVirtualMachineRelocateSpec                = System.getModule("com.vmware.library.vc.vm.spec").getRelocateSpec(null,null,null,myVcRessourcePool,null) ;
myVcVirtualMachineCloneSpec                    = System.getModule("com.vmware.library.vc.vm.spec").getCloneSpec(null,myVcVirtualMachineCustomSpec,myVcRessourcePool,false,false) ;



myVcStoragePlacementSpec.cloneName            = input_VirtualMachineName;
myVcStoragePlacementSpec.cloneSpec            = myVcVirtualMachineCloneSpec;
myVcStoragePlacementSpec.folder                = input_Folder;
myVcStoragePlacementSpec.podSelectionSpec    = myVcStorageDrsPodSelectionSpec;
myVcStoragePlacementSpec.resourcePool        = myVcRessourcePool;
myVcStoragePlacementSpec.type                = VcStoragePlacementSpecPlacementType.clone;
myVcStoragePlacementSpec.vm                    = input_Template;

x = input_Datacenter.sdkConnection.storageResourceManager.recommendDatastores(myVcStoragePlacementSpec);

System.warn("Recommend Result: " + x);
System.warn("recommendations.key: " + x.recommendations.key);
System.warn("recommendations.reason: " + x.recommendations.reason);
System.warn("recommendations.reasontext: " + x.recommendations.reasonText);
System.warn("recommendations.action: " + x.recommendations.action);
System.warn("recommendations.target: " + x.recommendations.target);
System.warn("recommendations.type: " + x.recommendations.type);
System.warn("recommendations.dynamicProperty: " + x.dynamicProperty);

We get no error message and no task is starting. But on displaying all our warnings, they are all undefined without the x which is the correct object:

[2012-10-08 15:04:27.854] [W] Recommend Result: DynamicWrapper (Instance) : [VcStoragePlacementResult]-[class com.vmware.vim.vi4.StoragePlacementResult] -- VALUE : com.vmware.vim.vi4.StoragePlacementResult@6465a5b0
[2012-10-08 15:04:27.854] [W] recommendations.key: undefined
[2012-10-08 15:04:27.854] [W] recommendations.reason: undefined
[2012-10-08 15:04:27.870] [W] recommendations.reasontext: undefined
[2012-10-08 15:04:27.870] [W] recommendations.action: undefined
[2012-10-08 15:04:27.870] [W] recommendations.target: undefined
[2012-10-08 15:04:27.870] [W] recommendations.type: undefined
[2012-10-08 15:04:27.870] [W] recommendations.dynamicProperty: null

Someone ever tried this or has any idea about get this done?

Regards,

Chris

Reply
0 Kudos
26 Replies
JMC13
Contributor
Contributor

wow that makes a lot of sense,  thanks.  

Reply
0 Kudos
JMC13
Contributor
Contributor

So this workflow no longer works after upgrading to VRO 7.0.

Nothing has changed in my code but I know get the following error:

Error in (Workflow:Add or Extend Disk via SDRS / CreatingVcTask (item16)#17) Cannot complete the operation due to an incorrect request to the server.

anyone know why? or how to fix it?

Reply
0 Kudos
dvatov
VMware Employee
VMware Employee

Can you share server.log from your vRO?

Reply
0 Kudos
JMC13
Contributor
Contributor

I verified off of something I exported from onyx and it all seems correct, could it be a bug in 7.0?

2016-02-19 16:02:00.468+0000 [http-nio-0.0.0.0-8281-exec-3] INFO {} [Execution] Executing workflow 'Add or Extend Disk via SDRS'

2016-02-19 16:02:00.477+0000 [org.springframework.jms.listener.DefaultMessageListenerContainer#0-2] INFO {} [Execution] Invoking workflow handler.2c9a44b452f53a470152fa443697007b

2016-02-19 16:02:00.500+0000 [WorkflowExecutorPool-Thread-14] INFO {XXXXXXXXXX:Add or Extend Disk via SDRS:wfid=0be81aff-d2d9-43f0-9f38-cafb0083646d[0be81aff-d2d9-43f0-9f38-cafb0083646d]:token=2c9a44b452f53a470152fa443697007b} [WorkflowHandler] Starting workflow 'Add or Extend Disk via SDRS' (2c9a44b452f53a470152fa443697007b)...

2016-02-19 16:02:00.524+0000 [WorkflowExecutorPool-Thread-14] INFO {XXXXXXXXXX:Add or Extend Disk via SDRS:wfid=0be81aff-d2d9-43f0-9f38-cafb0083646d[0be81aff-d2d9-43f0-9f38-cafb0083646d]:token=2c9a44b452f53a470152fa443697007b} [VimPluginFactory] VimPluginFactory() finished in 17 ms; tokenPrincipal: XXXXXXXXXX; sessionId: 342743c0-f54f-444a-a12f-ef475cfd786a

2016-02-19 16:02:00.862+0000 [WorkflowExecutorPool-Thread-14] WARN {XXXXXXXXXX:Add or Extend Disk via SDRS:wfid=0be81aff-d2d9-43f0-9f38-cafb0083646d[0be81aff-d2d9-43f0-9f38-cafb0083646d]:token=2c9a44b452f53a470152fa443697007b} [VimSession] invokeWebServiceOperation() [XXXXXXXXXX\VMWvCoSvc@https://XXXXXXXXXX:443/sdk/Main#7091613f useIS: false].applyStorageDrsRecommendation_Task --> invocation exception

2016-02-19 16:02:00.865+0000 [WorkflowExecutorPool-Thread-14] WARN {XXXXXXXXXX:Add or Extend Disk via SDRS:wfid=0be81aff-d2d9-43f0-9f38-cafb0083646d[0be81aff-d2d9-43f0-9f38-cafb0083646d]:token=2c9a44b452f53a470152fa443697007b} [VimSession] invokeWebServiceOperation() [XXXXXXXXXX\VMWvCoSvc@https://XXXXXXXXXX:443/sdk/Main#7091613f useIS: false].applyStorageDrsRecommendation_Task --> InvalidRequest : Cannot complete the operation due to an incorrect request to the server.

2016-02-19 16:02:00.868+0000 [WorkflowExecutorPool-Thread-14] WARN {XXXXXXXXXX:Add or Extend Disk via SDRS:wfid=0be81aff-d2d9-43f0-9f38-cafb0083646d[0be81aff-d2d9-43f0-9f38-cafb0083646d]:token=2c9a44b452f53a470152fa443697007b} [WorkflowItemTaskRunner] Script execution error on workflow : Add or Extend Disk via SDRS / 'CreatingVcTask'(item16) : Cannot complete the operation due to an incorrect request to the server. (Workflow:Add or Extend Disk via SDRS / CreatingVcTask (item16)#16)

2016-02-19 16:02:00.909+0000 [WorkflowExecutorPool-Thread-14] INFO {XXXXXXXXXX:Add or Extend Disk via SDRS:wfid=0be81aff-d2d9-43f0-9f38-cafb0083646d[0be81aff-d2d9-43f0-9f38-cafb0083646d]:token=2c9a44b452f53a470152fa443697007b} [WorkflowHandler] End of workflow 'Add or Extend Disk via SDRS' (2c9a44b452f53a470152fa443697007b), state: failed

Reply
0 Kudos
smithkr
Contributor
Contributor

Hi,

This may  or may not be related, but I am using v7 of vRO and I can only clone to a storage cluster using this method, if the source template is in the same cluster.  Is this expected or is anyone else able to clone across all of their clusters using this method.  The error I get suggests that the template cannot be access because the datastore is in another cluster, that the target host has no access to.  This works fine via the web-client so I would expect it to work using the API?

Reply
0 Kudos
sandeep15
Contributor
Contributor

If we are not specifying Host System, does it takes the current host or DRS decides it ??

Reply
0 Kudos
ChristianWehner
VMware Employee
VMware Employee

Yes. HostSystem is optional

Reply
0 Kudos