Search in sources :

Example 1 with IScsiHost

use of com.iwave.ext.linux.model.IScsiHost 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);
    }
}
Also used : IScsiSession(com.iwave.ext.linux.model.IScsiSession) IScsiHost(com.iwave.ext.linux.model.IScsiHost) ITLRestRep(com.emc.storageos.model.block.export.ITLRestRep) VerifyMountPoint(com.emc.sa.service.linux.tasks.VerifyMountPoint) MountPoint(com.iwave.ext.linux.model.MountPoint)

Example 2 with IScsiHost

use of com.iwave.ext.linux.model.IScsiHost in project coprhd-controller by CoprHD.

the class FindIScsiInitiators method executeTask.

@Override
public List<IScsiHost> executeTask() throws Exception {
    List<IScsiHost> hosts = executeCommand(new ListIScsiHostsCommand(), SHORT_TIMEOUT);
    Iterator<IScsiHost> iter = hosts.iterator();
    while (iter.hasNext()) {
        IScsiHost host = iter.next();
        if (!isMatch(host)) {
            iter.remove();
        }
    }
    return hosts;
}
Also used : IScsiHost(com.iwave.ext.linux.model.IScsiHost) ListIScsiHostsCommand(com.iwave.ext.linux.command.iscsi.ListIScsiHostsCommand)

Example 3 with IScsiHost

use of com.iwave.ext.linux.model.IScsiHost in project coprhd-controller by CoprHD.

the class IScsiHostParser method parseHost.

public IScsiHost parseHost(String text) {
    if (StringUtils.isBlank(text)) {
        return null;
    }
    Map<String, String> properties = parser.parseProperties(text, ':');
    IScsiHost host = new IScsiHost();
    host.setHostId(NumberUtils.toInt(properties.get(HOST_NUMBER)));
    host.setState(properties.get(STATE));
    host.setTransport(properties.get(TRANSPORT));
    host.setInitiatorName(properties.get(INITIATOR_NAME));
    host.setIpAddress(properties.get(IP_ADDRESS));
    host.setHwAddress(properties.get(HW_ADDRESS));
    host.setNetdev(properties.get(NETDEV));
    host.setSessions(sessionParser.parseSessions(text));
    return host;
}
Also used : IScsiHost(com.iwave.ext.linux.model.IScsiHost)

Aggregations

IScsiHost (com.iwave.ext.linux.model.IScsiHost)3 VerifyMountPoint (com.emc.sa.service.linux.tasks.VerifyMountPoint)1 ITLRestRep (com.emc.storageos.model.block.export.ITLRestRep)1 ListIScsiHostsCommand (com.iwave.ext.linux.command.iscsi.ListIScsiHostsCommand)1 IScsiSession (com.iwave.ext.linux.model.IScsiSession)1 MountPoint (com.iwave.ext.linux.model.MountPoint)1