jvm2016
Hot Shot
Hot Shot

Finding vcpu count of each vm in vcenter using foreach schema element_vRO

Hi All,

Good morning ,

could  you please check the folowing workflow which has been created to find vcpucount of each vm in vcenter .

for somereasons iam not able to set iterator in foreach schema element as i dont see option for setupwizrad.

following has been done .

1:

pastedImage_0.png

2:visual bindings of getAllVMs action element :

pastedImage_1.png

3:  in tab and visual bindings of foreach schema element:

pastedImage_2.png

pastedImage_3.png

0 Kudos
7 Replies
iiliev
VMware Employee
VMware Employee

Hi,

When you added foreach element to the schema, what workflow did you choose? Does this workflow have an input parameter of type VC:VirtualMachine (the same as the type of elements in array you want to iterate)?

0 Kudos
jvm2016
Hot Shot
Hot Shot

Hi llian,

i chose vcpuCount as mentioned in first screen shot .

it does not have  input parameter however output from getallvms action have been passed to it using attribute "vmNames".as shown in seconddiagram.

0 Kudos
iiliev
VMware Employee
VMware Employee

Foreach doesn't work this way.

When it starts to iterate over the array output of getAllVMs action and calls the bound workflow for each iterated VM, how the workflow execution will get the current element being iterated? With an input parameter of the same type, the current iterated element will be passed to this input.

0 Kudos
jvm2016
Hot Shot
Hot Shot

its very strange that iam not able to search that workflow.if yu have any lab environemtcan yu send me the screen shot of foreach element for numofvcpus.

0 Kudos
iiliev
VMware Employee
VMware Employee

Sorry, which workflow you cannot search for? I don't think there is out-of-the-box workflow having input of type VC:VirtualMachine that retrieves vcpu count; you need to write it yourself.

0 Kudos
jvm2016
Hot Shot
Hot Shot

sorry,

i mean to say earlier i was able to search vcpucountin foreach schema element but for some reasons now iam not able to .

another thing is that this requirement can be met if we write few lines of java script code in scriptable task but i want to check what is already avaiable and want to use different schema elemetns

and action .

0 Kudos
jvm2016
Hot Shot
Hot Shot

i wish communities have option to remotelogin or voice chat .that will be more helpful .

0 Kudos