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;
}
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);
}
}
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"));
}
Aggregations