Search in sources :

Example 1 with XtremIOVolumesFull

use of com.emc.storageos.xtremio.restapi.model.response.XtremIOVolumesFull in project coprhd-controller by CoprHD.

the class XtremIOV2Client method getVolumesForAllInitiatorGroups.

@Override
public XtremIOVolumesFull getVolumesForAllInitiatorGroups(String clusterName, StringBuilder volumeURL) throws Exception {
    String filterString = String.format(XtremIOConstants.XTREMIO_VOLUME_IG_FILTER_FULL_STR, clusterName);
    StringBuilder uriString = new StringBuilder(new StringBuilder(XtremIOConstants.XTREMIO_V2_VOLUMES_STR).append(filterString).append(volumeURL));
    String uri = uriString.substring(0, uriString.length() - 1);
    ClientResponse response = get(URI.create(uri));
    XtremIOVolumesFull lunMapLinks = getResponseObject(XtremIOVolumesFull.class, response);
    return lunMapLinks;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) XtremIOVolumesFull(com.emc.storageos.xtremio.restapi.model.response.XtremIOVolumesFull)

Example 2 with XtremIOVolumesFull

use of com.emc.storageos.xtremio.restapi.model.response.XtremIOVolumesFull in project coprhd-controller by CoprHD.

the class XtremIOProvUtils method getLunMapAndVolumes.

public static Map<String, List<XtremIOVolume>> getLunMapAndVolumes(Set<String> igNameSet, String clusterName, XtremIOClient client, Map<String, List<XtremIOVolume>> igNameToVolMap) throws Exception {
    List<XtremIOLunMapFull> igLunMaps = new ArrayList<>();
    long starttime = 0l;
    starttime = System.nanoTime();
    igLunMaps = client.getLunMapsForAllInitiatorGroups(igNameSet, clusterName);
    _log.debug("Time taken for All Lun API Call : " + "total time = " + String.format("%2.6f", (System.nanoTime() - starttime) / 1000000000.0) + " seconds");
    HashMap<String, List<String>> map = new HashMap<>();
    HashMap<String, XtremIOVolume> indexInfoMap = new HashMap<>();
    StringBuilder volumeURL = new StringBuilder();
    String indexFilter = "index:eq:";
    int indexSize = 0;
    long starttime1 = System.nanoTime();
    for (XtremIOLunMapFull lunMapFull : igLunMaps) {
        for (XtremIOLunMap lunmap : lunMapFull.getContent()) {
            if (map.containsKey(lunmap.getIgName())) {
                map.get(lunmap.getIgName()).add(lunmap.getVolumeIndex());
                map.put(lunmap.getIgName(), map.get(lunmap.getIgName()));
                volumeURL = volumeURL.append(indexFilter).append(lunmap.getVolumeIndex()).append(",");
                indexSize++;
            } else {
                List<String> volumeIndexList = new ArrayList<>();
                volumeIndexList.add(lunmap.getVolumeIndex());
                map.put(lunmap.getIgName(), volumeIndexList);
                volumeURL = volumeURL.append(indexFilter).append(lunmap.getVolumeIndex()).append(",");
                indexSize++;
            }
            if (indexSize >= XtremIOConstants.XTREMIO_MAX_Filters) {
                starttime = System.nanoTime();
                XtremIOVolumesFull volumes = client.getVolumesForAllInitiatorGroups(clusterName, volumeURL);
                _log.debug("Time taken for Volume API Call : " + "total time = " + String.format("%2.6f", (System.nanoTime() - starttime) / 1000000000.0) + " seconds , numFilters = " + indexSize);
                for (XtremIOVolume volume : volumes.getContent()) {
                    indexInfoMap.put(volume.getVolInfo().get(2), volume);
                }
                volumeURL = new StringBuilder();
                indexSize = 0;
            }
        }
    }
    starttime = System.nanoTime();
    XtremIOVolumesFull volumes = client.getVolumesForAllInitiatorGroups(clusterName, volumeURL);
    _log.debug("Time taken for Volume API Call : " + "total time = " + String.format("%2.6f", (System.nanoTime() - starttime) / 1000000000.0) + " seconds , numFilters = " + indexSize);
    _log.debug("Time taken for All Volume API Call : " + "total time = " + String.format("%2.6f", (System.nanoTime() - starttime1) / 1000000000.0) + " seconds ");
    for (XtremIOVolume volume : volumes.getContent()) {
        indexInfoMap.put(volume.getVolInfo().get(2), volume);
    }
    for (Map.Entry<String, List<String>> entry1 : map.entrySet()) {
        List<XtremIOVolume> discoveredVolumes = new ArrayList<>();
        for (Map.Entry<String, XtremIOVolume> entry2 : indexInfoMap.entrySet()) {
            if (entry1.getValue().contains(entry2.getKey())) {
                discoveredVolumes.add(entry2.getValue());
            }
        }
        igNameToVolMap.put(entry1.getKey(), discoveredVolumes);
    }
    return igNameToVolMap;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) XtremIOLunMap(com.emc.storageos.xtremio.restapi.model.response.XtremIOLunMap) XtremIOVolumesFull(com.emc.storageos.xtremio.restapi.model.response.XtremIOVolumesFull) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) XtremIOVolume(com.emc.storageos.xtremio.restapi.model.response.XtremIOVolume) XtremIOLunMapFull(com.emc.storageos.xtremio.restapi.model.response.XtremIOLunMapFull) ArrayList(java.util.ArrayList) List(java.util.List) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) HashMap(java.util.HashMap) Map(java.util.Map) XtremIOLunMap(com.emc.storageos.xtremio.restapi.model.response.XtremIOLunMap)

Aggregations

XtremIOVolumesFull (com.emc.storageos.xtremio.restapi.model.response.XtremIOVolumesFull)2 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 XtremIOLunMap (com.emc.storageos.xtremio.restapi.model.response.XtremIOLunMap)1 XtremIOLunMapFull (com.emc.storageos.xtremio.restapi.model.response.XtremIOLunMapFull)1 XtremIOVolume (com.emc.storageos.xtremio.restapi.model.response.XtremIOVolume)1 ClientResponse (com.sun.jersey.api.client.ClientResponse)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1