Search in sources :

Example 6 with StorageDriverManager

use of com.emc.storageos.services.util.StorageDriverManager in project coprhd-controller by CoprHD.

the class NumPathsMatcher method matchStoragePoolsWithAttributeOn.

/**
 * Filters out all pools hosted by arrays that have fewer "usable" ports of the
 * designated transport type(s) than the num_paths attribute.
 */
@Override
protected List<StoragePool> matchStoragePoolsWithAttributeOn(List<StoragePool> allPools, Map<String, Object> attributeMap, StringBuffer errorMessage) {
    boolean checkIP = false;
    boolean checkFC = false;
    // If not a block vpool, then everything matches.
    if (false == attributeMap.get(Attributes.vpool_type.toString()).equals(VirtualPool.Type.block.name())) {
        return allPools;
    }
    // If Vplex high availability is used, then do not filter on maxPaths because
    // the VPlex itself contains no pools, and the underlying array pools should match
    // regardless of the maxPath settings.
    Object highAvailabilityType = attributeMap.get(Attributes.high_availability_type.toString());
    if (highAvailabilityType != null && NullColumnValueGetter.isNotNullValue(highAvailabilityType.toString())) {
        return allPools;
    }
    // If protocols is not specified, can't determine which type of ports to check.
    Set<String> protocols = (Set<String>) attributeMap.get(Attributes.protocols.toString());
    Set<String> vArrays = (Set<String>) attributeMap.get(Attributes.varrays.toString());
    if (protocols != null && protocols.contains(Block.FC.name())) {
        checkFC = true;
    }
    if (protocols != null && protocols.contains(Block.iSCSI.name())) {
        checkIP = true;
    }
    Integer maxPaths = (Integer) attributeMap.get(Attributes.max_paths.toString());
    Map<URI, Integer> cachedUsableFCPorts = new HashMap<URI, Integer>();
    Map<URI, Integer> cachedUsableIPPorts = new HashMap<URI, Integer>();
    Map<URI, Integer> cachedUsableFCHADomains = new HashMap<URI, Integer>();
    Map<URI, Integer> cachedUsableIPHADomains = new HashMap<URI, Integer>();
    List<StoragePool> matchedPools = new ArrayList<StoragePool>();
    Map<URI, StorageSystem> storageSystemMap = new HashMap<URI, StorageSystem>();
    for (StoragePool pool : allPools) {
        URI dev = pool.getStorageDevice();
        StorageSystem system = getStorageSystem(storageSystemMap, pool);
        if (checkFC) {
            if (numberOfUsablePorts(dev, Transport.FC, vArrays, cachedUsableFCPorts, cachedUsableFCHADomains) < maxPaths) {
                _logger.info("NumPathsMatcher disqualified pool: " + pool.getNativeGuid() + " max_paths: " + maxPaths + " because insufficient FC ports");
                continue;
            }
            // If we need two or more paths, must have at least two HA Domains
            if (!system.getIsDriverManaged() && !system.getSystemType().equals(DiscoveredSystemObject.Type.scaleio.name()) && !system.getSystemType().equals(DiscoveredSystemObject.Type.xtremio.name()) && !system.getSystemType().equals(DiscoveredSystemObject.Type.ceph.name())) {
                if (maxPaths >= 2 && cachedUsableFCHADomains.get(dev) < 2) {
                    _logger.info("NumPathsMatcher disqualified pool: " + pool.getNativeGuid() + " max_paths: " + maxPaths + " because insufficient FC cpus (StorageHADomains)");
                    continue;
                }
            }
        }
        if (checkIP) {
            if (numberOfUsablePorts(dev, Transport.IP, vArrays, cachedUsableIPPorts, cachedUsableIPHADomains) < maxPaths) {
                _logger.info("NumPathsMatcher disqualified pool: " + pool.getNativeGuid() + " max_paths: " + maxPaths + " because insufficient IP ports");
                continue;
            }
            StorageDriverManager storageDriverManager = (StorageDriverManager) StorageDriverManager.getApplicationContext().getBean(StorageDriverManager.STORAGE_DRIVER_MANAGER);
            // If we need two or more paths, must have at least two HA Domains
            if (!storageDriverManager.isDriverManaged(system.getSystemType()) && !system.getSystemType().equals(DiscoveredSystemObject.Type.scaleio.name()) && !system.getSystemType().equals(DiscoveredSystemObject.Type.xtremio.name()) && !system.getSystemType().equals(DiscoveredSystemObject.Type.ceph.name())) {
                if (maxPaths >= 2 && cachedUsableIPHADomains.get(dev) < 2) {
                    _logger.info("NumPathsMatcher disqualified pool: " + pool.getNativeGuid() + " max_paths: " + maxPaths + " because insufficient IP cpus (StorageHADomains)");
                    continue;
                }
            }
        }
        matchedPools.add(pool);
    }
    if (CollectionUtils.isEmpty(matchedPools)) {
        errorMessage.append(String.format("No storage pool is matching with the VPool maximum path parameter %d. ", maxPaths));
        _logger.error(errorMessage.toString());
    }
    _logger.info("NumPathsMatcher maxPaths: " + maxPaths + " passed " + matchedPools.size() + " pools");
    return matchedPools;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) StoragePool(com.emc.storageos.db.client.model.StoragePool) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) URI(java.net.URI) StorageDriverManager(com.emc.storageos.services.util.StorageDriverManager) DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 7 with StorageDriverManager

use of com.emc.storageos.services.util.StorageDriverManager in project coprhd-controller by CoprHD.

the class ControllerServiceImpl method initDriverManager.

private void initDriverManager(List<StorageSystemType> types) {
    StorageDriverManager driverManager = (StorageDriverManager) getBean(StorageDriverManager.STORAGE_DRIVER_MANAGER);
    for (StorageSystemType type : types) {
        String typeName = type.getStorageTypeName();
        String driverName = type.getDriverName();
        if (type.getIsSmiProvider()) {
            driverManager.getStorageProvidersMap().put(driverName, typeName);
            _log.info("Driver info for storage system type {} has been set into storageDriverManager instance", typeName);
            continue;
        }
        driverManager.getStorageSystemsMap().put(driverName, typeName);
        if (type.getManagedBy() != null) {
            driverManager.getProviderManaged().add(typeName);
        } else {
            driverManager.getDirectlyManaged().add(typeName);
        }
        if (StringUtils.equals(type.getMetaType(), StorageSystemType.META_TYPE.FILE.toString())) {
            driverManager.getFileSystems().add(typeName);
        } else if (StringUtils.equals(type.getMetaType(), StorageSystemType.META_TYPE.BLOCK.toString())) {
            driverManager.getBlockSystems().add(typeName);
        }
        _log.info("Driver info for storage system type {} has been set into storageDriverManager instance", typeName);
    }
}
Also used : StorageDriverManager(com.emc.storageos.services.util.StorageDriverManager) StorageSystemType(com.emc.storageos.db.client.model.StorageSystemType)

Example 8 with StorageDriverManager

use of com.emc.storageos.services.util.StorageDriverManager in project coprhd-controller by CoprHD.

the class VPlexMeteringTest method mockStorageDriverManager.

private void mockStorageDriverManager() {
    StorageDriverManager storageDriverManager = new StorageDriverManager();
    storageDriverManager.setApplicationContext(new ClassPathXmlApplicationContext("driver-conf.xml"));
}
Also used : StorageDriverManager(com.emc.storageos.services.util.StorageDriverManager) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext)

Aggregations

StorageDriverManager (com.emc.storageos.services.util.StorageDriverManager)8 ArrayList (java.util.ArrayList)3 StoragePool (com.emc.storageos.db.client.model.StoragePool)2 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 StringSet (com.emc.storageos.db.client.model.StringSet)2 URI (java.net.URI)2 HashSet (java.util.HashSet)2 Iterator (java.util.Iterator)2 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)2 MapBlockConsistencyGroup (com.emc.storageos.api.mapper.functions.MapBlockConsistencyGroup)1 DbClient (com.emc.storageos.db.client.DbClient)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)1 BlockObject (com.emc.storageos.db.client.model.BlockObject)1 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)1 DiscoveredSystemObject (com.emc.storageos.db.client.model.DiscoveredSystemObject)1 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 StorageSystemType (com.emc.storageos.db.client.model.StorageSystemType)1 Volume (com.emc.storageos.db.client.model.Volume)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1