Allow storage.overprovisioning.factor to be <1 which allows underprovisioning of storage pools (#6218)

By setting the value to 0.5 (example) we can underprovision a storage pool. This is useful in
cases with Ceph where it reports the raw size of the cluster where the replication factor is
not taken into account.

Fixes: ##6205
This commit is contained in:
Wido den Hollander 2022-04-07 14:50:55 +02:00 committed by GitHub
parent 2b1c4fbe6e
commit 68fa9a1061
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -1128,8 +1128,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
value = value.trim();
try {
if (overprovisioningFactorsForValidation.contains(name) && Float.parseFloat(value) < 1f) {
final String msg = name + " should be greater than or equal to 1";
if (overprovisioningFactorsForValidation.contains(name) && Float.parseFloat(value) <= 0f) {
final String msg = name + " should be greater than 0";
s_logger.error(msg);
throw new InvalidParameterValueException(msg);
}

View File

@ -359,7 +359,6 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
int _storagePoolAcquisitionWaitSeconds = 1800; // 30 minutes
int _downloadUrlCleanupInterval;
int _downloadUrlExpirationInterval;
// protected BigDecimal _overProvisioningFactor = new BigDecimal(1);
private long _serverId;
private final Map<String, HypervisorHostListener> hostListeners = new HashMap<String, HypervisorHostListener>();
@ -2500,8 +2499,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
totalOverProvCapacity = overProvFactor.multiply(new BigDecimal(pool.getCapacityBytes())).longValue();
s_logger.debug("Found storage pool " + poolVO.getName() + " of type " + pool.getPoolType().toString() + " with over-provisioning factor " + overProvFactor.toString());
s_logger.debug("Total over-provisioned capacity calculated is " + overProvFactor + " * " + toHumanReadableSize(pool.getCapacityBytes()));
s_logger.debug("Found storage pool " + pool.getName() + " of type " + pool.getPoolType().toString() + " with overprovisioning factor " + overProvFactor.toString());
s_logger.debug("Total over provisioned capacity calculated is " + overProvFactor + " * " + toHumanReadableSize(pool.getCapacityBytes()));
} else {
totalOverProvCapacity = pool.getCapacityBytes();