mirror of https://github.com/apache/cloudstack.git
bug 9059: Host Details would account for Stopped VM's as well - basically they will take into account the reserved_capacity from op_host_Capacity table
status 9059: resolved fixed
This commit is contained in:
parent
1d55d2fc05
commit
8c5c58dc35
|
|
@ -3275,25 +3275,10 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
|
||||
@Override
|
||||
public long getMemoryUsagebyHost(Long hostId) {
|
||||
long mem = 0;
|
||||
List<VMInstanceVO> vms = _vmInstanceDao.listUpByHostIdTypes(hostId, VirtualMachine.Type.DomainRouter);
|
||||
mem += vms.size() * _routerRamSize * 1024L * 1024L;
|
||||
|
||||
vms = _vmInstanceDao.listUpByHostIdTypes(hostId, VirtualMachine.Type.SecondaryStorageVm);
|
||||
mem += vms.size() * _ssRamSize * 1024L * 1024L;
|
||||
|
||||
CapacityVO capacity = _capacityDao.findByHostIdType(hostId, CapacityVO.CAPACITY_TYPE_MEMORY);
|
||||
return capacity == null ? 0 : capacity.getReservedCapacity() + capacity.getUsedCapacity();
|
||||
|
||||
vms = _vmInstanceDao.listUpByHostIdTypes(hostId, VirtualMachine.Type.ConsoleProxy);
|
||||
mem += vms.size() * _proxyRamSize * 1024L * 1024L;
|
||||
|
||||
|
||||
List<UserVmVO> instances = _userVmDao.listUpByHostId(hostId);
|
||||
for (UserVmVO vm : instances) {
|
||||
ServiceOffering so = findServiceOfferingById(vm.getServiceOfferingId());
|
||||
if (so != null) {
|
||||
mem += so.getRamSize() * 1024L * 1024L;
|
||||
}
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue