use of com.emc.storageos.xtremio.restapi.model.response.XtremIOLunMapFull 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;
}
use of com.emc.storageos.xtremio.restapi.model.response.XtremIOLunMapFull in project coprhd-controller by CoprHD.
the class XtremIOV2Client method getLunMapsForAllInitiatorGroups.
@Override
public List<XtremIOLunMapFull> getLunMapsForAllInitiatorGroups(Set<String> igNameSet, String clusterName) throws Exception {
String filterString = String.format(XtremIOConstants.XTREMIO_LUNMAP_IG_FILTER_FULL_STR, clusterName);
List<XtremIOLunMapFull> igLunMapsList = new ArrayList<>();
int indexSize = 0;
for (String igName : igNameSet) {
if (igName != null) {
filterString = filterString + "ig-name:eq:" + igName + ",";
indexSize++;
}
if (indexSize >= XtremIOConstants.XTREMIO_MAX_Filters) {
filterString = filterString.substring(0, filterString.length() - 1);
String uriString = XtremIOConstants.XTREMIO_V2_LUNMAPS_STR.concat(filterString);
ClientResponse response = get(URI.create(uriString));
XtremIOLunMapFull lunMapLinks = getResponseObject(XtremIOLunMapFull.class, response);
igLunMapsList.add(lunMapLinks);
indexSize = 0;
filterString = String.format(XtremIOConstants.XTREMIO_LUNMAP_IG_FILTER_FULL_STR, clusterName);
}
}
filterString = filterString.substring(0, filterString.length() - 1);
String uriString = XtremIOConstants.XTREMIO_V2_LUNMAPS_STR.concat(filterString);
ClientResponse response = get(URI.create(uriString));
XtremIOLunMapFull lunMapLinks = getResponseObject(XtremIOLunMapFull.class, response);
igLunMapsList.add(lunMapLinks);
return igLunMapsList;
}
Aggregations