VMware Cloud Community
iancollins
Contributor
Contributor
Jump to solution

getting VC:Host details from VcHostHardwareSummary

Hi,

I need to create a vRO workflow that produces teh total number of CPU cores in a cluster.  I can see that VcHostHardwareSummary provides numCpuCores for a host, but i have no idea how to use this in a Scriptable Task in a workflow.

Can anyone point me in ht eright directon or provide an example of how to use it please?

Thanks

Ian...

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi Ian,

Check the following script. Its input is the variable cluster of type VC:ClusterComputeResource

var numCores = 0;

for each (var host in cluster.host) {

  numCores += host.hardware.cpuInfo.numCpuCores;

}

System.log("Total number of cpu cores on hosts in the cluster: " + numCores);

Another option, if you want to retrieve this info from HostHardwareSummary instead of HostHardwareInfo, the line 3 in the script above can be replaced with the following:

numCores += host.summary.hardware.numCpuCores;

View solution in original post

0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi Ian,

Check the following script. Its input is the variable cluster of type VC:ClusterComputeResource

var numCores = 0;

for each (var host in cluster.host) {

  numCores += host.hardware.cpuInfo.numCpuCores;

}

System.log("Total number of cpu cores on hosts in the cluster: " + numCores);

Another option, if you want to retrieve this info from HostHardwareSummary instead of HostHardwareInfo, the line 3 in the script above can be replaced with the following:

numCores += host.summary.hardware.numCpuCores;

0 Kudos
iancollins
Contributor
Contributor
Jump to solution

Thanks Ilian, that is just what i was looking for

Ian..

0 Kudos