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:
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