use of com.vmware.vim25.HostHardwareSummary in project CloudStack-archive by CloudStack-extras.
the class HostMO method getHostHardwareSummary.
public HostHardwareSummary getHostHardwareSummary() throws Exception {
HostConnectInfo hostInfo = _context.getService().queryHostConnectionInfo(_mor);
HostHardwareSummary hardwareSummary = hostInfo.getHost().getHardware();
return hardwareSummary;
}
use of com.vmware.vim25.HostHardwareSummary in project cloudstack by apache.
the class ClusterMO method getHyperHostResourceSummary.
@Override
public VmwareHypervisorHostResourceSummary getHyperHostResourceSummary() throws Exception {
if (s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - getHyperHostResourceSummary(). target MOR: " + _mor.getValue());
VmwareHypervisorHostResourceSummary summary = new VmwareHypervisorHostResourceSummary();
ComputeResourceSummary vmwareSummary = (ComputeResourceSummary) _context.getVimClient().getDynamicProperty(_mor, "summary");
// TODO, need to use traversal to optimize retrieve of
int cpuNumInCpuThreads = 1;
List<ManagedObjectReference> hosts = _context.getVimClient().getDynamicProperty(_mor, "host");
if (hosts != null && hosts.size() > 0) {
for (ManagedObjectReference morHost : hosts) {
HostMO hostMo = new HostMO(_context, morHost);
HostHardwareSummary hardwareSummary = hostMo.getHostHardwareSummary();
if (hardwareSummary.getNumCpuCores() * hardwareSummary.getNumCpuThreads() > cpuNumInCpuThreads)
cpuNumInCpuThreads = hardwareSummary.getNumCpuCores() * hardwareSummary.getNumCpuThreads();
}
}
summary.setCpuCount(cpuNumInCpuThreads);
summary.setCpuSpeed(vmwareSummary.getTotalCpu());
summary.setMemoryBytes(vmwareSummary.getTotalMemory());
if (s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - getHyperHostResourceSummary() done");
return summary;
}
use of com.vmware.vim25.HostHardwareSummary in project CloudStack-archive by CloudStack-extras.
the class HostMO method getHyperHostResourceSummary.
@Override
public VmwareHypervisorHostResourceSummary getHyperHostResourceSummary() throws Exception {
if (s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - getHyperHostResourceSummary(). target MOR: " + _mor.get_value());
VmwareHypervisorHostResourceSummary summary = new VmwareHypervisorHostResourceSummary();
HostConnectInfo hostInfo = _context.getService().queryHostConnectionInfo(_mor);
HostHardwareSummary hardwareSummary = hostInfo.getHost().getHardware();
// TODO: not sure how hyper-thread is counted in VMware resource pool
summary.setCpuCount(hardwareSummary.getNumCpuCores() * hardwareSummary.getNumCpuPkgs());
summary.setMemoryBytes(hardwareSummary.getMemorySize());
summary.setCpuSpeed(hardwareSummary.getCpuMhz());
if (s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - getHyperHostResourceSummary() done");
return summary;
}
use of com.vmware.vim25.HostHardwareSummary in project CloudStack-archive by CloudStack-extras.
the class HostMO method getHyperHostHardwareSummary.
@Override
public ComputeResourceSummary getHyperHostHardwareSummary() throws Exception {
if (s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - getHyperHostHardwareSummary(). target MOR: " + _mor.get_value());
//
// This is to adopt the model when using Cluster as a big host while ComputeResourceSummary is used
// 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;
}
use of com.vmware.vim25.HostHardwareSummary in project CloudStack-archive by CloudStack-extras.
the class ClusterMO method getHyperHostResourceSummary.
@Override
public VmwareHypervisorHostResourceSummary getHyperHostResourceSummary() throws Exception {
if (s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - getHyperHostResourceSummary(). target MOR: " + _mor.get_value());
VmwareHypervisorHostResourceSummary summary = new VmwareHypervisorHostResourceSummary();
ComputeResourceSummary vmwareSummary = (ComputeResourceSummary) _context.getServiceUtil().getDynamicProperty(_mor, "summary");
// TODO, need to use traversal to optimize retrieve of
int cpuNumInCpuThreads = 1;
ManagedObjectReference[] hosts = (ManagedObjectReference[]) _context.getServiceUtil().getDynamicProperty(_mor, "host");
if (hosts != null && hosts.length > 0) {
for (ManagedObjectReference morHost : hosts) {
HostMO hostMo = new HostMO(_context, morHost);
HostHardwareSummary hardwareSummary = hostMo.getHostHardwareSummary();
if (hardwareSummary.getNumCpuCores() * hardwareSummary.getNumCpuThreads() > cpuNumInCpuThreads)
cpuNumInCpuThreads = hardwareSummary.getNumCpuCores() * hardwareSummary.getNumCpuThreads();
}
}
summary.setCpuCount(cpuNumInCpuThreads);
summary.setCpuSpeed(vmwareSummary.getTotalCpu());
summary.setMemoryBytes(vmwareSummary.getTotalMemory());
if (s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - getHyperHostResourceSummary() done");
return summary;
}
Aggregations