Search in sources :

Example 86 with PortAllocationContext

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

the class StoragePortsAssignerTest method createVmaxNet22.

protected static PortAllocationContext createVmaxNet22() {
    NetworkLite tz = new NetworkLite(URI.create("net2"), "net2");
    PortAllocationContext context = new PortAllocationContext(tz, "test");
    StoragePort port;
    port = createFCPort("FA-7F:2", "50:00:00:00:00:01:00:02");
    addPort(context, port, "mds-a");
    port = createFCPort("FA-7F:3", "50:00:00:00:00:01:00:03");
    addPort(context, port, "mds-b");
    port = createFCPort("FA-8F:2", "50:00:00:00:00:01:01:02");
    addPort(context, port, "mds-a");
    port = createFCPort("FA-8F:3", "50:00:00:00:00:01:01:03");
    addPort(context, port, "mds-b");
    port = createFCPort("FA-9F:2", "50:00:00:00:00:01:02:02");
    addPort(context, port, "mds-a");
    port = createFCPort("FA-9F:3", "50:00:00:00:00:01:02:03");
    addPort(context, port, "mds-b");
    port = createFCPort("FA-10F:2", "50:00:00:00:00:01:03:02");
    addPort(context, port, "mds-a");
    port = createFCPort("FA-10F:3", "50:00:00:00:00:01:03:03");
    addPort(context, port, "mds-b");
    port = createFCPort("FA-11F:2", "50:00:00:00:00:01:04:02");
    addPort(context, port, "mds-b");
    port = createFCPort("FA-11F:3", "50:00:00:00:00:01:04:03");
    addPort(context, port, "mds-b");
    port = createFCPort("FA-12F:2", "50:00:00:00:00:01:05:02");
    addPort(context, port, "mds-a");
    port = createFCPort("FA-12F:3", "50:00:00:00:00:01:05:03");
    addPort(context, port, "mds-b");
    return context;
}
Also used : NetworkLite(com.emc.storageos.util.NetworkLite) StoragePort(com.emc.storageos.db.client.model.StoragePort) PortAllocationContext(com.emc.storageos.volumecontroller.placement.StoragePortsAllocator.PortAllocationContext)

Example 87 with PortAllocationContext

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

the class StoragePortsAssignerTest method testVMAX2NetAllocIncrementalAssignWithSwitchAffinity.

public static void testVMAX2NetAllocIncrementalAssignWithSwitchAffinity(Map<URI, List<Initiator>> net2InitiatorsMapA, Map<URI, List<Initiator>> net2InitiatorsMapB, int initialMaxPaths, int initialPathsPerInitiator, int finalMaxPaths, int finalPathsPerInitiator) throws Exception {
    Map<URI, Map<URI, List<Initiator>>> hostToNetToInitiatorsMap = new HashMap<URI, Map<URI, List<Initiator>>>();
    URI hostA = getHostURI(net2InitiatorsMapA);
    hostToNetToInitiatorsMap = getHostInitiatorsMap(net2InitiatorsMapA);
    PortAllocationContext net1ctx = createVmaxNet11();
    PortAllocationContext net2ctx = createVmaxNet22();
    PortAllocationContext[] contexts = new PortAllocationContext[] { net1ctx, net2ctx };
    // Allocate initial assignments
    System.out.println("***** Initial assignments: *****");
    Map<Initiator, List<StoragePort>> assignments = testAllocationAssignment(contexts, hostToNetToInitiatorsMap, initialMaxPaths, 0, initialPathsPerInitiator, 1, "vmax", null);
    URI hostB = getHostURI(net2InitiatorsMapB);
    if (hostA.equals(hostB)) {
        Map<URI, List<Initiator>> mergedNet2Initiators = new HashMap<URI, List<Initiator>>();
        for (URI netA : net2InitiatorsMapA.keySet()) {
            mergedNet2Initiators.put(netA, new ArrayList<Initiator>(net2InitiatorsMapA.get(netA)));
        }
        for (URI netb : net2InitiatorsMapB.keySet()) {
            if (mergedNet2Initiators.containsKey(netb)) {
                mergedNet2Initiators.get(netb).addAll(net2InitiatorsMapB.get(netb));
            } else {
                mergedNet2Initiators.put(netb, new ArrayList<Initiator>(net2InitiatorsMapB.get(netb)));
            }
        }
        hostToNetToInitiatorsMap = getHostInitiatorsMap(mergedNet2Initiators);
    } else {
        hostToNetToInitiatorsMap.put(hostB, net2InitiatorsMapB);
    }
    System.out.println("***** Incremental assignments for switch affinity: *****" + " maxPaths " + finalMaxPaths + " ppi " + finalPathsPerInitiator);
    assignments = testAllocationAssignmentWithSwitchAffinity(contexts, hostToNetToInitiatorsMap, finalMaxPaths, 0, finalPathsPerInitiator, 1, "vmax", assignments);
}
Also used : Initiator(com.emc.storageos.db.client.model.Initiator) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List) URI(java.net.URI) HashMap(java.util.HashMap) Map(java.util.Map) PortAllocationContext(com.emc.storageos.volumecontroller.placement.StoragePortsAllocator.PortAllocationContext)

Example 88 with PortAllocationContext

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

the class StoragePortsAssignerTest method testVNX2NetAllocAssign.

/**
 * Test allocation in a VNX two network environment.
 *
 * @param net2InitiatorsMapA -- initiators for host A
 * @param net2InitiatorsMapB -- initiators for host B (optional)
 * @param net2InitiatorsMapC -- initiators for host C (optional)
 * @param net2InitiatorsMapD -- initiators for host D (optional)
 * @param maxPaths
 * @param minPaths
 * @param pathsPerInitiator
 * @param initiatorsPerPort
 */
public static void testVNX2NetAllocAssign(Map<URI, List<Initiator>> net2InitiatorsMapA, Map<URI, List<Initiator>> net2InitiatorsMapB, Map<URI, List<Initiator>> net2InitiatorsMapC, Map<URI, List<Initiator>> net2InitiatorsMapD, int maxPaths, int minPaths, int pathsPerInitiator, int initiatorsPerPort, boolean isSwitchAffinity) throws Exception {
    Map<URI, Map<URI, List<Initiator>>> hostToNetToInitiatorsMap = new HashMap<URI, Map<URI, List<Initiator>>>();
    URI hostA = getHostURI(net2InitiatorsMapA);
    hostToNetToInitiatorsMap.put(hostA, net2InitiatorsMapA);
    if (net2InitiatorsMapB != null) {
        URI hostB = getHostURI(net2InitiatorsMapB);
        hostToNetToInitiatorsMap.put(hostB, net2InitiatorsMapB);
    }
    if (net2InitiatorsMapC != null) {
        URI hostC = getHostURI(net2InitiatorsMapC);
        hostToNetToInitiatorsMap.put(hostC, net2InitiatorsMapC);
    }
    if (net2InitiatorsMapD != null) {
        URI hostD = getHostURI(net2InitiatorsMapD);
        hostToNetToInitiatorsMap.put(hostD, net2InitiatorsMapD);
    }
    PortAllocationContext net1ctx = createVNXNet1();
    PortAllocationContext net2ctx = createVNXNet2();
    PortAllocationContext[] contexts = new PortAllocationContext[] { net1ctx, net2ctx };
    if (!isSwitchAffinity) {
        testAllocationAssignment(contexts, hostToNetToInitiatorsMap, maxPaths, minPaths, pathsPerInitiator, initiatorsPerPort, "vnxblock", null);
    } else {
        testAllocationAssignmentWithSwitchAffinity(contexts, hostToNetToInitiatorsMap, maxPaths, minPaths, pathsPerInitiator, initiatorsPerPort, "vnxblock", null);
    }
}
Also used : Initiator(com.emc.storageos.db.client.model.Initiator) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List) URI(java.net.URI) HashMap(java.util.HashMap) Map(java.util.Map) PortAllocationContext(com.emc.storageos.volumecontroller.placement.StoragePortsAllocator.PortAllocationContext)

Example 89 with PortAllocationContext

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

the class StoragePortsAssignerTest method testVMAX2NetAllocIncrementalAssign.

public static void testVMAX2NetAllocIncrementalAssign(Map<URI, List<Initiator>> net2InitiatorsMapA, Map<URI, List<Initiator>> net2InitiatorsMapB, int initialMaxPaths, int initialPathsPerInitiator, int finalMaxPaths, int finalPathsPerInitiator) throws Exception {
    Map<URI, Map<URI, List<Initiator>>> hostToNetToInitiatorsMap = new HashMap<URI, Map<URI, List<Initiator>>>();
    URI hostA = getHostURI(net2InitiatorsMapA);
    hostToNetToInitiatorsMap = getHostInitiatorsMap(net2InitiatorsMapA);
    PortAllocationContext net1ctx = createVmaxNet1();
    PortAllocationContext net2ctx = createVmaxNet2();
    PortAllocationContext[] contexts = new PortAllocationContext[] { net1ctx, net2ctx };
    // Allocate initial assignments
    System.out.println("***** Initial assignments: *****");
    Map<Initiator, List<StoragePort>> assignments = testAllocationAssignment(contexts, hostToNetToInitiatorsMap, initialMaxPaths, 0, initialPathsPerInitiator, 1, "vmax", null);
    URI hostB = getHostURI(net2InitiatorsMapB);
    if (hostA.equals(hostB)) {
        Map<URI, List<Initiator>> mergedNet2Initiators = new HashMap<URI, List<Initiator>>();
        for (URI netA : net2InitiatorsMapA.keySet()) {
            mergedNet2Initiators.put(netA, new ArrayList<Initiator>(net2InitiatorsMapA.get(netA)));
        }
        for (URI netb : net2InitiatorsMapB.keySet()) {
            if (mergedNet2Initiators.containsKey(netb)) {
                mergedNet2Initiators.get(netb).addAll(net2InitiatorsMapB.get(netb));
            } else {
                mergedNet2Initiators.put(netb, new ArrayList<Initiator>(net2InitiatorsMapB.get(netb)));
            }
        }
        hostToNetToInitiatorsMap = getHostInitiatorsMap(mergedNet2Initiators);
    } else {
        hostToNetToInitiatorsMap.put(hostB, net2InitiatorsMapB);
    }
    System.out.println("***** Incremental assignments: *****" + " maxPaths " + finalMaxPaths + " ppi " + finalPathsPerInitiator);
    assignments = testAllocationAssignment(contexts, hostToNetToInitiatorsMap, finalMaxPaths, 0, finalPathsPerInitiator, 1, "vmax", assignments);
}
Also used : Initiator(com.emc.storageos.db.client.model.Initiator) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List) URI(java.net.URI) HashMap(java.util.HashMap) Map(java.util.Map) PortAllocationContext(com.emc.storageos.volumecontroller.placement.StoragePortsAllocator.PortAllocationContext)

Example 90 with PortAllocationContext

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

the class StoragePortsAssignerTest method createVNXNet3.

protected static PortAllocationContext createVNXNet3() {
    NetworkLite tz = new NetworkLite(URI.create("net1"), "net1");
    PortAllocationContext context = new PortAllocationContext(tz, "test");
    StoragePort port;
    port = createFCPort("SP_A:0", "50:00:00:00:00:00:00:00");
    addPort(context, port, "mds-a");
    port = createFCPort("SP_B:0", "50:00:00:00:00:00:01:00");
    addPort(context, port, "mds-a");
    return context;
}
Also used : NetworkLite(com.emc.storageos.util.NetworkLite) StoragePort(com.emc.storageos.db.client.model.StoragePort) PortAllocationContext(com.emc.storageos.volumecontroller.placement.StoragePortsAllocator.PortAllocationContext)

Aggregations

PortAllocationContext (com.emc.storageos.volumecontroller.placement.StoragePortsAllocator.PortAllocationContext)95 StoragePort (com.emc.storageos.db.client.model.StoragePort)84 NetworkLite (com.emc.storageos.util.NetworkLite)82 URI (java.net.URI)65 ArrayList (java.util.ArrayList)65 HashMap (java.util.HashMap)28 List (java.util.List)27 Map (java.util.Map)20 Initiator (com.emc.storageos.db.client.model.Initiator)13 HashSet (java.util.HashSet)13 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)10 Set (java.util.Set)7 StringMap (com.emc.storageos.db.client.model.StringMap)6 StringSet (com.emc.storageos.db.client.model.StringSet)6 StoragePortsAllocator (com.emc.storageos.volumecontroller.placement.StoragePortsAllocator)6 DummyDbClient (com.emc.storageos.util.DummyDbClient)5 PortAllocatorTestContext (com.emc.storageos.volumecontroller.placement.PortAllocatorTestContext)4 VPlexBackendManager (com.emc.storageos.vplexcontroller.VPlexBackendManager)4 ExportPathParams (com.emc.storageos.db.client.model.ExportPathParams)2