Search in sources :

Example 1 with StoragePortsAssigner

use of com.emc.storageos.volumecontroller.placement.StoragePortsAssigner in project coprhd-controller by CoprHD.

the class RPDeviceController method computeNumPaths.

/**
 * Compute the number of paths to use on the back end array.
 * This is done on a per Network basis and then summed together.
 * Within each Network, we determine the number of ports available, and then
 * convert to paths. Currently we don't allocate more paths than initiators.
 *
 * @param initiatorPortMap
 *            -- used to determine networks and initiator counts
 * @param varray
 *            -- only Networks in the specified varray are considered
 * @param array
 *            -- StorageSystem -- used to determine available ports
 * @return
 */
private Integer computeNumPaths(Map<URI, List<StoragePort>> initiatorPortMap, URI varray, StorageSystem array) {
    // Get the number of ports per path.
    StoragePortsAssigner assigner = StoragePortsAssignerFactory.getAssigner(array.getSystemType());
    int portsPerPath = assigner.getNumberOfPortsPerPath();
    // Get the array's front end ports for this varray only
    Map<URI, List<StoragePort>> arrayTargetMap = ConnectivityUtil.getStoragePortsOfTypeAndVArray(_dbClient, array.getId(), StoragePort.PortType.frontend, varray);
    int numPaths = 0;
    for (URI networkURI : initiatorPortMap.keySet()) {
        if (arrayTargetMap.get(networkURI) != null) {
            int pathsInNetwork = arrayTargetMap.get(networkURI).size() / portsPerPath;
            int initiatorsInNetwork = initiatorPortMap.get(networkURI).size();
            if (pathsInNetwork > initiatorsInNetwork) {
                pathsInNetwork = initiatorsInNetwork;
            }
            _log.info(String.format("Network %s has %s paths", networkURI, pathsInNetwork));
            numPaths += pathsInNetwork;
        } else {
            _log.info(String.format("Storage Array %s has no ports in Network %s", array.getNativeGuid(), networkURI));
        }
    }
    return numPaths;
}
Also used : StoragePortsAssigner(com.emc.storageos.volumecontroller.placement.StoragePortsAssigner) ApplicationAddVolumeList(com.emc.storageos.volumecontroller.ApplicationAddVolumeList) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) List(java.util.List) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) Constraint(com.emc.storageos.db.client.constraint.Constraint)

Example 2 with StoragePortsAssigner

use of com.emc.storageos.volumecontroller.placement.StoragePortsAssigner in project coprhd-controller by CoprHD.

the class VPlexBackendManager method computeNumPaths.

/**
 * Compute the number of paths to use on the back end array.
 * This is done on a per Network basis and then summed together.
 * Within each Network, we determine the number of ports available, and then
 * convert to paths. Currently we don't allocate more paths than initiators.
 *
 * @param initiatorPortMap
 *            -- used to determine networks and initiator counts
 * @param varray
 *            -- only Networks in the specified varray are considered
 * @param array
 *            -- StorageSystem -- used to determine available ports
 * @return
 */
private Integer computeNumPaths(Map<URI, List<StoragePort>> initiatorPortMap, URI varray, StorageSystem array) {
    // Get the number of ports per path.
    StoragePortsAssigner assigner = StoragePortsAssignerFactory.getAssigner(array.getSystemType());
    int portsPerPath = assigner.getNumberOfPortsPerPath();
    // Get the array's front end ports
    Map<URI, List<StoragePort>> arrayTargetMap = ConnectivityUtil.getStoragePortsOfTypeAndVArray(_dbClient, array.getId(), StoragePort.PortType.frontend, varray);
    int numPaths = 0;
    for (URI networkURI : initiatorPortMap.keySet()) {
        if (arrayTargetMap.get(networkURI) != null) {
            int pathsInNetwork = arrayTargetMap.get(networkURI).size() / portsPerPath;
            int initiatorsInNetwork = initiatorPortMap.get(networkURI).size();
            if (pathsInNetwork > initiatorsInNetwork) {
                pathsInNetwork = initiatorsInNetwork;
            }
            _log.info(String.format("Network %s has %s paths", networkURI, pathsInNetwork));
            numPaths += pathsInNetwork;
        } else {
            _log.info(String.format("Storage Array %s has no ports in Network %s", array.getNativeGuid(), networkURI));
        }
    }
    return numPaths;
}
Also used : StoragePortsAssigner(com.emc.storageos.volumecontroller.placement.StoragePortsAssigner) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) URI(java.net.URI) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint)

Example 3 with StoragePortsAssigner

use of com.emc.storageos.volumecontroller.placement.StoragePortsAssigner in project coprhd-controller by CoprHD.

the class VPlexVmaxMaskingOrchestratorTest method makeExportMasks.

private static void makeExportMasks(URI arrayURI, VPlexVmaxMaskingOrchestrator 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);
        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 4 with StoragePortsAssigner

use of com.emc.storageos.volumecontroller.placement.StoragePortsAssigner in project coprhd-controller by CoprHD.

the class VPlexVnxMaskingOrchestratorTest method makeExportMasksSA.

private static void makeExportMasksSA(URI arrayURI, VPlexVnxMaskingOrchestrator 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("vnxblock", null);
        StringSetMap zoningMap = orca.configureZoning(portGroup, initiatorGroup, networkMap, assigner, initiatorSwitchMap, portSwitchMap, VPlexVmaxMaskingOrchestratorTest.getPortSwitchNameMap(portSwitchMap));
        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 5 with StoragePortsAssigner

use of com.emc.storageos.volumecontroller.placement.StoragePortsAssigner in project coprhd-controller by CoprHD.

the class VPlexXtremIOMaskingOrchestratorTest method makeExportMasksSA.

/**
 * Make export masks with switch affinity
 *
 * @param arrayURI
 * @param orca
 * @param portGroups
 * @param initiatorGroups
 * @param networkMap
 */
private static void makeExportMasksSA(URI arrayURI, VplexXtremIOMaskingOrchestrator 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, VPlexVmaxMaskingOrchestratorTest.getPortSwitchNameMap(portSwitchMap));
        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