use of com.emc.storageos.volumecontroller.placement.StoragePortsAssigner 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;
}
use of com.emc.storageos.volumecontroller.placement.StoragePortsAssigner in project coprhd-controller by CoprHD.
the class VPlexHDSMaskingOrchestratorTest method makeExportMasks.
private static void makeExportMasks(URI arrayURI, VPlexHDSMaskingOrchestrator orca, Set<Map<URI, List<List<StoragePort>>>> portGroups, Set<Map<String, Map<URI, Set<Initiator>>>> initiatorGroups, Map<URI, NetworkLite> networkMap) {
// Iterate through the PortGroups generating zoning info and an ExportMask
Iterator<Map<String, Map<URI, Set<Initiator>>>> igIterator = initiatorGroups.iterator();
for (Map<URI, List<List<StoragePort>>> portGroup : portGroups) {
String maskName = "testMask" + maskCounter.toString();
maskCounter++;
_log.info("Generating ExportMask: " + maskName);
if (!igIterator.hasNext()) {
igIterator = initiatorGroups.iterator();
}
Map<String, Map<URI, Set<Initiator>>> initiatorGroup = igIterator.next();
StoragePortsAssigner assigner = StoragePortsAssignerFactory.getAssignerForZones("hds", null);
StringSetMap zoningMap = orca.configureZoning(portGroup, initiatorGroup, networkMap, assigner, null, null, null);
VPlexBackendManager mgr = new VPlexBackendManager(null, null, null, null, null, URI.create("project"), URI.create("tenant"), null, null);
ExportMask exportMask = mgr.generateExportMask(arrayURI, maskName, portGroup, initiatorGroup, zoningMap);
}
_log.info("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
}
use of com.emc.storageos.volumecontroller.placement.StoragePortsAssigner in project coprhd-controller by CoprHD.
the class VPlexVmaxMaskingOrchestratorTest method makeExportMasksSA.
private static void makeExportMasksSA(URI arrayURI, VPlexVmaxMaskingOrchestrator orca, Set<Map<URI, List<List<StoragePort>>>> portGroups, Set<Map<String, Map<URI, Set<Initiator>>>> initiatorGroups, Map<URI, NetworkLite> networkMap, Map<URI, String> initiatorSwitchMap, Map<URI, Map<String, List<StoragePort>>> portSwitchMap) {
// Iterate through the PortGroups generating zoning info and an ExportMask
Iterator<Map<String, Map<URI, Set<Initiator>>>> igIterator = initiatorGroups.iterator();
for (Map<URI, List<List<StoragePort>>> portGroup : portGroups) {
String maskName = "testMask" + maskCounter.toString();
maskCounter++;
_log.info("Generating ExportMask: " + maskName);
if (!igIterator.hasNext()) {
igIterator = initiatorGroups.iterator();
}
Map<String, Map<URI, Set<Initiator>>> initiatorGroup = igIterator.next();
StoragePortsAssigner assigner = StoragePortsAssignerFactory.getAssignerForZones("vmax", null);
StringSetMap zoningMap = orca.configureZoning(portGroup, initiatorGroup, networkMap, assigner, initiatorSwitchMap, portSwitchMap, getPortSwitchNameMap(portSwitchMap));
VPlexBackendManager mgr = new VPlexBackendManager(null, null, null, null, null, URI.create("project"), URI.create("tenant"), null, null);
mgr.generateExportMask(arrayURI, maskName, portGroup, initiatorGroup, zoningMap);
}
_log.info("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
}
use of com.emc.storageos.volumecontroller.placement.StoragePortsAssigner in project coprhd-controller by CoprHD.
the class VPlexVnxMaskingOrchestratorTest method makeExportMasks.
private static void makeExportMasks(URI arrayURI, VPlexVnxMaskingOrchestrator orca, Set<Map<URI, List<List<StoragePort>>>> portGroups, Set<Map<String, Map<URI, Set<Initiator>>>> initiatorGroups, Map<URI, NetworkLite> networkMap) {
// Iterate through the PortGroups generating zoning info and an ExportMask
Iterator<Map<String, Map<URI, Set<Initiator>>>> igIterator = initiatorGroups.iterator();
Iterator<Map<URI, List<List<StoragePort>>>> pgIterator = portGroups.iterator();
while (igIterator.hasNext()) {
Map<String, Map<URI, Set<Initiator>>> initiatorGroup = igIterator.next();
String maskName = "testMask" + maskCounter.toString();
if (!pgIterator.hasNext()) {
break;
}
Map<URI, List<List<StoragePort>>> portGroup = pgIterator.next();
maskCounter++;
_log.info("Generating ExportMask: " + maskName);
StoragePortsAssigner assigner = StoragePortsAssignerFactory.getAssignerForZones("vnxblock", null);
StringSetMap zoningMap = orca.configureZoning(portGroup, initiatorGroup, networkMap, assigner, null, null, null);
VPlexBackendManager mgr = new VPlexBackendManager(null, null, null, null, null, URI.create("project"), URI.create("tenant"), null, null);
ExportMask exportMask = mgr.generateExportMask(arrayURI, maskName, portGroup, initiatorGroup, zoningMap);
}
_log.info("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
}
use of com.emc.storageos.volumecontroller.placement.StoragePortsAssigner in project coprhd-controller by CoprHD.
the class VPlexXtremIOMaskingOrchestratorTest method makeExportMasks.
private static void makeExportMasks(URI arrayURI, VplexXtremIOMaskingOrchestrator orca, Set<Map<URI, List<List<StoragePort>>>> portGroups, Set<Map<String, Map<URI, Set<Initiator>>>> initiatorGroups, Map<URI, NetworkLite> networkMap) {
// Iterate through the PortGroups generating zoning info and an ExportMask
Iterator<Map<String, Map<URI, Set<Initiator>>>> igIterator = initiatorGroups.iterator();
for (Map<URI, List<List<StoragePort>>> portGroup : portGroups) {
String maskName = "testMask" + maskCounter.toString();
maskCounter++;
_log.info("Generating ExportMask: " + maskName);
if (!igIterator.hasNext()) {
igIterator = initiatorGroups.iterator();
}
Map<String, Map<URI, Set<Initiator>>> initiatorGroup = igIterator.next();
StoragePortsAssigner assigner = StoragePortsAssignerFactory.getAssignerForZones("vmax", null);
StringSetMap zoningMap = orca.configureZoning(portGroup, initiatorGroup, networkMap, assigner, null, null, null);
VPlexBackendManager mgr = new VPlexBackendManager(null, null, null, null, null, URI.create("project"), URI.create("tenant"), null, null);
ExportMask exportMask = mgr.generateExportMask(arrayURI, maskName, portGroup, initiatorGroup, zoningMap);
}
_log.info("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
}
Aggregations