Skip to content

Instantly share code, notes, and snippets.

@YagmurOzden
Created December 24, 2021 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YagmurOzden/1acee12f1ecb696599da4dc60e77e42f to your computer and use it in GitHub Desktop.
Save YagmurOzden/1acee12f1ecb696599da4dc60e77e42f to your computer and use it in GitHub Desktop.
get the datastore connected to the relevant cluster (VMware vRO action, vSphere, resourcepool)
// VMware vRealize Orchestrator action sample
// vRA 8.4
//action input type: cluster (string)
//action return type: VC:ResourcePool (array)
// this code below gets all clusters
var clusters =VcPlugin.getAllClusterComputeResources();
var rPool=Array();
System.log("get cluster's resource pool action started")
//this loop is to check all clusters
for (var i in clusters){
System.log(i+"- "+clusters[i].name+" = "+cluster);
//this condision helps us select cluster
if (cluster==clusters[i].name.toString()){
//and this is for datastores
rPool.push (clusters[i].resourcePool)
System.log("resource pool appointed: "+clusters[i].resourcePool)
}
}
System.log("get cluster's resource pool action over")
return rPool;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment