use of com.emc.storageos.model.varray.VirtualArrayConnectivityRestRep in project coprhd-controller by CoprHD.
the class AbstractBlockServiceApiImpl method getVirtualArrayConnectivity.
/**
* Determines the Virtual Storage Array Connectivity of the given Virtual Storage Array
*
* @param dbClient
* - Static method needs DbClient
* @param varrayUID
* - UID of the varray to find the connectivity for
* @return A Set of VirtualArrayConnectivityRestRep
*/
public static Set<VirtualArrayConnectivityRestRep> getVirtualArrayConnectivity(DbClient dbClient, URI varrayUID) {
Set<VirtualArrayConnectivityRestRep> varrayConnectivity = new HashSet<VirtualArrayConnectivityRestRep>();
for (String key : getProtectionImplementations().keySet()) {
Set<URI> varrays = getProtectionImplementations().get(key).getConnectedVarrays(varrayUID);
Iterator<URI> it = varrays.iterator();
while (it.hasNext()) {
URI currentVirtualArrayUID = it.next();
VirtualArray varray = dbClient.queryObject(VirtualArray.class, currentVirtualArrayUID);
if (varray != null) {
VirtualArrayConnectivityRestRep connection = new VirtualArrayConnectivityRestRep();
connection.setVirtualArray(toNamedRelatedResource(ResourceTypeEnum.VARRAY, varray.getId(), varray.getLabel()));
StringSet connectivity = new StringSet();
connectivity.add(key);
connection.setConnectionType(connectivity);
varrayConnectivity.add(connection);
}
}
}
return varrayConnectivity;
}
use of com.emc.storageos.model.varray.VirtualArrayConnectivityRestRep in project coprhd-controller by CoprHD.
the class VirtualArrayService method getConnectivity.
/**
* Gets information about VirtualArrays that are connected to the passed in VirtualArray that support some kind of protection
*
* @param varray
* @return rest response
*/
private VirtualArrayConnectivityList getConnectivity(VirtualArray varray) {
Set<VirtualArrayConnectivityRestRep> connections = AbstractBlockServiceApiImpl.getVirtualArrayConnectivity(_dbClient, varray.getId());
VirtualArrayConnectivityList connectivityList = new VirtualArrayConnectivityList();
connectivityList.setConnections(new ArrayList<VirtualArrayConnectivityRestRep>());
connectivityList.getConnections().addAll(connections);
return connectivityList;
}
use of com.emc.storageos.model.varray.VirtualArrayConnectivityRestRep in project coprhd-controller by CoprHD.
the class VirtualArrayUtils method getConnectivityMap.
public static Map<String, Set<NamedRelatedResourceRep>> getConnectivityMap(String id) {
Map<String, Set<NamedRelatedResourceRep>> connectivityMap = Maps.newTreeMap();
for (VirtualArrayConnectivityRestRep connectivity : getConnectivity(id)) {
for (String type : connectivity.getConnectionType()) {
Set<NamedRelatedResourceRep> virtualArrays = connectivityMap.get(type);
if (virtualArrays == null) {
virtualArrays = Sets.newTreeSet(new NamedRelatedResourceComparator());
connectivityMap.put(type, virtualArrays);
}
virtualArrays.add(connectivity.getVirtualArray());
}
}
return connectivityMap;
}
Aggregations