Merge pull request #1958 from shapeblue/CLOUDSTACK-5806

CLOUDSTACK-5806: add presetup to storage types that support over provisioning

Ideally this should be configurable via global settings

* pr/1958:
  CLOUDSTACK-5806: add presetup to storage types that support over provisioning Ideally this should be configurable via global settings

Signed-off-by: Rajani Karuturi <rajani.karuturi@accelerite.com>
This commit is contained in:
Rajani Karuturi 2017-03-13 22:16:15 +05:30
commit 9b85cbca41
3 changed files with 7 additions and 4 deletions

View File

@ -143,6 +143,10 @@ public class Storage {
public boolean isShared() {
return shared;
}
public boolean supportsOverProvisioning() {
return this == StoragePoolType.NetworkFilesystem || this == StoragePoolType.VMFS || this == StoragePoolType.PreSetup;
}
}
public static List<StoragePoolType> getNonSharedStoragePoolTypes() {

View File

@ -184,7 +184,6 @@ import com.cloud.service.dao.ServiceOfferingDao;
import com.cloud.service.dao.ServiceOfferingDetailsDao;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.Storage.ProvisioningType;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.storage.StorageManager;
import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.storage.dao.VolumeDao;
@ -507,7 +506,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
throw new InvalidParameterValueException("unable to find storage pool by id " + resourceId);
}
if(name.equals(CapacityManager.StorageOverprovisioningFactor.key())) {
if(pool.getPoolType() != StoragePoolType.NetworkFilesystem && pool.getPoolType() != StoragePoolType.VMFS) {
if(!pool.getPoolType().supportsOverProvisioning() ) {
throw new InvalidParameterValueException("Unable to update storage pool with id " + resourceId + ". Overprovision not supported for " + pool.getPoolType());
}
}

View File

@ -938,7 +938,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
List<CapacityVO> capacities = _capacityDao.search(capacitySC, null);
long totalOverProvCapacity;
if (storagePool.getPoolType() == StoragePoolType.NetworkFilesystem || storagePool.getPoolType() == StoragePoolType.VMFS) {
if (storagePool.getPoolType().supportsOverProvisioning()) {
// All this is for the inaccuracy of floats for big number multiplication.
BigDecimal overProvFactor = getStorageOverProvisioningFactor(storagePool.getId());
totalOverProvCapacity = overProvFactor.multiply(new BigDecimal(storagePool.getCapacityBytes())).longValue();
@ -1796,7 +1796,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
}
long totalOverProvCapacity;
if (pool.getPoolType() == StoragePoolType.NetworkFilesystem || pool.getPoolType() == StoragePoolType.VMFS || pool.getPoolType() == StoragePoolType.Filesystem) {
if (pool.getPoolType().supportsOverProvisioning()) {
BigDecimal overProvFactor = getStorageOverProvisioningFactor(pool.getId());
totalOverProvCapacity = overProvFactor.multiply(new BigDecimal(pool.getCapacityBytes())).longValue();
s_logger.debug("Found storage pool " + poolVO.getName() + " of type " + pool.getPoolType().toString() + " with overprovisioning factor "