We can move it to storage driver's capabilities method.
Each storage driver can report its capabilities in DataStoreDriver->
getCapabilities(), which returns a map[String, String], we can change the
signature to map[String, Object]
In CloudStackPrimaryDataStoreDriverImpl(the default storage driver)->
getCapabilities, which can return something like:
Var comparator = new storageOverProvision() {
Public Boolean isOverProvisionSupported(DataStore store) {
Var storagepool = (PrimaryDataStoreInfo)store;
If (store.getPoolType() == NFS or VMFS) {
Return true;
}
};
};
Var caps = new HashMap[String, Object]();
Caps.put("storageOverProvision", comparator);
Return caps;
}
Whenever, other places in mgt server want to check the capabilities of
overprovision, we can do the following:
Var primaryStore = DataStoreManager. getPrimaryDataStore(primaryStoreId);
var caps = primaryStore. getDriver().getCapabilities();
var overprovision = caps.get("storageOverProvision");
var result = overprovision. isOverProvisionSupported(primaryStore);
> -----Original Message-----
> From: Marcus Sorensen [mailto:[email protected]]
> Sent: Monday, January 06, 2014 9:19 AM
> To: [email protected]
> Subject: HELP: storage overprovision for storage plugins
>
> Does anyone know how to make our storage plugin allow overprovisioning
> with the new storage framework? Looks like its currently hardcoded to just
> NFS or VMFS.
>
> I imagine we'd want to add a method to StoragePool, boolean
> StoragePool.getOverprovision()
>
>
> server/src/com/cloud/storage/StorageManagerImpl.java
>
> if (storagePool.getPoolType() == StoragePoolType.NetworkFilesystem ||
> storagePool.getPoolType() ==
> StoragePoolType.VMFS) {
> BigDecimal overProvFactor =
> getStorageOverProvisioningFactor(storagePool.getDataCenterId());
> totalOverProvCapacity = overProvFactor.multiply(new
> BigDecimal(storagePool.getCapacityBytes())).longValue();
> // All this is for the inaccuracy of floats for big number
> multiplication.
> } else {
> totalOverProvCapacity = storagePool.getCapacityBytes();
> }