bug 13066 Storage over prov factor should be float rather than long which leads to wrong storage calculation

Reviewed by : Kishan.
This commit is contained in:
Nitin Mehta 2012-01-16 13:08:35 +05:30
parent 57a4a76691
commit dc4db76932
1 changed files with 5 additions and 5 deletions

View File

@ -1867,17 +1867,17 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
capacities = _capacityDao.search(capacitySC, null);
long provFactor = 1;
float provFactor = 1;
if (storagePool.getPoolType() == StoragePoolType.NetworkFilesystem) {
provFactor = (long) _overProvisioningFactor;
provFactor = _overProvisioningFactor;
}
if (capacities.size() == 0) {
CapacityVO capacity = new CapacityVO(storagePool.getId(), storagePool.getDataCenterId(), storagePool.getPodId(), storagePool.getClusterId(), allocated, storagePool.getCapacityBytes()
* provFactor, CapacityVO.CAPACITY_TYPE_STORAGE_ALLOCATED);
CapacityVO capacity = new CapacityVO(storagePool.getId(), storagePool.getDataCenterId(), storagePool.getPodId(), storagePool.getClusterId(), allocated, (long)(storagePool.getCapacityBytes()
* provFactor), CapacityVO.CAPACITY_TYPE_STORAGE_ALLOCATED);
_capacityDao.persist(capacity);
} else {
CapacityVO capacity = capacities.get(0);
long currCapacity = provFactor * storagePool.getCapacityBytes();
long currCapacity = (long)(provFactor * storagePool.getCapacityBytes());
boolean update = false;
if (capacity.getTotalCapacity() != currCapacity) {
capacity.setTotalCapacity(currCapacity);