use of com.emc.storageos.volumecontroller.impl.block.VplexXtremIOMaskingOrchestrator in project coprhd-controller by CoprHD.
the class VPlexBackendManager method generateExportMasks.
private Map<ExportMask, ExportGroup> generateExportMasks(URI varrayURI, StorageSystem vplex, StorageSystem array, String stepId, StringBuilder errorMessages) {
// Build the data structures used for analysis and validation.
buildDataStructures(vplex, array, varrayURI);
// Assign initiators to hosts
String clusterName = getClusterName(vplex);
Set<Map<String, Map<URI, Set<Initiator>>>> initiatorGroups = getInitiatorGroups(clusterName, _directorToInitiatorIds, _initiatorIdToNetwork, _idToInitiatorMap, array.getSystemType().equals(SystemType.vnxblock.name()), false);
// First we must determine the Initiator Groups and PortGroups to be used.
VplexBackEndMaskingOrchestrator orca = getOrch(array);
// set VPLEX director count to set number of paths per director
if (orca instanceof VplexXtremIOMaskingOrchestrator) {
// get VPLEX director count
int directorCount = getVplexDirectorCount(initiatorGroups);
((VplexXtremIOMaskingOrchestrator) orca).setVplexDirectorCount(directorCount);
}
// get the allocatable ports - if the custom config requests pre-zoned ports to be used
// get the existing zones in zonesByNetwork
Map<NetworkLite, StringSetMap> zonesByNetwork = new HashMap<NetworkLite, StringSetMap>();
Map<URI, List<StoragePort>> allocatablePorts = getAllocatablePorts(array, _networkMap.keySet(), varrayURI, zonesByNetwork, stepId);
Map<ExportMask, ExportGroup> exportMasksMap = new HashMap<ExportMask, ExportGroup>();
if (allocatablePorts.isEmpty()) {
String message = "No allocatable ports found for export to VPLEX backend. ";
_log.warn(message);
if (errorMessages != null) {
errorMessages.append(message);
}
_log.warn("Returning empty export mask map because no allocatable ports could be found.");
return exportMasksMap;
}
Map<URI, Map<String, Integer>> switchToPortNumber = getSwitchToMaxPortNumberMap(array);
Set<Map<URI, List<List<StoragePort>>>> portGroups = orca.getPortGroups(allocatablePorts, _networkMap, varrayURI, initiatorGroups.size(), switchToPortNumber, null, errorMessages);
// Now generate the Masking Views that will be needed.
Map<URI, String> initiatorSwitchMap = new HashMap<URI, String>();
Map<URI, Map<String, List<StoragePort>>> switchStoragePortsMap = new HashMap<URI, Map<String, List<StoragePort>>>();
Map<URI, List<StoragePort>> storageports = getStoragePorts(portGroups);
Map<URI, String> portSwitchMap = new HashMap<URI, String>();
PlacementUtils.getSwitchNameForInititaorsStoragePorts(_initiators, storageports, _dbClient, array, initiatorSwitchMap, switchStoragePortsMap, portSwitchMap);
Iterator<Map<String, Map<URI, Set<Initiator>>>> igIterator = initiatorGroups.iterator();
// get the assigner needed - it is with a pre-zoned ports assigner or the default
StoragePortsAssigner assigner = StoragePortsAssignerFactory.getAssignerForZones(array.getSystemType(), zonesByNetwork);
for (Map<URI, List<List<StoragePort>>> portGroup : portGroups) {
String maskName = clusterName.replaceAll("[^A-Za-z0-9_]", "_");
_log.info("Generating ExportMask: " + maskName);
if (!igIterator.hasNext()) {
igIterator = initiatorGroups.iterator();
}
Map<String, Map<URI, Set<Initiator>>> initiatorGroup = igIterator.next();
StringSetMap zoningMap = orca.configureZoning(portGroup, initiatorGroup, _networkMap, assigner, initiatorSwitchMap, switchStoragePortsMap, portSwitchMap);
ExportMask exportMask = generateExportMask(array.getId(), maskName, portGroup, initiatorGroup, zoningMap);
// Set a flag indicating that we do not want to remove zoningMap entries
StringSetMap map = new StringSetMap();
StringSet values = new StringSet();
values.add(Boolean.TRUE.toString());
map.put(ExportMask.DeviceDataMapKeys.ImmutableZoningMap.name(), values);
if (array.getSystemType().equals(SystemType.vmax.name())) {
// If VMAX, set consisteLUNs = false
values = new StringSet();
values.add(Boolean.FALSE.toString());
map.put(ExportMask.DeviceDataMapKeys.VMAXConsistentLUNs.name(), values);
}
exportMask.addDeviceDataMap(map);
// Create an ExportGroup for the ExportMask.
List<Initiator> initiators = new ArrayList<Initiator>();
for (String director : initiatorGroup.keySet()) {
for (URI networkURI : initiatorGroup.get(director).keySet()) {
for (Initiator initiator : initiatorGroup.get(director).get(networkURI)) {
initiators.add(initiator);
}
}
}
_dbClient.createObject(exportMask);
ExportGroup exportGroup = ExportUtils.createVplexExportGroup(_dbClient, vplex, array, initiators, varrayURI, _projectURI, _tenantURI, 0, exportMask);
exportMasksMap.put(exportMask, exportGroup);
}
return exportMasksMap;
}
Aggregations