use of com.emc.storageos.xtremio.restapi.model.response.XtremIOLunMap in project coprhd-controller by CoprHD.
the class XtremIOExportOperations method findHLUsForInitiators.
@Override
public Set<Integer> findHLUsForInitiators(StorageSystem storage, List<String> initiatorNames, boolean mustHaveAllPorts) {
Set<Integer> usedHLUs = new HashSet<Integer>();
try {
XtremIOClient client = XtremIOProvUtils.getXtremIOClient(dbClient, storage, xtremioRestClientFactory);
Set<String> igNames = new HashSet<>();
String xioClusterName = client.getClusterDetails(storage.getSerialNumber()).getName();
for (String initiatorName : initiatorNames) {
initiatorName = Initiator.toPortNetworkId(initiatorName);
URIQueryResultList initiatorResult = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getInitiatorPortInitiatorConstraint(initiatorName), initiatorResult);
if (initiatorResult.iterator().hasNext()) {
Initiator initiator = dbClient.queryObject(Initiator.class, initiatorResult.iterator().next());
String igName = XtremIOProvUtils.getIGNameForInitiator(initiator, storage.getSerialNumber(), client, xioClusterName);
if (igName != null && !igName.isEmpty()) {
igNames.add(igName);
}
}
}
// get the lun maps for IGs
for (String igName : igNames) {
List<XtremIOObjectInfo> lunMapLinks = XtremIOProvUtils.getInitiatorGroupLunMaps(igName, xioClusterName, client);
List<XtremIOLunMap> lunMaps = client.getXtremIOLunMapsForLinks(lunMapLinks, xioClusterName);
for (XtremIOLunMap lunMap : lunMaps) {
_log.info("Looking at lun map {}; IG name: {}, Volume: {}, HLU: {}", lunMap.getMappingInfo().get(2), lunMap.getIgName(), lunMap.getVolumeName(), lunMap.getLun());
usedHLUs.add(Integer.valueOf(lunMap.getLun()));
}
}
_log.info(String.format("HLUs found for Initiators { %s }: %s", Joiner.on(',').join(initiatorNames), usedHLUs));
} catch (Exception e) {
String errMsg = "Encountered an error when attempting to query used HLUs for initiators: " + e.getMessage();
_log.error(errMsg, e);
throw XtremIOApiException.exceptions.hluRetrievalFailed(errMsg, e);
}
return usedHLUs;
}
use of com.emc.storageos.xtremio.restapi.model.response.XtremIOLunMap in project coprhd-controller by CoprHD.
the class XtremIOV1Client method getXtremIOLunMapsForLinks.
@Override
public List<XtremIOLunMap> getXtremIOLunMapsForLinks(List<XtremIOObjectInfo> lunMapLinks, String clusterName) throws Exception {
List<XtremIOLunMap> lunMapList = new ArrayList<XtremIOLunMap>();
for (XtremIOObjectInfo lunMapInfo : lunMapLinks) {
URI lunMapURI = URI.create(URIUtil.getFromPath(lunMapInfo.getHref()));
ClientResponse response = get(lunMapURI);
XtremIOLunMaps lunMaps = getResponseObject(XtremIOLunMaps.class, response);
log.debug("LunMap {}", lunMaps.getContent().getMappingInfo().get(1) + " - " + lunMaps.getContent().getMappingInfo().get(2));
lunMapList.add(lunMaps.getContent());
}
return lunMapList;
}
use of com.emc.storageos.xtremio.restapi.model.response.XtremIOLunMap in project coprhd-controller by CoprHD.
the class XtremIOV2Client method getXtremIOLunMaps.
@Override
public List<XtremIOLunMap> getXtremIOLunMaps(String clusterName) throws Exception {
String uriString = XtremIOConstants.XTREMIO_V2_LUNMAPS_STR.concat(XtremIOConstants.getInputClusterString(clusterName));
ClientResponse response = get(URI.create(uriString));
XtremIOLunMapsInfo lunMapLinks = getResponseObject(XtremIOLunMapsInfo.class, response);
log.info("Returned LunMaps Links size : {}", lunMapLinks.getLunMapInfo().length);
List<XtremIOLunMap> lunMapList = getXtremIOLunMapsForLinks(Arrays.asList(lunMapLinks.getLunMapInfo()), clusterName);
return lunMapList;
}
use of com.emc.storageos.xtremio.restapi.model.response.XtremIOLunMap in project coprhd-controller by CoprHD.
the class XtremIOV2Client method getXtremIOLunMapsForLinks.
@Override
public List<XtremIOLunMap> getXtremIOLunMapsForLinks(List<XtremIOObjectInfo> lunMapLinks, String clusterName) throws Exception {
List<XtremIOLunMap> lunMapList = new ArrayList<XtremIOLunMap>();
for (XtremIOObjectInfo lunMapInfo : lunMapLinks) {
URI lunMapURI = URI.create(URIUtil.getFromPath(lunMapInfo.getHref().concat(XtremIOConstants.getInputClusterString(clusterName))));
ClientResponse response = get(lunMapURI);
XtremIOLunMaps lunMaps = getResponseObject(XtremIOLunMaps.class, response);
log.info("LunMap {}", lunMaps.getContent().getMappingInfo().get(1) + " - " + lunMaps.getContent().getMappingInfo().get(2));
lunMapList.add(lunMaps.getContent());
}
return lunMapList;
}
use of com.emc.storageos.xtremio.restapi.model.response.XtremIOLunMap in project coprhd-controller by CoprHD.
the class XtremIOV1Client method getXtremIOLunMaps.
@Override
public List<XtremIOLunMap> getXtremIOLunMaps(String clusterName) throws Exception {
ClientResponse response = get(XtremIOConstants.XTREMIO_LUNMAPS_URI);
XtremIOLunMapsInfo lunMapLinks = getResponseObject(XtremIOLunMapsInfo.class, response);
log.info("Returned LunMaps Links size : {}", lunMapLinks.getLunMapInfo().length);
List<XtremIOLunMap> lunMapList = getXtremIOLunMapsForLinks(Arrays.asList(lunMapLinks.getLunMapInfo()), clusterName);
return lunMapList;
}
Aggregations