mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-4882:
list Clusters/pods/zones API not accounting for reserved in the used capacity percentage. Fix listCapacity cmd for reserved as well Signed off by : nitin mehta<nitin.mehta@citrix.com>
This commit is contained in:
parent
0032ff23f8
commit
f91b649b3b
|
|
@ -360,7 +360,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
|
|||
if(level == 3 && rs.getLong(7) != 0)
|
||||
capacityClusterId = rs.getLong(7);
|
||||
|
||||
SummedCapacity summedCapacity = new SummedCapacity( rs.getLong(1), rs.getLong(3), rs.getFloat(4),
|
||||
SummedCapacity summedCapacity = new SummedCapacity( rs.getLong(1), rs.getLong(2), rs.getLong(3), rs.getFloat(4),
|
||||
(short)rs.getLong(5), rs.getLong(6),
|
||||
capacityPodId, capacityClusterId);
|
||||
|
||||
|
|
@ -565,6 +565,11 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
|
|||
this.dcId = zoneId;
|
||||
}
|
||||
|
||||
public SummedCapacity(long sumUsed, long sumReserved, long sumTotal, float percentUsed, short capacityType, Long zoneId, Long podId, Long clusterId) {
|
||||
this(sumUsed, sumTotal, percentUsed, capacityType, zoneId, podId, clusterId);
|
||||
this.sumReserved = sumReserved;
|
||||
}
|
||||
|
||||
public Short getCapacityType() {
|
||||
return capacityType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -795,7 +795,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
for (SummedCapacity capacity : capacities) {
|
||||
CapacityResponse capacityResponse = new CapacityResponse();
|
||||
capacityResponse.setCapacityType(capacity.getCapacityType());
|
||||
capacityResponse.setCapacityUsed(capacity.getUsedCapacity());
|
||||
capacityResponse.setCapacityUsed(capacity.getUsedCapacity() + capacity.getReservedCapacity());
|
||||
if (capacity.getCapacityType() == Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED) {
|
||||
List<SummedCapacity> c = ApiDBUtils.findNonSharedStorageForClusterPodZone(null, pod.getId(), null);
|
||||
capacityResponse.setCapacityTotal(capacity.getTotalCapacity() - c.get(0).getTotalCapacity());
|
||||
|
|
@ -833,7 +833,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
for (SummedCapacity capacity : capacities) {
|
||||
CapacityResponse capacityResponse = new CapacityResponse();
|
||||
capacityResponse.setCapacityType(capacity.getCapacityType());
|
||||
capacityResponse.setCapacityUsed(capacity.getUsedCapacity());
|
||||
capacityResponse.setCapacityUsed(capacity.getUsedCapacity() + capacity.getReservedCapacity());
|
||||
if (capacity.getCapacityType() == Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED) {
|
||||
List<SummedCapacity> c = ApiDBUtils.findNonSharedStorageForClusterPodZone(zoneId, null, null);
|
||||
capacityResponse.setCapacityTotal(capacity.getTotalCapacity() - c.get(0).getTotalCapacity());
|
||||
|
|
@ -954,7 +954,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
for (SummedCapacity capacity : capacities) {
|
||||
CapacityResponse capacityResponse = new CapacityResponse();
|
||||
capacityResponse.setCapacityType(capacity.getCapacityType());
|
||||
capacityResponse.setCapacityUsed(capacity.getUsedCapacity());
|
||||
capacityResponse.setCapacityUsed(capacity.getUsedCapacity() + capacity.getReservedCapacity());
|
||||
|
||||
if (capacity.getCapacityType() == Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED) {
|
||||
List<SummedCapacity> c = ApiDBUtils.findNonSharedStorageForClusterPodZone(null, null, cluster.getId());
|
||||
|
|
|
|||
|
|
@ -2406,7 +2406,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
for (SummedCapacity summedCapacity : summedCapacities) {
|
||||
CapacityVO capacity = new CapacityVO(summedCapacity.getDataCenterId(), summedCapacity.getPodId(), summedCapacity.getClusterId(),
|
||||
summedCapacity.getCapacityType(), summedCapacity.getPercentUsed());
|
||||
capacity.setUsedCapacity(summedCapacity.getUsedCapacity());
|
||||
capacity.setUsedCapacity(summedCapacity.getUsedCapacity() + summedCapacity.getReservedCapacity());
|
||||
capacity.setTotalCapacity(summedCapacity.getTotalCapacity());
|
||||
capacities.add(capacity);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue