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...
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;
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;
Thanks Ilian, that is just what i was looking for
Ian..