Search in sources :

Example 1 with MultiPathEntry

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

the class ListMultiPathEntriesCommand method parseOutput.

@Override
public void parseOutput() {
    results = Lists.newArrayList();
    if (getOutput() != null && getOutput().getStdout() != null) {
        String stdout = getOutput().getStdout();
        TextParser parser = new TextParser();
        parser.setRepeatPattern(ENTRY_PATTERN);
        for (String textBlock : parser.parseTextBlocks(stdout)) {
            MultiPathEntry entry = readEntry(textBlock);
            if (entry != null) {
                results.add(entry);
            }
        }
    }
}
Also used : TextParser(com.iwave.ext.text.TextParser) MultiPathEntry(com.iwave.ext.linux.model.MultiPathEntry)

Example 2 with MultiPathEntry

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

the class LinuxSupport method getParentMultipathDevice.

protected String getParentMultipathDevice(String device) {
    String parentDeviceDmName = execute(new GetMultipathPrimaryPartitionDeviceParentDmName(device));
    MultiPathEntry multipathEntry = execute(new FindMultiPathEntryForDmName(parentDeviceDmName));
    return StringUtils.substringBeforeLast(device, "/") + "/" + multipathEntry.getName();
}
Also used : FindMultiPathEntryForDmName(com.emc.sa.service.linux.tasks.FindMultiPathEntryForDmName) MultiPathEntry(com.iwave.ext.linux.model.MultiPathEntry) GetMultipathPrimaryPartitionDeviceParentDmName(com.emc.sa.service.linux.tasks.GetMultipathPrimaryPartitionDeviceParentDmName)

Example 3 with MultiPathEntry

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

the class LinuxSupport method findMultipathEntries.

public void findMultipathEntries(List<VolumeSpec> volumes) {
    for (VolumeSpec volume : volumes) {
        MultiPathEntry device = execute(new FindMultiPathEntryForVolume(volume.viprVolume));
        volume.multipathEntries = Lists.newArrayList(device);
    }
}
Also used : VolumeSpec(com.emc.sa.service.linux.UnmountBlockVolumeHelper.VolumeSpec) FindMultiPathEntryForVolume(com.emc.sa.service.linux.tasks.FindMultiPathEntryForVolume) MultiPathEntry(com.iwave.ext.linux.model.MultiPathEntry)

Example 4 with MultiPathEntry

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

the class FindMultiPathEntriesForMountPoint method executeTask.

@Override
public Void executeTask() throws Exception {
    List<MultiPathEntry> allMultiPathEntries = executeCommand(new ListMultiPathEntriesCommand(), SHORT_TIMEOUT);
    for (VolumeSpec volume : volumes) {
        volume.multipathEntries = Lists.newArrayList();
        String device = volume.mountPoint.getDevice();
        if (StringUtils.startsWith(device, "/dev/mapper/")) {
            String deviceName = StringUtils.substringAfterLast(device, "/");
            for (MultiPathEntry entry : allMultiPathEntries) {
                if (StringUtils.equals(deviceName, entry.getName())) {
                    volume.multipathEntries.add(entry);
                    break;
                }
            }
        }
        if (volume.multipathEntries.size() == 0) {
            warn("FindMultiPathEntriesForMountPoint.noMultipathEntries", volume.mountPoint.getPath());
        }
    }
    return null;
}
Also used : VolumeSpec(com.emc.sa.service.linux.UnmountBlockVolumeHelper.VolumeSpec) ListMultiPathEntriesCommand(com.iwave.ext.linux.command.ListMultiPathEntriesCommand) MultiPathEntry(com.iwave.ext.linux.model.MultiPathEntry)

Example 5 with MultiPathEntry

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

the class FindMultiPathEntryForDmName method findMultiPathEntry.

protected MultiPathEntry findMultiPathEntry(String dmName, List<MultiPathEntry> multipathEntries) {
    for (MultiPathEntry entry : multipathEntries) {
        String entryDmName = entry.getDmName();
        logDebug("FindMultiPathEntryForDmName.log.checking", entry.getName(), entry.getDmName(), dmName);
        if (StringUtils.equalsIgnoreCase(entryDmName, dmName)) {
            return entry;
        }
    }
    return null;
}
Also used : MultiPathEntry(com.iwave.ext.linux.model.MultiPathEntry)

Aggregations

MultiPathEntry (com.iwave.ext.linux.model.MultiPathEntry)9 ListMultiPathEntriesCommand (com.iwave.ext.linux.command.ListMultiPathEntriesCommand)3 VolumeSpec (com.emc.sa.service.linux.UnmountBlockVolumeHelper.VolumeSpec)2 FindMultiPathEntryForDmName (com.emc.sa.service.linux.tasks.FindMultiPathEntryForDmName)1 FindMultiPathEntryForVolume (com.emc.sa.service.linux.tasks.FindMultiPathEntryForVolume)1 GetMultipathPrimaryPartitionDeviceParentDmName (com.emc.sa.service.linux.tasks.GetMultipathPrimaryPartitionDeviceParentDmName)1 TextParser (com.iwave.ext.text.TextParser)1 Matcher (java.util.regex.Matcher)1