record used byte not available byte

This commit is contained in:
anthony 2010-09-23 16:23:41 -07:00
parent f50df48fb1
commit 1ab1bdf92f
1 changed files with 5 additions and 1 deletions

View File

@ -1595,7 +1595,11 @@ public class StorageManagerImpl implements StorageManager {
} else {
CapacityVO capacity = capacities.get(0);
capacity.setTotalCapacity(storagePool.getCapacityBytes());
capacity.setUsedCapacity(storagePool.getAvailableBytes());
long used = storagePool.getCapacityBytes() - storagePool.getAvailableBytes();
if( used <= 0 ) {
used = 0;
}
capacity.setUsedCapacity(used);
_capacityDao.update(capacity.getId(), capacity);
}
s_logger.debug("Successfully set Capacity - " +storagePool.getCapacityBytes()+ " for CAPACITY_TYPE_STORAGE, DataCenterId - " +storagePool.getDataCenterId()+ ", HostOrPoolId - " +storagePool.getId()+ ", PodId " +storagePool.getPodId());