use of com.emc.storageos.volumecontroller.impl.utils.attrmatchers.CapacityMatcher in project coprhd-controller by CoprHD.
the class StorageScheduler method getPoolsMatchingCapacity.
/**
* Returns all storage pools from the passed list of candidate storage
* pools that have at least the passed free capacity.
* Note: do not change order of candidate pools.
*
* @param capacity The desired free capacity.
* @param resourceSize The desired resource size
* @param newResourceCount The desired number of resources
* @param candidatePools The list of candidate storage pools.
* @param isThinlyProvisioned Indication if this is thin provisioning (thin volume).
*
* @return All storage pools that have the passed free capacity.
*/
protected List<StoragePool> getPoolsMatchingCapacity(long capacity, long resourceSize, Integer newResourceCount, List<StoragePool> candidatePools, boolean isThinlyProvisioned, Long thinVolumePreAllocationResourceSize) {
List<StoragePool> poolsWithCapacity = new ArrayList<StoragePool>();
CapacityMatcher capacityMatcher = new CapacityMatcher();
capacityMatcher.setCoordinatorClient(_coordinator);
capacityMatcher.setObjectCache(new ObjectLocalCache(_dbClient, false));
for (StoragePool candidatePool : candidatePools) {
// First check if max Resources limit is violated for the pool
if (MaxResourcesMatcher.checkPoolMaximumResourcesApproached(candidatePool, _dbClient, newResourceCount)) {
continue;
}
// continue;
if (capacityMatcher.poolMatchesCapacity(candidatePool, capacity, resourceSize, false, isThinlyProvisioned, thinVolumePreAllocationResourceSize)) {
poolsWithCapacity.add(candidatePool);
}
}
return poolsWithCapacity;
}
use of com.emc.storageos.volumecontroller.impl.utils.attrmatchers.CapacityMatcher in project coprhd-controller by CoprHD.
the class StorageScheduler method getPoolMatchingCapacity.
/**
* Returns first storage pool from the passed list of candidate storage
* pools that has at least the passed free capacity.
* Note: do not change order of candidate pools.
*
* @param capacity The desired free capacity.
* @param resourceSize The desired resource size
* @param newResourceCount The desired number of resources
* @param candidatePools The list of candidate storage pools.
* @param isThinlyProvisioned Indication if this is thin provisioning (thin volume).
*
* @return A storage pool that have the passed free capacity.
*/
protected StoragePool getPoolMatchingCapacity(long capacity, long resourceSize, Integer newResourceCount, List<StoragePool> candidatePools, boolean isThinlyProvisioned, Long thinVolumePreAllocationResourceSize) {
StoragePool poolWithCapacity = null;
CapacityMatcher capacityMatcher = new CapacityMatcher();
capacityMatcher.setCoordinatorClient(_coordinator);
capacityMatcher.setObjectCache(new ObjectLocalCache(_dbClient, false));
Iterator<StoragePool> storagePoolsIter = candidatePools.iterator();
while (storagePoolsIter.hasNext()) {
StoragePool candidatePool = storagePoolsIter.next();
// First check if max Resources limit is violated for the pool
if (MaxResourcesMatcher.checkPoolMaximumResourcesApproached(candidatePool, _dbClient, newResourceCount)) {
continue;
}
// continue;
if (capacityMatcher.poolMatchesCapacity(candidatePool, capacity, resourceSize, false, isThinlyProvisioned, thinVolumePreAllocationResourceSize)) {
poolWithCapacity = candidatePool;
break;
}
}
return poolWithCapacity;
}
Aggregations