Hello Community,
I would like to instantiate clusters without getting them from "VcPlugin.getAllClusterComputeResources" because I already know their names.
What are the few code lines to achieve this? Thanks a million in advance
Fred
So you want to get cluster(s) by name.
One trivial way is to fetch all clusters by a call to vCenter.getAllClusterComputeResources(), then iterate over the returned list and filter out those that match your name.
The other way is to utilize vCenter property collector. Take a look at the workflow Get virtual machines by name with PC available under Library > vCenter > Property collector. It does similar to what you ant, but searches for virtual machines, so you can duplicate this workflow and modify it to search for clusters.
The required changes are:
1) you don't need the input parameter rootVmFolder so you can remove it (and update binding, eg. by pressing Validate button and binding the input to NULL)
2) the output vms is of type Array/VC:VirtualMachine; you need to change the type to Array/VC:ClusterComputeResources
How about
Server.findAllForType("VC:ClusterComputeResource", "MyCluster")[0]
(if your cluster names are unique)