Search in sources :

Example 1 with VplexXtremIOMaskingOrchestrator

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;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) StringSet(com.emc.storageos.db.client.model.StringSet) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) URI(java.net.URI) Initiator(com.emc.storageos.db.client.model.Initiator) VplexBackEndMaskingOrchestrator(com.emc.storageos.volumecontroller.impl.block.VplexBackEndMaskingOrchestrator) StringSet(com.emc.storageos.db.client.model.StringSet) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) NetworkLite(com.emc.storageos.util.NetworkLite) ExportMask(com.emc.storageos.db.client.model.ExportMask) StoragePort(com.emc.storageos.db.client.model.StoragePort) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) StoragePortsAssigner(com.emc.storageos.volumecontroller.placement.StoragePortsAssigner) ExportGroup(com.emc.storageos.db.client.model.ExportGroup) VplexXtremIOMaskingOrchestrator(com.emc.storageos.volumecontroller.impl.block.VplexXtremIOMaskingOrchestrator) Map(java.util.Map) HashMap(java.util.HashMap) StringSetMap(com.emc.storageos.db.client.model.StringSetMap)

Aggregations

AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)1 ExportMask (com.emc.storageos.db.client.model.ExportMask)1 Initiator (com.emc.storageos.db.client.model.Initiator)1 StoragePort (com.emc.storageos.db.client.model.StoragePort)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)1 NetworkLite (com.emc.storageos.util.NetworkLite)1 VplexBackEndMaskingOrchestrator (com.emc.storageos.volumecontroller.impl.block.VplexBackEndMaskingOrchestrator)1 VplexXtremIOMaskingOrchestrator (com.emc.storageos.volumecontroller.impl.block.VplexXtremIOMaskingOrchestrator)1 StoragePortsAssigner (com.emc.storageos.volumecontroller.placement.StoragePortsAssigner)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1