Search in sources :

Example 1 with VirtualArrayConnectivityRestRep

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;
}
Also used : VirtualArrayConnectivityRestRep(com.emc.storageos.model.varray.VirtualArrayConnectivityRestRep) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StringSet(com.emc.storageos.db.client.model.StringSet) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) HashSet(java.util.HashSet)

Example 2 with VirtualArrayConnectivityRestRep

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;
}
Also used : VirtualArrayConnectivityRestRep(com.emc.storageos.model.varray.VirtualArrayConnectivityRestRep) VirtualArrayConnectivityList(com.emc.storageos.model.varray.VirtualArrayConnectivityList)

Example 3 with VirtualArrayConnectivityRestRep

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;
}
Also used : VirtualArrayConnectivityRestRep(com.emc.storageos.model.varray.VirtualArrayConnectivityRestRep) TreeSet(java.util.TreeSet) Set(java.util.Set) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Aggregations

VirtualArrayConnectivityRestRep (com.emc.storageos.model.varray.VirtualArrayConnectivityRestRep)3 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)1 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 VirtualArrayConnectivityList (com.emc.storageos.model.varray.VirtualArrayConnectivityList)1 URI (java.net.URI)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1