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