1 person found this helpful
I'm not sure that I correctly understand the question, but still...
Most of the actions in module "com.vmware.library.vc.vm" accepts as inputs some vCenter entity (virtual machine, host, etc.) and thus one can say they work only in the 'context' of this object.
There is a couple of actions - getAllVMs() and getAllVMsMatchingRegexp() - which work globally across all registered vCenter servers. If you look at the code of these 2 actions, you'll see they use calls like VcPlugin.getAllVirtualMachines(), and such call will enumerate all virtual machines on all connections.
To limit these actions to a single connection, you can duplicate them, add the connection you want they to operate on as an input parameter to the action, and then replace calls like VcPlugin.getAllVirtualMachines() with something like vcDdv.getAllVirtualMachines() (assuming vcDdv is the name of the action parameter specifying the connection, of type VcSdkConnection).
I might misunderstood you here, but you cannot specify a vCenter to run "myAction" on. This is run on the vRO server.
But I presume you have some code inside "myAction" who you want to run on a spesific vCenter.
vcDdv = VcPlugin.allSdkConnections - will only run on the first vCenter found.
There is an action from vmware called com.vmware.library.vcac.findVcConnectionById, who will return the spesific vCenter connection.
However, I would suggest you stay away from all the builtin "VcPlugin" features. They crashes if a vCenter is down (even if you search for another vCenter). So if you have multiple vCenters, and one is down. Your workflows will not run.
Here is a piece of code I use as my replacement action:
[INPUT]uuid as string
[OUTPUT] VC:SdkConnection (or null if not found)
var sdkConnections = VcPlugin.allSdkConnections;
for each (var sdkConnection in sdkConnections)
var uuid = sdkConnection.aboutInfo.instanceUuid;
if (uuid == instanceUUID)
System.warn ("vCenter ("+sdkConnection.name+") might be down? (skipped) : "+exception);
System.warn("vCenter was not found with ID: "+instanceUUID);