VMware Cloud Community
Halukkocaman
Enthusiast
Enthusiast
Jump to solution

VC:VirtualMachine Search

Hi,

i have a workflow that has input of VC:VirtualMchine. On the presentation tab I configure this input with the properties below.

Specify a root object to be shown in the chooser. Root Object is provided from a parameter or attribute - I create an attribute with VC:ResourcePool type and select the resourcepool I want. Than I link the attribute to this property.

pastedImage_6.png

pastedImage_4.png

Select Value as - Tree (this works when I try to select an input for workflow it opens up a window with only the resource pool I defined in the first property.

pastedImage_2.png

If a change the Select value as property to List and search a VM, it searches in whole vCenter not just in the resource pool.

pastedImage_7.png

How can I restrict the VM search for just in that Resourcepool or just in specify cluster?

Thanks,

Haluk

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

There are scripting actions coming out of the box with vCenter plug-in, that return list of VMs in a resource pool or in a cluster.

Check the actions getAllVMsOfResourcePool (under module com.vmware.library.vc.resourcePool) and getAllVMsOfComputeResource (under module com.vmware.library.vc.cluster), respectively for retrieving VMs in a resource pool or in a cluster.

So you only need to bind the value of Predefined list of elements presentation property of your input parameter to the corresponding action. The value should look something like the following:

  GetAction("com.vmware.library.vc.resourcePool","getAllVMsOfResourcePool").call( #att0 )

to filter the machines in a resource pool, or something like the following:

  GetAction("com.vmware.library.vc.cluster","getAllVMsOfComputeResource").call( #att0 )

to filter the machines in a cluster

View solution in original post

7 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Root Object property is taken into account only for tree choosers, and is ignored for list/dropdown choosers.

For these choosers You can use another presentation property, Predefined list of elements, and bind it to a vRO scripting action that will take as an input argument #att0 (the attribute you used in the root object property), and will enumerate and return an array with virtual machines part of this resource pool/cluster.

Halukkocaman
Enthusiast
Enthusiast
Jump to solution

Do you have any example how to archive that?

0 Kudos
Halukkocaman
Enthusiast
Enthusiast
Jump to solution

Nevermind I found an action called getAllVMsOfresource Smiley Happy

0 Kudos
Halukkocaman
Enthusiast
Enthusiast
Jump to solution

So that I found how to create this predefined array, the next question is, how can I populate and present this list before I submit the request?

0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

There are scripting actions coming out of the box with vCenter plug-in, that return list of VMs in a resource pool or in a cluster.

Check the actions getAllVMsOfResourcePool (under module com.vmware.library.vc.resourcePool) and getAllVMsOfComputeResource (under module com.vmware.library.vc.cluster), respectively for retrieving VMs in a resource pool or in a cluster.

So you only need to bind the value of Predefined list of elements presentation property of your input parameter to the corresponding action. The value should look something like the following:

  GetAction("com.vmware.library.vc.resourcePool","getAllVMsOfResourcePool").call( #att0 )

to filter the machines in a resource pool, or something like the following:

  GetAction("com.vmware.library.vc.cluster","getAllVMsOfComputeResource").call( #att0 )

to filter the machines in a cluster

iiliev
VMware Employee
VMware Employee
Jump to solution

You don't need to manually populate this list; you need only to bind this action to the input parameter using presentation property Predefined list of elements, and the action will be invoked automatically when you start the workflow presentation and open object chooser for the workflow input parameter.

Halukkocaman
Enthusiast
Enthusiast
Jump to solution

So this worked great on the vRO. How can do this in vRA? when I select Entity type of VC:VirtualMachine  and field type search for the form field, it automatically defaults to all VMs. When I select the List instead of search it gives the correct list but there is no search available.

0 Kudos