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