Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

get datacenter of vm

$
0
0

Given a a uuid of a vm, is there an easy way to find its datacenter?

 

I managed to figure out this piece of code seems to do the trick but it seems rather circular (find all datacenters then look through each one, filtering by itself, looking for the vm?) Is this the way to do it or is there something better?

 

var dcs=VcPlugin.getAllDatacenters();

for each (dc in dcs)

{

    temp = dc.sdkConnection.searchIndex.findAllByUuid(dc, vmUuid, true);

    if (temp == null)

        System.log("not found");

    else

        System.log("found vm in dc: "+dc.name);

 

}


Viewing all articles
Browse latest Browse all 6251

Trending Articles



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