Search in sources :

Example 61 with StoragePort

use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.

the class PlacementTestUtils method createSRDFStorageSystems.

/**
 * Create SRDF paired vmax arrays.
 * @param dbClient
 * @param label1
 * @param network1
 * @param portWWNs1
 * @param varray1
 * @param label2
 * @param network2
 * @param portWWNs2
 * @param varray2
 * @return StorageSystem[1] and StorageSystem[2]; StorageSystem[0] not used.
 */
public static StorageSystem[] createSRDFStorageSystems(DbClient dbClient, String label1, Network network1, String[] portWWNs1, VirtualArray varray1, String label2, Network network2, String[] portWWNs2, VirtualArray varray2) {
    StorageSystem[] storageSystems = new StorageSystem[3];
    // Create 2 storage systems
    StorageSystem storageSystem1 = PlacementTestUtils.createStorageSystem(dbClient, "vmax", label1);
    storageSystems[1] = storageSystem1;
    StorageSystem storageSystem2 = PlacementTestUtils.createStorageSystem(dbClient, "vmax", label2);
    storageSystems[2] = storageSystem2;
    // Mark them SRDF capable
    StringSet supportedAsynchronousActions = new StringSet();
    supportedAsynchronousActions.add(StorageSystem.AsyncActions.CreateElementReplica.name());
    supportedAsynchronousActions.add(StorageSystem.AsyncActions.CreateGroupReplica.name());
    storageSystem1.setSupportedAsynchronousActions(supportedAsynchronousActions);
    storageSystem2.setSupportedAsynchronousActions(supportedAsynchronousActions);
    StringSet supportedReplicationTypes = new StringSet();
    supportedReplicationTypes.add(StorageSystem.SupportedReplicationTypes.SRDF.name());
    storageSystem1.setSupportedReplicationTypes(supportedReplicationTypes);
    storageSystem2.setSupportedReplicationTypes(supportedReplicationTypes);
    // Set connected to.
    StringSet connectedTo = new StringSet();
    connectedTo.add(storageSystem2.getId().toString());
    storageSystem1.setRemotelyConnectedTo(connectedTo);
    connectedTo = new StringSet();
    connectedTo.add(storageSystem1.getId().toString());
    storageSystem2.setRemotelyConnectedTo(connectedTo);
    dbClient.updateObject(storageSystem1, storageSystem2);
    // Create RemoteDirectorGroups
    RemoteDirectorGroup rdg1 = new RemoteDirectorGroup();
    rdg1.setActive(true);
    rdg1.setConnectivityStatus(RemoteDirectorGroup.ConnectivityStatus.UP.name());
    rdg1.setLabel("RDG1");
    rdg1.setId(URI.create("RDG1" + label1));
    rdg1.setNativeGuid("$label1+$label2+6");
    rdg1.setRemoteGroupId("6");
    rdg1.setRemoteStorageSystemUri(storageSystem2.getId());
    rdg1.setSourceGroupId("6");
    rdg1.setSourceStorageSystemUri(storageSystem1.getId());
    rdg1.setSupportedCopyMode(RemoteDirectorGroup.SupportedCopyModes.ASYNCHRONOUS.name());
    dbClient.createObject(rdg1);
    RemoteDirectorGroup rdg2 = new RemoteDirectorGroup();
    rdg2.setActive(true);
    rdg2.setConnectivityStatus(RemoteDirectorGroup.ConnectivityStatus.UP.name());
    rdg2.setLabel("RDG2");
    rdg2.setId(URI.create("RDG2" + label1));
    rdg2.setNativeGuid("$label2+$label1+6");
    rdg2.setRemoteGroupId("6");
    rdg2.setRemoteStorageSystemUri(storageSystem1.getId());
    rdg2.setSourceGroupId("6");
    rdg2.setSourceStorageSystemUri(storageSystem2.getId());
    rdg2.setSupportedCopyMode(RemoteDirectorGroup.SupportedCopyModes.ASYNCHRONOUS.name());
    dbClient.createObject(rdg2);
    // Create two front-end storage ports system1.
    List<StoragePort> system1Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < portWWNs1.length; i++) {
        system1Ports.add(PlacementTestUtils.createStoragePort(dbClient, storageSystem1, network1, portWWNs1[i], varray1, StoragePort.PortType.frontend.name(), "portGroupSite1vmax" + i, "C0+FC0" + i));
    }
    // Create two front-end storage ports system2
    List<StoragePort> system2Ports = new ArrayList<StoragePort>();
    for (int i = 0; i < portWWNs2.length; i++) {
        system2Ports.add(PlacementTestUtils.createStoragePort(dbClient, storageSystem2, network2, portWWNs2[i], varray2, StoragePort.PortType.frontend.name(), "portGroupSite2vmax" + i, "D0+FC0" + i));
    }
    return storageSystems;
}
Also used : StringSet(com.emc.storageos.db.client.model.StringSet) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) RemoteDirectorGroup(com.emc.storageos.db.client.model.RemoteDirectorGroup) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 62 with StoragePort

use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.

the class PlacementTestUtils method createVPlexTwoCluster.

/**
 * Creates a two cluster distrubted system.
 * @param dbClient - db client handle
 * @param label - name of the Storage System
 * @param varray1 - varray ckyster 1
 * @param networkFE1  network for cluster 1 Front End ports WWN
 * @param networkBE1 - network for cluster 1 Back End ports WWn
 * @param vplexFE1 - Front End Ports cluster 1
 * @param vplexBE1 - Back End  ports cluster 1
 * @param varray2 -- corresponding stuff for cluster 2
 * @param networkFE2
 * @param networkBE2
 * @param vplexFE2
 * @param vplexBE2
 * @return Storage System created represending Vplex Metro System
 */
public static StorageSystem createVPlexTwoCluster(DbClient dbClient, String label, VirtualArray varray1, Network networkFE1, Network networkBE1, String[] vplexFE1, String[] vplexBE1, VirtualArray varray2, Network networkFE2, Network networkBE2, String[] vplexFE2, String[] vplexBE2) {
    // Create a VPLEX storage system
    StorageSystem vplexStorageSystem = PlacementTestUtils.createStorageSystem(dbClient, "vplex", label);
    // Cluster one.
    // Create two front-end storage ports VPLEX
    List<StoragePort> fePorts = new ArrayList<StoragePort>();
    for (int i = 0; i < vplexFE1.length; i++) {
        fePorts.add(PlacementTestUtils.createStoragePort(dbClient, vplexStorageSystem, networkFE1, vplexFE1[i], varray1, StoragePort.PortType.frontend.name(), "portGroupFE" + i, label + "_A0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX
    List<StoragePort> bePorts = new ArrayList<StoragePort>();
    for (int i = 0; i < vplexBE1.length; i++) {
        bePorts.add(PlacementTestUtils.createStoragePort(dbClient, vplexStorageSystem, networkBE1, vplexBE1[i], varray1, StoragePort.PortType.backend.name(), "portGroupBE" + i, label + "_B0+FC0" + i));
    }
    // Cluster two.
    // Create two front-end storage ports VPLEX
    fePorts = new ArrayList<StoragePort>();
    for (int i = 0; i < vplexFE2.length; i++) {
        fePorts.add(PlacementTestUtils.createStoragePort(dbClient, vplexStorageSystem, networkFE2, vplexFE2[i], varray2, StoragePort.PortType.frontend.name(), "portGroupFE" + i, label + "_C0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX
    bePorts = new ArrayList<StoragePort>();
    for (int i = 0; i < vplexBE2.length; i++) {
        bePorts.add(PlacementTestUtils.createStoragePort(dbClient, vplexStorageSystem, networkBE2, vplexBE2[i], varray2, StoragePort.PortType.backend.name(), "portGroupBE" + i, label + "_D0+FC0" + i));
    }
    return vplexStorageSystem;
}
Also used : StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 63 with StoragePort

use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.

the class PlacementTestUtils method createVPlexOneCluster.

public static StorageSystem createVPlexOneCluster(DbClient dbClient, String label, VirtualArray varray, Network networkFE, Network networkBE, String[] vplexFE, String[] vplexBE) {
    // Create a VPLEX storage system
    StorageSystem vplexStorageSystem = PlacementTestUtils.createStorageSystem(dbClient, "vplex", label);
    // Create two front-end storage ports VPLEX
    List<StoragePort> fePorts = new ArrayList<StoragePort>();
    for (int i = 0; i < vplexFE.length; i++) {
        fePorts.add(PlacementTestUtils.createStoragePort(dbClient, vplexStorageSystem, networkFE, vplexFE[i], varray, StoragePort.PortType.frontend.name(), "portGroupFE" + i, label + "_A0+FC0" + i));
    }
    // Create two back-end storage ports VPLEX
    List<StoragePort> bePorts = new ArrayList<StoragePort>();
    for (int i = 0; i < vplexBE.length; i++) {
        bePorts.add(PlacementTestUtils.createStoragePort(dbClient, vplexStorageSystem, networkBE, vplexBE[i], varray, StoragePort.PortType.backend.name(), "portGroupBE" + i, label + "_B0+FC0" + i));
    }
    return vplexStorageSystem;
}
Also used : StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 64 with StoragePort

use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.

the class VplexExportGroupServiceApiImpl method getVirtualArrayTaggedPortsByNework.

/**
 * This methods looks for tagged virtual array ports if it belongs to a
 * network then adds it to a map.
 *
 * @param varray virtual array uri
 * @return a map of network to storageport set
 */
private Map<Network, Set<StoragePort>> getVirtualArrayTaggedPortsByNework(URI varray) {
    Map<URI, Set<StoragePort>> registeredNetworkStoragePorts = new HashMap<URI, Set<StoragePort>>();
    URIQueryResultList storagePortURIs = new URIQueryResultList();
    _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVirtualArrayStoragePortsConstraint(varray.toString()), storagePortURIs);
    Iterator<URI> storagePortURIsIter = storagePortURIs.iterator();
    while (storagePortURIsIter.hasNext()) {
        URI storagePortURI = storagePortURIsIter.next();
        StoragePort storagePort = _dbClient.queryObject(StoragePort.class, storagePortURI);
        if (storagePort != null && !storagePort.getInactive() && !NullColumnValueGetter.isNullURI(storagePort.getNetwork()) && storagePort.getRegistrationStatus().equals(DiscoveredDataObject.RegistrationStatus.REGISTERED.name()) && !storagePort.getDiscoveryStatus().equalsIgnoreCase(DiscoveryStatus.NOTVISIBLE.name())) {
            if (registeredNetworkStoragePorts.get(storagePort.getNetwork()) == null) {
                Set<StoragePort> storageports = new HashSet<StoragePort>();
                storageports.add(storagePort);
                registeredNetworkStoragePorts.put(storagePort.getNetwork(), storageports);
            } else {
                registeredNetworkStoragePorts.get(storagePort.getNetwork()).add(storagePort);
            }
        }
    }
    Map<Network, Set<StoragePort>> networkToStoragePortsMap = new HashMap<Network, Set<StoragePort>>();
    for (Map.Entry<URI, Set<StoragePort>> entry : registeredNetworkStoragePorts.entrySet()) {
        Network network = _dbClient.queryObject(Network.class, entry.getKey());
        networkToStoragePortsMap.put(network, entry.getValue());
    }
    return networkToStoragePortsMap;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) StoragePort(com.emc.storageos.db.client.model.StoragePort) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) Network(com.emc.storageos.db.client.model.Network) HashMap(java.util.HashMap) Map(java.util.Map) StringMap(com.emc.storageos.db.client.model.StringMap) HashSet(java.util.HashSet)

Example 65 with StoragePort

use of com.emc.storageos.db.client.model.StoragePort in project coprhd-controller by CoprHD.

the class VplexExportGroupServiceApiImpl method getNetworkTaggedPortsForHost.

/**
 * This method returns all StoragePorts from networks containing initiators
 * of a host.
 *
 * @param hostUri
 * @param networkToPortsMap map of network to storageport set
 */
private Map<URI, StoragePort> getNetworkTaggedPortsForHost(URI hostUri, Map<Network, Set<StoragePort>> networkToPortsMap) {
    URIQueryResultList initiatorURIs = new URIQueryResultList();
    _dbClient.queryByConstraint(ContainmentConstraint.Factory.getContainedObjectsConstraint(hostUri, Initiator.class, "host"), initiatorURIs);
    Map<URI, StoragePort> networkStoragePorts = new HashMap<URI, StoragePort>();
    Set<StoragePort> storagePorts = new HashSet<StoragePort>();
    Iterator<URI> initiatorURIsIter = initiatorURIs.iterator();
    while (initiatorURIsIter.hasNext()) {
        URI initiatorURI = initiatorURIs.iterator().next();
        Initiator initiator = _dbClient.queryObject(Initiator.class, initiatorURI);
        if (!initiator.getInactive() && initiator.getRegistrationStatus().equals(DiscoveredDataObject.RegistrationStatus.REGISTERED.name())) {
            for (Map.Entry<Network, Set<StoragePort>> entry : networkToPortsMap.entrySet()) {
                if (entry.getKey().retrieveEndpoints().contains(initiator.getInitiatorPort())) {
                    storagePorts.addAll(entry.getValue());
                }
            }
        }
    }
    for (StoragePort storagePort : storagePorts) {
        networkStoragePorts.put(storagePort.getId(), storagePort);
    }
    return networkStoragePorts;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) StoragePort(com.emc.storageos.db.client.model.StoragePort) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) Initiator(com.emc.storageos.db.client.model.Initiator) Network(com.emc.storageos.db.client.model.Network) HashMap(java.util.HashMap) Map(java.util.Map) StringMap(com.emc.storageos.db.client.model.StringMap) HashSet(java.util.HashSet)

Aggregations

StoragePort (com.emc.storageos.db.client.model.StoragePort)477 URI (java.net.URI)285 ArrayList (java.util.ArrayList)261 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)143 HashMap (java.util.HashMap)134 List (java.util.List)130 NetworkLite (com.emc.storageos.util.NetworkLite)110 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)107 StringSet (com.emc.storageos.db.client.model.StringSet)92 PortAllocationContext (com.emc.storageos.volumecontroller.placement.StoragePortsAllocator.PortAllocationContext)84 HashSet (java.util.HashSet)81 Initiator (com.emc.storageos.db.client.model.Initiator)78 Map (java.util.Map)64 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)62 StoragePool (com.emc.storageos.db.client.model.StoragePool)51 IOException (java.io.IOException)48 StringMap (com.emc.storageos.db.client.model.StringMap)45 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)43 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)42 StorageHADomain (com.emc.storageos.db.client.model.StorageHADomain)34