Skip to content

Commit 9b85cbc

Browse files
committed
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>
2 parents 09802e0 + b6c259d commit 9b85cbc

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

api/src/com/cloud/storage/Storage.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ public static enum StoragePoolType {
143143
public boolean isShared() {
144144
return shared;
145145
}
146+
147+
public boolean supportsOverProvisioning() {
148+
return this == StoragePoolType.NetworkFilesystem || this == StoragePoolType.VMFS || this == StoragePoolType.PreSetup;
149+
}
146150
}
147151

148152
public static List<StoragePoolType> getNonSharedStoragePoolTypes() {

server/src/com/cloud/configuration/ConfigurationManagerImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@
184184
import com.cloud.service.dao.ServiceOfferingDetailsDao;
185185
import com.cloud.storage.DiskOfferingVO;
186186
import com.cloud.storage.Storage.ProvisioningType;
187-
import com.cloud.storage.Storage.StoragePoolType;
188187
import com.cloud.storage.StorageManager;
189188
import com.cloud.storage.dao.DiskOfferingDao;
190189
import com.cloud.storage.dao.VolumeDao;
@@ -507,7 +506,7 @@ public String updateConfiguration(final long userId, final String name, final St
507506
throw new InvalidParameterValueException("unable to find storage pool by id " + resourceId);
508507
}
509508
if(name.equals(CapacityManager.StorageOverprovisioningFactor.key())) {
510-
if(pool.getPoolType() != StoragePoolType.NetworkFilesystem && pool.getPoolType() != StoragePoolType.VMFS) {
509+
if(!pool.getPoolType().supportsOverProvisioning() ) {
511510
throw new InvalidParameterValueException("Unable to update storage pool with id " + resourceId + ". Overprovision not supported for " + pool.getPoolType());
512511
}
513512
}

server/src/com/cloud/storage/StorageManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ public void createCapacityEntry(StoragePoolVO storagePool, short capacityType, l
938938
List<CapacityVO> capacities = _capacityDao.search(capacitySC, null);
939939

940940
long totalOverProvCapacity;
941-
if (storagePool.getPoolType() == StoragePoolType.NetworkFilesystem || storagePool.getPoolType() == StoragePoolType.VMFS) {
941+
if (storagePool.getPoolType().supportsOverProvisioning()) {
942942
// All this is for the inaccuracy of floats for big number multiplication.
943943
BigDecimal overProvFactor = getStorageOverProvisioningFactor(storagePool.getId());
944944
totalOverProvCapacity = overProvFactor.multiply(new BigDecimal(storagePool.getCapacityBytes())).longValue();
@@ -1796,7 +1796,7 @@ public boolean storagePoolHasEnoughSpace(List<Volume> volumes, StoragePool pool,
17961796
}
17971797

17981798
long totalOverProvCapacity;
1799-
if (pool.getPoolType() == StoragePoolType.NetworkFilesystem || pool.getPoolType() == StoragePoolType.VMFS || pool.getPoolType() == StoragePoolType.Filesystem) {
1799+
if (pool.getPoolType().supportsOverProvisioning()) {
18001800
BigDecimal overProvFactor = getStorageOverProvisioningFactor(pool.getId());
18011801
totalOverProvCapacity = overProvFactor.multiply(new BigDecimal(pool.getCapacityBytes())).longValue();
18021802
s_logger.debug("Found storage pool " + poolVO.getName() + " of type " + pool.getPoolType().toString() + " with overprovisioning factor "

0 commit comments

Comments
 (0)