Search in sources :

Example 1 with CapacityMatcher

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;
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) ObjectLocalCache(com.emc.storageos.volumecontroller.impl.utils.ObjectLocalCache) ArrayList(java.util.ArrayList) CapacityMatcher(com.emc.storageos.volumecontroller.impl.utils.attrmatchers.CapacityMatcher)

Example 2 with CapacityMatcher

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;
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) ObjectLocalCache(com.emc.storageos.volumecontroller.impl.utils.ObjectLocalCache) CapacityMatcher(com.emc.storageos.volumecontroller.impl.utils.attrmatchers.CapacityMatcher)

Aggregations

StoragePool (com.emc.storageos.db.client.model.StoragePool)2 ObjectLocalCache (com.emc.storageos.volumecontroller.impl.utils.ObjectLocalCache)2 CapacityMatcher (com.emc.storageos.volumecontroller.impl.utils.attrmatchers.CapacityMatcher)2 ArrayList (java.util.ArrayList)1