Search in sources :

Example 6 with StoragePortsAssigner

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

Example 7 with StoragePortsAssigner

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("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
}
Also used : StringSetMap(com.emc.storageos.db.client.model.StringSetMap) HashSet(java.util.HashSet) Set(java.util.Set) ExportMask(com.emc.storageos.db.client.model.ExportMask) VPlexBackendManager(com.emc.storageos.vplexcontroller.VPlexBackendManager) StoragePort(com.emc.storageos.db.client.model.StoragePort) URI(java.net.URI) StoragePortsAssigner(com.emc.storageos.volumecontroller.placement.StoragePortsAssigner) Initiator(com.emc.storageos.db.client.model.Initiator) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) StringSetMap(com.emc.storageos.db.client.model.StringSetMap)

Example 8 with StoragePortsAssigner

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("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
}
Also used : StringSetMap(com.emc.storageos.db.client.model.StringSetMap) HashSet(java.util.HashSet) Set(java.util.Set) VPlexBackendManager(com.emc.storageos.vplexcontroller.VPlexBackendManager) StoragePort(com.emc.storageos.db.client.model.StoragePort) URI(java.net.URI) StoragePortsAssigner(com.emc.storageos.volumecontroller.placement.StoragePortsAssigner) Initiator(com.emc.storageos.db.client.model.Initiator) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) StringSetMap(com.emc.storageos.db.client.model.StringSetMap)

Example 9 with StoragePortsAssigner

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("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
}
Also used : StringSetMap(com.emc.storageos.db.client.model.StringSetMap) HashSet(java.util.HashSet) Set(java.util.Set) ExportMask(com.emc.storageos.db.client.model.ExportMask) VPlexBackendManager(com.emc.storageos.vplexcontroller.VPlexBackendManager) StoragePort(com.emc.storageos.db.client.model.StoragePort) URI(java.net.URI) StoragePortsAssigner(com.emc.storageos.volumecontroller.placement.StoragePortsAssigner) Initiator(com.emc.storageos.db.client.model.Initiator) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) StringSetMap(com.emc.storageos.db.client.model.StringSetMap)

Example 10 with StoragePortsAssigner

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");
}
Also used : StringSetMap(com.emc.storageos.db.client.model.StringSetMap) HashSet(java.util.HashSet) Set(java.util.Set) ExportMask(com.emc.storageos.db.client.model.ExportMask) VPlexBackendManager(com.emc.storageos.vplexcontroller.VPlexBackendManager) StoragePort(com.emc.storageos.db.client.model.StoragePort) URI(java.net.URI) StoragePortsAssigner(com.emc.storageos.volumecontroller.placement.StoragePortsAssigner) Initiator(com.emc.storageos.db.client.model.Initiator) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) StringSetMap(com.emc.storageos.db.client.model.StringSetMap)

Aggregations

StoragePortsAssigner (com.emc.storageos.volumecontroller.placement.StoragePortsAssigner)10 URI (java.net.URI)10 ArrayList (java.util.ArrayList)10 List (java.util.List)10 Initiator (com.emc.storageos.db.client.model.Initiator)8 StoragePort (com.emc.storageos.db.client.model.StoragePort)8 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)8 HashMap (java.util.HashMap)8 HashSet (java.util.HashSet)8 Map (java.util.Map)8 Set (java.util.Set)8 VPlexBackendManager (com.emc.storageos.vplexcontroller.VPlexBackendManager)7 ExportMask (com.emc.storageos.db.client.model.ExportMask)6 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)3 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)3 Constraint (com.emc.storageos.db.client.constraint.Constraint)1 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)1 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)1 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 StringSet (com.emc.storageos.db.client.model.StringSet)1