Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 144140

Re: Creating custom workflow for deployment - NEED HELP

$
0
0

Hi rubberduck70,

 

in the link I posted you find the action we use to deploy VMs on SDRS cluster:

VC:Task myDeploymentAction (VC:StoragePod StoragePod, VC:VirtualMachine Template, string VirtualMachineName, VC:VmFolder VmFolder, VC:ResourcePool ResourcePool, Any VirtualMachineCloneSpec, VC:HostSystem HostSystem[optional], Array/Any initialVmConfig[optional])


var storageSpec                    = new VcStoragePlacementSpec();
var podSelectionSpec            = new VcStorageDrsPodSelectionSpec();
var location                    = new VcVirtualMachineRelocateSpec();
var myVcStoragePlacementResult    = VcStoragePlacementResult();
var managedObject                = Template.sdkConnection.storageResourceManager;
var myKey                        = new Array();
if ( initialVmConfig[0].storagePod == null )
{    initialVmConfig[0] = new VcVmPodConfigForPlacement();    initialVmConfig[0].storagePod = StoragePod;
}
podSelectionSpec.storagePod = StoragePod;
podSelectionSpec.initialVmConfig = initialVmConfig;
location.pool = ResourcePool;
storageSpec.type = "clone";
storageSpec.vm = Template;
storageSpec.podSelectionSpec = podSelectionSpec;
storageSpec.cloneSpec = VirtualMachineCloneSpec;
storageSpec.cloneName = VirtualMachineName;
storageSpec.folder = VmFolder;
if ( HostSystem != null )
{    storageSpec.host = HostSystem;
}
myVcStoragePlacementResult = managedObject.recommendDatastores(storageSpec);  // StorageResourceManager
myKey[0] = myVcStoragePlacementResult.recommendations[0].key
myVcTask = managedObject.applyStorageDrsRecommendation_Task(myKey);
return myVcTask;

This action needs the following inputs:

VC:StoragePod StoragePod - the SDRS cluster you want to deploy to

VC:VirtualMachine Template - the VM object of the template you want to clone

string VirtualMachineName - the name of the new VM

VC:VmFolder VmFolder - the folder you want to deploy to

VC:ResourcePool ResourcePool - the resource pool of a cluster, a host resource or a cluster resource you want to deploy to

Any VirtualMachineCloneSpec - the VM clone specification with information's about memory size, vCPUs and so on

VC:HostSystem HostSystem - Optional!! You don't need a hostsystem here. This action will deploy on one of the hosts he can associate with the ResourcePool

Array/Any initialVmConfig - Optional!! First item of the Array could be a VcStoragePodSelectionSpec


Hope this helps and regards,

Chris



Viewing all articles
Browse latest Browse all 144140

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>