Get the Cluster of a vCenter VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// VMware vRealize Orchestrator action sample | |
// | |
// Returns the cluster of a given vCenter VM | |
// | |
// For vRO 7.0+/vCenter 6.0+ | |
// | |
// Action Inputs: | |
// vm - VC:VirtualMachine - vCenter VM | |
// | |
// Return type: VC:ClusterComputeResoure - the cluster to which the VM belongs | |
var parent = vm.runtime.host; | |
while (parent !== null && ! (parent instanceof VcClusterComputeResource)) { | |
parent = parent.parent; | |
} | |
System.log("VcClusterComputeResource of VM: " + parent.name); | |
return parent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment