dcoulter
Enthusiast
Enthusiast

Identify a vCenter instanceUuid for a vCloud VIM object

Jump to solution

Hello, I'm trying to figure out the best way to get the vCenter UUID for a vCloud VIM object (in my case a resource pool for which I have the MoRef) in order to identify the corresponding vCenter object.   I want to use a given resource pool reference (backing a pvDC) to find the actual resource pool object in vCenter, out of many vCenters registered to vCO/vCD since the MoRef isn't unique between vCenters.  There is an article by William Lam (http://blogs.vmware.com/vsphere/2012/02/uniquely-identifying-virtual-machines-in-vsphere-and-vcloud-...) which describes the relationships, however an example of resolving this with vCO would be appreciated.

0 Kudos
1 Solution

Accepted Solutions
Burke-
VMware Employee
VMware Employee

The following should return the UUID of your vCenter Server assuming the input object is a vCloud:ProviderVdc object named "providerVdc"

var vcdHost = providerVdc.getHost();
var pool = providerVdc.toAdminExtensionObject().getResourcePools()[0]; // get the first resource pool (VclVMWProviderVdcResourcePool)
var vimObjectRef = pool.resourcePoolVimObjectRef;
var vimServer = vcdHost.getEntityByReference(VclFinderType.VIM_SERVER,vimObjectRef.vimServerRef);
System.log("VimServer uuid: "+vimServer.uuid);

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter

View solution in original post

0 Kudos
1 Reply
Burke-
VMware Employee
VMware Employee

The following should return the UUID of your vCenter Server assuming the input object is a vCloud:ProviderVdc object named "providerVdc"

var vcdHost = providerVdc.getHost();
var pool = providerVdc.toAdminExtensionObject().getResourcePools()[0]; // get the first resource pool (VclVMWProviderVdcResourcePool)
var vimObjectRef = pool.resourcePoolVimObjectRef;
var vimServer = vcdHost.getEntityByReference(VclFinderType.VIM_SERVER,vimObjectRef.vimServerRef);
System.log("VimServer uuid: "+vimServer.uuid);

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos