Search in sources :

Example 6 with StoragePoolAllocator

use of com.cloud.engine.subsystem.api.storage.StoragePoolAllocator in project cosmic by MissionCriticalCloud.

the class GarbageCollectingStoragePoolAllocator method select.

@Override
public List<StoragePool> select(final DiskProfile dskCh, final VirtualMachineProfile vmProfile, final DeploymentPlan plan, final ExcludeList avoid, final int returnUpTo) {
    s_logger.debug("GarbageCollectingStoragePoolAllocator looking for storage pool");
    if (!_storagePoolCleanupEnabled) {
        s_logger.debug("Storage pool cleanup is not enabled, so GarbageCollectingStoragePoolAllocator is being skipped.");
        return null;
    }
    // Clean up all storage pools
    storageMgr.cleanupStorage(false);
    // Determine what allocator to use
    final StoragePoolAllocator allocator;
    if (dskCh.useLocalStorage()) {
        allocator = _localStoragePoolAllocator;
    } else {
        allocator = _firstFitStoragePoolAllocator;
    }
    // Try to find a storage pool after cleanup
    final ExcludeList myAvoids = new ExcludeList(avoid.getZonesToAvoid(), avoid.getPodsToAvoid(), avoid.getClustersToAvoid(), avoid.getHostsToAvoid(), avoid.getPoolsToAvoid());
    return allocator.allocateToPool(dskCh, vmProfile, plan, myAvoids, returnUpTo);
}
Also used : ExcludeList(com.cloud.deploy.DeploymentPlanner.ExcludeList) StoragePoolAllocator(com.cloud.engine.subsystem.api.storage.StoragePoolAllocator)

Aggregations

ExcludeList (com.cloud.deploy.DeploymentPlanner.ExcludeList)6 StoragePoolAllocator (com.cloud.engine.subsystem.api.storage.StoragePoolAllocator)6 StoragePool (com.cloud.storage.StoragePool)5 DataCenterDeployment (com.cloud.deploy.DataCenterDeployment)4 DiskOfferingVO (com.cloud.storage.DiskOfferingVO)4 VolumeVO (com.cloud.storage.VolumeVO)3 DiskProfile (com.cloud.vm.DiskProfile)3 ArrayList (java.util.ArrayList)3 Volume (com.cloud.storage.Volume)2 StoragePoolVO (com.cloud.storage.datastore.db.StoragePoolVO)2 Pair (com.cloud.utils.Pair)2 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)2 VirtualMachineProfile (com.cloud.vm.VirtualMachineProfile)2 VirtualMachineProfileImpl (com.cloud.vm.VirtualMachineProfileImpl)2 HashMap (java.util.HashMap)2 Zone (com.cloud.db.model.Zone)1 DataStore (com.cloud.engine.subsystem.api.storage.DataStore)1 PermissionDeniedException (com.cloud.exception.PermissionDeniedException)1 HostVO (com.cloud.host.HostVO)1 HypervisorCapabilitiesVO (com.cloud.hypervisor.HypervisorCapabilitiesVO)1