VMware Cloud Community
TimDScott
Enthusiast
Enthusiast

VcPlugin.getAllVirtualMachines - Performance (vRO 7.5/7.6)

I'm using the following code to grab a VC:VirtualMachine using its instanceId:

VcPlugin.getAllVirtualMachines(null, "xpath:instanceId[matches(.,'"+vmInstanceUuid+"')]");

It's being used indirectly to build a drop-down list for use in a workflow presentation layer. I'm guessing this call will be relatively quick, but does anyone have any examples of how long it can take on a large environment with large numbers of vcenters / VM's?

0 Kudos
1 Reply
stevedrummond
Hot Shot
Hot Shot

There is already an OOTB action to do this: findVcVmByUuid. You could hopefully presume they've implemented the fastest method of retrieving a VM.

Alternatively if you have the MoRef you can use something like

const vm = Server.findForType('VC:VirtualMachine', System.getObjectId(sdkConnection) + '/' + moRef);

which will directly return the machine from the plugin (which is potentially cached).

0 Kudos