use of com.emc.storageos.model.block.export.ITLRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method findBlockVolumeHLUs.
public static Map<URI, Integer> findBlockVolumeHLUs(Collection<URI> volumeIds) {
List<ITLRestRep> bulkResponse = execute(new FindBlockVolumeHlus(volumeIds));
Map<URI, Integer> volumeHLUs = Maps.newHashMap();
for (ITLRestRep export : bulkResponse) {
ExportGroupRestRep exportGroup = getExport(export.getExport().getId());
if (!exportGroup.getInternal()) {
volumeHLUs.put(export.getBlockObject().getId(), export.getHlu());
}
}
return volumeHLUs;
}
use of com.emc.storageos.model.block.export.ITLRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method getExportToVolumesMap.
/**
* build map of export id to set of volumes in that export
*/
protected static Map<URI, Set<URI>> getExportToVolumesMap(List<URI> volumeIds) {
Map<URI, Set<URI>> exportToVolumesMap = Maps.newHashMap();
for (URI volumeId : volumeIds) {
for (ITLRestRep export : getExportsForBlockObject(volumeId)) {
Set<URI> volumesInExport = exportToVolumesMap.get(export.getExport().getId());
if (volumesInExport == null) {
volumesInExport = Sets.newHashSet(volumeId);
} else {
volumesInExport.add(volumeId);
}
exportToVolumesMap.put(export.getExport().getId(), volumesInExport);
}
}
return exportToVolumesMap;
}
use of com.emc.storageos.model.block.export.ITLRestRep in project coprhd-controller by CoprHD.
the class LinuxSupport method checkIScsiConnectivity.
private void checkIScsiConnectivity(Set<Initiator> initiators, BlockObjectRestRep volume) {
List<ITLRestRep> exports = BlockStorageUtils.getExportsForBlockObject(volume.getId());
List<ITLRestRep> connectedExports = BlockStorageUtils.getExportsForInitiators(exports, initiators);
// Ensure we have at least one connection to the volume
Set<String> targetPorts = BlockStorageUtils.getTargetPortsForExports(connectedExports);
String sourceIqns = StringUtils.join(BlockStorageUtils.getPortNames(initiators), ", ");
String targetIqns = StringUtils.join(targetPorts, ", ");
logInfo("linux.support.check.connectivity", sourceIqns, targetIqns);
int connections = 0;
List<IScsiHost> iScsiInitiators = findIScsiIInitiators(initiators);
for (IScsiHost iScsiInitiator : iScsiInitiators) {
for (IScsiSession session : iScsiInitiator.getSessions()) {
String sourceIqn = session.getIfaceInitiatorName();
if (session.getTarget() != null) {
String targetIqn = session.getTarget().getIqn();
if (targetPorts.contains(targetIqn)) {
logInfo("linux.support.connected", sourceIqn, targetIqn);
connections++;
}
}
}
}
if (connections == 0) {
List<IScsiSession> iScsiSessions = findIScsiSessions(initiators);
for (IScsiSession session : iScsiSessions) {
String sourceIqn = session.getIfaceInitiatorName();
if (session.getTarget() != null) {
String targetIqn = session.getTarget().getIqn();
if (targetPorts.contains(targetIqn)) {
logInfo("linux.support.connected", sourceIqn, targetIqn);
connections++;
}
}
}
}
if (connections == 0) {
Object[] detailArgs = new Object[] { volume.getId(), buildInitiatorsString(initiators) };
Object[] messageArgs = new Object[] { sourceIqns, targetIqns };
ExecutionUtils.fail("failTask.LinuxSupport.iqnConnectivity", detailArgs, messageArgs);
}
}
use of com.emc.storageos.model.block.export.ITLRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method getExportsForInitiators.
/**
* Finds the exports (itl) for the given initiators.
*
* @param exports
* the list of all exports (itl)
* @param initiators
* the initiators.
* @return the exports for the initiators.
*/
public static List<ITLRestRep> getExportsForInitiators(Collection<ITLRestRep> exports, Collection<Initiator> initiators) {
Set<String> initiatorPorts = Sets.newHashSet(getPortNames(initiators));
List<ITLRestRep> results = Lists.newArrayList();
for (ITLRestRep export : exports) {
if ((export.getInitiator() != null) && initiatorPorts.contains(export.getInitiator().getPort())) {
results.add(export);
}
}
return results;
}
use of com.emc.storageos.model.block.export.ITLRestRep in project coprhd-controller by CoprHD.
the class ResourceUtils method getHostExports.
public static List<HostExport> getHostExports(Collection<ITLRestRep> itls) {
Map<URI, HostExport> hostExports = Maps.newLinkedHashMap();
Map<ITLRestRep, ExportGroupRestRep> exportMap = getExportMap(itls);
for (Map.Entry<ITLRestRep, ExportGroupRestRep> entry : exportMap.entrySet()) {
HostRestRep host = getHost(entry.getKey(), entry.getValue());
if (host == null) {
continue;
}
HostExport hostExport = hostExports.get(host.getId());
if (hostExport == null) {
hostExport = createHostExport(host);
hostExports.put(host.getId(), hostExport);
}
hostExport.exportMap.put(entry.getKey(), entry.getValue());
}
return Lists.newArrayList(hostExports.values());
}
Aggregations