record used byte not available byte

This commit is contained in:
anthony 2010-09-23 16:23:41 -07:00
parent 188711c18d
commit c9ae6fd09d

View File

@ -1749,7 +1749,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());