Skip to content

Commit 1f355d6

Browse files
author
Abhinandan Prateek
committed
CLOUDSTACK-9687: if the allocated amount is 0 the capacity updates are not done, resulting in wrong values being shown as allocated value instead of zero
Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
1 parent b0b4960 commit 1f355d6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/src/com/cloud/storage/StorageManagerImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ public BigDecimal getStorageOverProvisioningFactor(Long poolId) {
961961
}
962962

963963
@Override
964-
public void createCapacityEntry(StoragePoolVO storagePool, short capacityType, long allocated) {
964+
public void createCapacityEntry(StoragePoolVO storagePool, short capacityType, long totalAllocated) {
965965
SearchCriteria<CapacityVO> capacitySC = _capacityDao.createSearchCriteria();
966966
capacitySC.addAnd("hostOrPoolId", SearchCriteria.Op.EQ, storagePool.getId());
967967
capacitySC.addAnd("dataCenterId", SearchCriteria.Op.EQ, storagePool.getDataCenterId());
@@ -999,15 +999,15 @@ public void createCapacityEntry(StoragePoolVO storagePool, short capacityType, l
999999
}
10001000
if (capacities.size() == 0) {
10011001
CapacityVO capacity =
1002-
new CapacityVO(storagePool.getId(), storagePool.getDataCenterId(), storagePool.getPodId(), storagePool.getClusterId(), allocated, totalOverProvCapacity,
1002+
new CapacityVO(storagePool.getId(), storagePool.getDataCenterId(), storagePool.getPodId(), storagePool.getClusterId(), totalAllocated, totalOverProvCapacity,
10031003
capacityType);
10041004
capacity.setCapacityState(capacityState);
10051005
_capacityDao.persist(capacity);
10061006
} else {
10071007
CapacityVO capacity = capacities.get(0);
1008-
if (capacity.getTotalCapacity() != totalOverProvCapacity || allocated != 0L || capacity.getCapacityState() != capacityState) {
1008+
if (capacity.getTotalCapacity() != totalOverProvCapacity || capacity.getUsedCapacity() != totalAllocated || capacity.getCapacityState() != capacityState) {
10091009
capacity.setTotalCapacity(totalOverProvCapacity);
1010-
capacity.setUsedCapacity(allocated);
1010+
capacity.setUsedCapacity(totalAllocated);
10111011
capacity.setCapacityState(capacityState);
10121012
_capacityDao.update(capacity.getId(), capacity);
10131013
}

0 commit comments

Comments
 (0)