Search in sources :

Example 1 with StorageSystemConnectivityList

use of com.emc.storageos.model.systems.StorageSystemConnectivityList in project coprhd-controller by CoprHD.

the class SRDFBlockServiceApiImpl method getStorageSystemConnectivity.

@Override
public StorageSystemConnectivityList getStorageSystemConnectivity(final StorageSystem system) {
    StorageSystemConnectivityList connectivityList = new StorageSystemConnectivityList();
    // Set used to ensure unique values are added to the connectivity list
    Set<String> existing = new HashSet<String>();
    if (system.getRemotelyConnectedTo() != null) {
        for (String remoteSystemUri : system.getRemotelyConnectedTo()) {
            if (remoteSystemUri == null || NullColumnValueGetter.getNullStr().equals(remoteSystemUri)) {
                continue;
            }
            StorageSystem remoteSystem = _dbClient.queryObject(StorageSystem.class, URI.create(remoteSystemUri));
            if (remoteSystem != null) {
                StorageSystemConnectivityRestRep connection = new StorageSystemConnectivityRestRep();
                connection.getConnectionTypes().add(SupportedReplicationTypes.SRDF.toString());
                connection.setProtectionSystem(toNamedRelatedResource(ResourceTypeEnum.PROTECTION_SYSTEM, URI.create(remoteSystemUri), remoteSystem.getSerialNumber()));
                connection.setStorageSystem(toNamedRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, system.getId(), system.getSerialNumber()));
                // The key is a transient unique ID, since none of the actual fields guarantee
                // uniqueness.
                // We use this to make sure we don't add the same storage system more than once
                // for the same
                // protection system and connection type.
                String key = connection.getProtectionSystem().toString() + connection.getConnectionTypes() + connection.getStorageSystem().toString();
                if (!existing.contains(key)) {
                    existing.add(key);
                    connectivityList.getConnections().add(connection);
                }
            }
        }
    }
    return connectivityList;
}
Also used : StorageSystemConnectivityList(com.emc.storageos.model.systems.StorageSystemConnectivityList) StorageSystemConnectivityRestRep(com.emc.storageos.model.systems.StorageSystemConnectivityRestRep) HashSet(java.util.HashSet) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 2 with StorageSystemConnectivityList

use of com.emc.storageos.model.systems.StorageSystemConnectivityList in project coprhd-controller by CoprHD.

the class VPlexBlockServiceApiImpl method getStorageSystemConnectivity.

@Override
public StorageSystemConnectivityList getStorageSystemConnectivity(StorageSystem storageSystem) {
    // Connectivity list to return
    StorageSystemConnectivityList connectivityList = new StorageSystemConnectivityList();
    // Set used to ensure unique values are added to the connectivity list
    Set<String> existing = new HashSet<String>();
    // List to store all vplexes found
    List<StorageSystem> vplexes = new ArrayList<StorageSystem>();
    // First determine whether or not this Storage System is a VPLEX
    if (ConnectivityUtil.isAVPlex(storageSystem)) {
        vplexes.add(storageSystem);
    } else {
        // If it's not a VPLEX find any associated VPLEXs for this Storage System
        Set<URI> vplexSystems = ConnectivityUtil.getVPlexSystemsAssociatedWithArray(_dbClient, storageSystem.getId());
        for (URI uri : vplexSystems) {
            StorageSystem vplexSystem = _dbClient.queryObject(StorageSystem.class, uri);
            vplexes.add(vplexSystem);
        }
    }
    // result list.
    for (StorageSystem vplexSystem : vplexes) {
        // Loop through the associated Storage Systems to build the connectivity response list.
        // Only store unique responses.
        Set<URI> associatedSystemURIs = ConnectivityUtil.getStorageSystemAssociationsByNetwork(_dbClient, vplexSystem.getId(), StoragePort.PortType.backend);
        for (URI associatedStorageSystemURI : associatedSystemURIs) {
            StorageSystem associatedStorageSystem = _dbClient.queryObject(StorageSystem.class, associatedStorageSystemURI);
            if (associatedStorageSystem == null || associatedStorageSystem.getInactive() || ConnectivityUtil.isAVPlex(associatedStorageSystem) || storageSystem.getId().equals(associatedStorageSystemURI)) {
                continue;
            }
            StorageSystemConnectivityRestRep connection = new StorageSystemConnectivityRestRep();
            connection.getConnectionTypes().add(DiscoveredDataObject.Type.vplex.toString());
            connection.setProtectionSystem(toNamedRelatedResource(ResourceTypeEnum.PROTECTION_SYSTEM, vplexSystem.getId(), vplexSystem.getNativeGuid()));
            connection.setStorageSystem(toNamedRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, associatedStorageSystem.getId(), associatedStorageSystem.getNativeGuid()));
            // The key is a transient unique ID, since none of the actual fields guarantee uniqueness.
            // We use this to make sure we don't add the same storage system more than once for the same
            // protection system and connection type.
            String key = connection.getProtectionSystem().toString() + connection.getConnectionTypes() + connection.getStorageSystem().toString();
            if (!existing.contains(key)) {
                existing.add(key);
                connectivityList.getConnections().add(connection);
            }
        }
    }
    return connectivityList;
}
Also used : StorageSystemConnectivityList(com.emc.storageos.model.systems.StorageSystemConnectivityList) StorageSystemConnectivityRestRep(com.emc.storageos.model.systems.StorageSystemConnectivityRestRep) ArrayList(java.util.ArrayList) FCTN_STRING_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) FCTN_VPLEX_MIRROR_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_VPLEX_MIRROR_TO_URI) HashSet(java.util.HashSet) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 3 with StorageSystemConnectivityList

use of com.emc.storageos.model.systems.StorageSystemConnectivityList in project coprhd-controller by CoprHD.

the class RPBlockServiceApiImpl method getStorageSystemConnectivity.

@Override
public StorageSystemConnectivityList getStorageSystemConnectivity(StorageSystem system) {
    _log.debug("getStorageSystemConnectivity START");
    // Connectivity list to return
    StorageSystemConnectivityList connectivityList = new StorageSystemConnectivityList();
    // Set used to ensure unique values are added to the connectivity list
    Set<String> existing = new HashSet<String>();
    // Get all the RPSiteArrays that contain this Storage System
    List<RPSiteArray> rpSiteArrays = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, RPSiteArray.class, AlternateIdConstraint.Factory.getConstraint(RPSiteArray.class, "storageSystem", system.getId().toString()));
    Map<URI, ProtectionSystem> protSysMap = new HashMap<URI, ProtectionSystem>();
    Map<String, StorageSystem> storageSystemBySerialNumber = new HashMap<String, StorageSystem>();
    // For each of the RPSiteArrays get the Protection System
    for (RPSiteArray rpSiteArray : rpSiteArrays) {
        if ((rpSiteArray.getRpProtectionSystem() != null)) {
            ProtectionSystem protectionSystem = protSysMap.get(rpSiteArray.getRpProtectionSystem());
            if (protectionSystem == null) {
                protectionSystem = _dbClient.queryObject(ProtectionSystem.class, rpSiteArray.getRpProtectionSystem());
                protSysMap.put(protectionSystem.getId(), protectionSystem);
            }
            // connectivity response list. Only store unique responses.
            for (String associatedStorageSystemStr : protectionSystem.getAssociatedStorageSystems()) {
                String associatedStorageSystemSerialNumber = ProtectionSystem.getAssociatedStorageSystemSerialNumber(associatedStorageSystemStr);
                StorageSystem associatedStorageSystem = storageSystemBySerialNumber.get(associatedStorageSystemSerialNumber);
                if (associatedStorageSystem == null) {
                    URI associatedStorageSystemURI = ConnectivityUtil.findStorageSystemBySerialNumber(associatedStorageSystemSerialNumber, _dbClient, StorageSystemType.BLOCK);
                    associatedStorageSystem = _dbClient.queryObject(StorageSystem.class, associatedStorageSystemURI);
                    if (associatedStorageSystem == null || associatedStorageSystem.getInactive()) {
                        continue;
                    }
                    storageSystemBySerialNumber.put(associatedStorageSystemSerialNumber, associatedStorageSystem);
                }
                if (ConnectivityUtil.isAVPlex(associatedStorageSystem)) {
                    continue;
                }
                StorageSystemConnectivityRestRep connection = new StorageSystemConnectivityRestRep();
                connection.getConnectionTypes().add(ProtectionSystem._RP);
                connection.setProtectionSystem(toNamedRelatedResource(ResourceTypeEnum.PROTECTION_SYSTEM, rpSiteArray.getRpProtectionSystem(), protectionSystem.getLabel()));
                connection.setStorageSystem(toNamedRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, associatedStorageSystem.getId(), associatedStorageSystem.getSerialNumber()));
                // The key is a transient unique ID, since none of the actual fields guarantee uniqueness.
                // We use this to make sure we don't add the same storage system more than once for the same
                // protection system and connection type.
                String key = connection.getProtectionSystem().toString() + connection.getConnectionTypes() + connection.getStorageSystem().toString();
                if (!existing.contains(key)) {
                    existing.add(key);
                    connectivityList.getConnections().add(connection);
                }
            }
        }
    }
    _log.debug("getStorageSystemConnectivity END");
    return connectivityList;
}
Also used : RPSiteArray(com.emc.storageos.db.client.model.RPSiteArray) StorageSystemConnectivityList(com.emc.storageos.model.systems.StorageSystemConnectivityList) HashMap(java.util.HashMap) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) StorageSystemConnectivityRestRep(com.emc.storageos.model.systems.StorageSystemConnectivityRestRep) HashSet(java.util.HashSet) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 4 with StorageSystemConnectivityList

use of com.emc.storageos.model.systems.StorageSystemConnectivityList in project coprhd-controller by CoprHD.

the class DefaultBlockServiceApiImpl method getStorageSystemConnectivity.

// Connectivity for a VNX/VMAX array is determined by the various protection systems.
// This method calls all the known protection systems to find out which are covering
// this StorageArray.
@Override
public StorageSystemConnectivityList getStorageSystemConnectivity(StorageSystem storageSystem) {
    Map<String, AbstractBlockServiceApiImpl> apiMap = AbstractBlockServiceApiImpl.getProtectionImplementations();
    StorageSystemConnectivityList result = new StorageSystemConnectivityList();
    for (AbstractBlockServiceApiImpl impl : apiMap.values()) {
        if (impl == this) {
            // no infinite recursion
            continue;
        }
        StorageSystemConnectivityList list = impl.getStorageSystemConnectivity(storageSystem);
        result.getConnections().addAll(list.getConnections());
    }
    return result;
}
Also used : StorageSystemConnectivityList(com.emc.storageos.model.systems.StorageSystemConnectivityList)

Aggregations

StorageSystemConnectivityList (com.emc.storageos.model.systems.StorageSystemConnectivityList)4 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)3 StorageSystemConnectivityRestRep (com.emc.storageos.model.systems.StorageSystemConnectivityRestRep)3 HashSet (java.util.HashSet)3 NamedURI (com.emc.storageos.db.client.model.NamedURI)2 URI (java.net.URI)2 ProtectionSystem (com.emc.storageos.db.client.model.ProtectionSystem)1 RPSiteArray (com.emc.storageos.db.client.model.RPSiteArray)1 FCTN_STRING_TO_URI (com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI)1 FCTN_VPLEX_MIRROR_TO_URI (com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_VPLEX_MIRROR_TO_URI)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1