From e0f03a4f8910ad0947841dc66f83058ba7f0853e Mon Sep 17 00:00:00 2001 From: nit Date: Fri, 14 Jan 2011 18:01:08 +0530 Subject: [PATCH] bug 7655 : The dashboard would use the reserved capacity + used capacity in the op_host_Capacity to reflect the total used capacity. Reserved capacity corresponds to the stopped vms within a specific interval called vm.resource.release.interval status 7655 : resolved fixed --- server/src/com/cloud/api/ApiResponseHelper.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 63c95242e82..e3db40ed3a4 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -1972,7 +1972,7 @@ public class ApiResponseHelper implements ResponseGenerator { if (poolIdsToIgnore.contains(capacity.getHostOrPoolId())) { continue; } - + short capacityType = capacity.getCapacityType(); String key = capacity.getCapacityType() + "_" + capacity.getDataCenterId(); String keyForPodTotal = key + "_-1"; @@ -1994,7 +1994,11 @@ public class ApiResponseHelper implements ResponseGenerator { if (usedCapacity == null) { usedCapacity = new Long(capacity.getUsedCapacity()); } else { - usedCapacity = new Long(capacity.getUsedCapacity() + usedCapacity); + usedCapacity = new Long(capacity.getUsedCapacity() + usedCapacity); + } + + if (capacityType == Capacity.CAPACITY_TYPE_CPU || capacityType == Capacity.CAPACITY_TYPE_MEMORY){ // Reserved Capacity accounts for stopped vms that have been stopped within an interval + usedCapacity += capacity.getReservedCapacity(); } totalCapacityMap.put(key, totalCapacity); @@ -2015,7 +2019,11 @@ public class ApiResponseHelper implements ResponseGenerator { } else { usedCapacity = new Long(capacity.getUsedCapacity() + usedCapacity); } - + + if (capacityType == Capacity.CAPACITY_TYPE_CPU || capacityType == Capacity.CAPACITY_TYPE_MEMORY){ // Reserved Capacity accounts for stopped vms that have been stopped within an interval + usedCapacity += capacity.getReservedCapacity(); + } + totalCapacityMap.put(keyForPodTotal, totalCapacity); usedCapacityMap.put(keyForPodTotal, usedCapacity); }