Search in sources :

Example 6 with ITLRestRep

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;
}
Also used : FindBlockVolumeHlus(com.emc.sa.service.vipr.block.tasks.FindBlockVolumeHlus) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ITLRestRep(com.emc.storageos.model.block.export.ITLRestRep) URI(java.net.URI)

Example 7 with ITLRestRep

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;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) GetBlockSnapshotSet(com.emc.sa.service.vipr.application.tasks.GetBlockSnapshotSet) ITLRestRep(com.emc.storageos.model.block.export.ITLRestRep) URI(java.net.URI)

Example 8 with ITLRestRep

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);
    }
}
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 9 with ITLRestRep

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;
}
Also used : ITLRestRep(com.emc.storageos.model.block.export.ITLRestRep)

Example 10 with ITLRestRep

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());
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ITLRestRep(com.emc.storageos.model.block.export.ITLRestRep) URI(java.net.URI) Map(java.util.Map)

Aggregations

ITLRestRep (com.emc.storageos.model.block.export.ITLRestRep)14 URI (java.net.URI)8 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)5 List (java.util.List)3 GetBlockSnapshotSet (com.emc.sa.service.vipr.application.tasks.GetBlockSnapshotSet)2 VolumeAttachResponse (com.emc.storageos.cinder.model.VolumeAttachResponse)2 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)2 ITLRestRepList (com.emc.storageos.model.block.export.ITLRestRepList)2 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 VerifyMountPoint (com.emc.sa.service.linux.tasks.VerifyMountPoint)1 FindBlockVolumeHlus (com.emc.sa.service.vipr.block.tasks.FindBlockVolumeHlus)1 SearchedResRepList (com.emc.storageos.api.service.impl.response.SearchedResRepList)1 BlockObject (com.emc.storageos.db.client.model.BlockObject)1 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)1 FCZoneReference (com.emc.storageos.db.client.model.FCZoneReference)1 Initiator (com.emc.storageos.db.client.model.Initiator)1 StoragePort (com.emc.storageos.db.client.model.StoragePort)1