Hello everybody, I'm currently trying to write a scriptable task which creates an empty VM, which should be placed in a storagePod aka datastore cluster. I played around a lot and I'm not r...
See more...
Hello everybody, I'm currently trying to write a scriptable task which creates an empty VM, which should be placed in a storagePod aka datastore cluster. I played around a lot and I'm not really able to achieve the result which I want to achieve due to the fact that I have a problem with initial placement of the VM files using VcVirtualMachineFileInfo. var files = new VcVirtualMachineFileInfo(); files.vmPathName = " "; According to https://www.vmware.com/support/orchestrator/doc/vro-vsphere60-api/html/VcStorageResourceManager.html#recommendDatastores this should work as it says: For CreateVm and AddDisk, the manually selected datastore must be specified in ConfigSpec.files or ConfigSpec.deviceChange.device.backing.datastore, the fields should will be unset if the user wants SDRS to recommend the datastore. Looking at https://github.com/lamw/vghetto-scripts/blob/master/perl/datastoreClusterVMProvisioning.pl this also gives the impression that this should work as William uses files => VirtualMachineFileInfo->new( vmPathName => "" ) When I try to use files.vmPathName = " "; I receive an error, which looks as follows DynamicWrapper (Instance) : [VcVirtualMachineFileInfo]-[class com.vmware.o11n.plugin.vsphere_gen.FileInfo_2Wrapper] -- VALUE : (vim.vm.FileInfo) { dynamicType = null, dynamicProperty = null, vmPathName = , snapshotDirectory = null, suspendDirectory = null, logDirectory = null, ftMetadataDirectory = null } Workflow execution stack: item: 'Create VM - SP/item4', state: 'failed', business state: 'Create the VM', exception: 'Task 'createVm' error: Invalid datastore path ' '. (Dynamic Script Module name : vim3WaitTaskEnd#20)' workflow: 'Create VM - SP' (85860245-6211-435a-b23b-2b50f205dde1) At the moment I'm only able to create the empty VM by using var files = new VcVirtualMachineFileInfo(); files.vmPathName = "[" + vmStoragePod.childEntity[0].info.name + "]"; where vmStoragePod is the storagePod I've selected for the deployment. Would be nice if somebody can bring me on the right track which lets me pick files.vmPathName = " "; Thank you very much, Lars