// directly from VMware resource pool
//
// When we break cluster hosts into individual hosts used in our resource allocator,
// we will have to populate ComputeResourceSummary by ourselves here
//
HostHardwareSummary hardwareSummary = getHostHardwareSummary();
ComputeResourceSummary resourceSummary = new ComputeResourceSummary();
// TODO: not sure how hyper-threading is counted in VMware
short totalCores = (short)(hardwareSummary.getNumCpuCores()*hardwareSummary.getNumCpuPkgs());
resourceSummary.setNumCpuCores(totalCores);
// Note: memory here is in Byte unit
resourceSummary.setTotalMemory(hardwareSummary.getMemorySize());
// Total CPU is based on socket x core x Mhz
int totalCpu = hardwareSummary.getCpuMhz() * totalCores;
resourceSummary.setTotalCpu(totalCpu);
HostListSummaryQuickStats stats = getHostQuickStats();
if(stats.getOverallCpuUsage() == null || stats.getOverallMemoryUsage() == null)
throw new Exception("Unable to get valid overal CPU/Memory usage data, host may be disconnected");
resourceSummary.setEffectiveCpu(totalCpu - stats.getOverallCpuUsage());
// Note effective memory is in MB unit
resourceSummary.setEffectiveMemory(hardwareSummary.getMemorySize()/(1024*1024) - stats.getOverallMemoryUsage());
if(s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - getHyperHostHardwareSummary() done");
return resourceSummary;