Search in sources :

Example 1 with PowerPathDevice

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

the class PowerPathInquiryParser method parseDevice.

private PowerPathDevice parseDevice(String deviceBlock) {
    Matcher deviceMatcher = DEVICE_PATTERN.matcher(deviceBlock);
    if (deviceMatcher.find()) {
        PowerPathDevice device = new PowerPathDevice();
        device.setDevice(deviceMatcher.group(1));
        device.setVendor(deviceMatcher.group(2));
        device.setProduct(deviceMatcher.group(3));
        device.setWwn(deviceMatcher.group(4));
        return device;
    }
    return null;
}
Also used : PowerPathDevice(com.iwave.ext.linux.model.PowerPathDevice) Matcher(java.util.regex.Matcher)

Example 2 with PowerPathDevice

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

the class FindPowerPathEntriesForMountPoint method executeTask.

@Override
public Void executeTask() throws Exception {
    List<PowerPathDevice> powerPathDevices = executeCommand(new PowerPathInquiry());
    for (VolumeSpec volume : volumes) {
        volume.powerpathDevices = Lists.newArrayList();
        String device = volume.mountPoint.getDevice();
        for (PowerPathDevice powerpathDevice : powerPathDevices) {
            logDebug("FindPowerPathEntriesForMountPoint.checking", powerpathDevice.getDeviceName(), powerpathDevice.getDevice(), device);
            if (StringUtils.equals(device, powerpathDevice.getDevice())) {
                volume.powerpathDevices.add(powerpathDevice);
                break;
            }
        }
        if (volume.powerpathDevices.size() == 0) {
            logWarn("FindPowerPathEntriesForMountPoint.noDevices", volume.mountPoint.getPath());
        }
    }
    return null;
}
Also used : VolumeSpec(com.emc.sa.service.linux.UnmountBlockVolumeHelper.VolumeSpec) PowerPathDevice(com.iwave.ext.linux.model.PowerPathDevice) PowerPathInquiry(com.iwave.ext.linux.command.powerpath.PowerPathInquiry)

Example 3 with PowerPathDevice

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

the class FindHDiskForVolume method tryExecute.

@Override
protected String tryExecute() {
    List<PowerPathDevice> devices = executeCommand(new ListHDisksCommand(usePowerPath, false));
    for (PowerPathDevice device : devices) {
        if (VolumeWWNUtils.wwnMatches(device.getWwn(), volume.getWwn())) {
            return device.getDevice();
        }
    }
    devices = executeCommand(new ListHDisksCommand(usePowerPath, true));
    for (PowerPathDevice device : devices) {
        if (VolumeWWNUtils.wwnMatches(device.getWwn(), volume.getWwn())) {
            return device.getDevice();
        }
    }
    // could not find associated hdisk for volume
    throw new HDiskNotFoundException(volume.getWwn());
}
Also used : PowerPathDevice(com.iwave.ext.linux.model.PowerPathDevice) ListHDisksCommand(com.emc.aix.command.ListHDisksCommand)

Example 4 with PowerPathDevice

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

the class FindPowerPathEntriesForMountPoint method executeTask.

@Override
public Void executeTask() throws Exception {
    List<PowerPathDevice> powerPathDevices = executeCommand(new PowerPathInquiry());
    for (VolumeSpec volume : volumes) {
        volume.powerpathDevices = Lists.newArrayList();
        String device = volume.mountPoint.getDevice();
        for (PowerPathDevice powerpathDevice : powerPathDevices) {
            if (StringUtils.equals(device, powerpathDevice.getDevice())) {
                volume.powerpathDevices.add(powerpathDevice);
                break;
            }
        }
        if (volume.powerpathDevices.size() == 0) {
            warn("No PowerPath devices for %s", volume.mountPoint.getPath());
        }
    }
    return null;
}
Also used : VolumeSpec(com.emc.sa.service.aix.UnmountBlockVolumeHelper.VolumeSpec) PowerPathDevice(com.iwave.ext.linux.model.PowerPathDevice) PowerPathInquiry(com.emc.aix.command.PowerPathInquiry)

Example 5 with PowerPathDevice

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

the class LinuxSupport method findPowerPathDevices.

public void findPowerPathDevices(List<VolumeSpec> volumes) {
    for (VolumeSpec volume : volumes) {
        PowerPathDevice device = execute(new FindPowerPathEntryForVolume(volume.viprVolume));
        volume.powerpathDevices = Lists.newArrayList(device);
    }
}
Also used : VolumeSpec(com.emc.sa.service.linux.UnmountBlockVolumeHelper.VolumeSpec) RemovePowerPathDevice(com.emc.sa.service.linux.tasks.RemovePowerPathDevice) PowerPathDevice(com.iwave.ext.linux.model.PowerPathDevice) FindPowerPathEntryForVolume(com.emc.sa.service.linux.tasks.FindPowerPathEntryForVolume)

Aggregations

PowerPathDevice (com.iwave.ext.linux.model.PowerPathDevice)9 Matcher (java.util.regex.Matcher)3 VolumeSpec (com.emc.sa.service.linux.UnmountBlockVolumeHelper.VolumeSpec)2 PowerPathInquiry (com.iwave.ext.linux.command.powerpath.PowerPathInquiry)2 ListHDisksCommand (com.emc.aix.command.ListHDisksCommand)1 PowerPathInquiry (com.emc.aix.command.PowerPathInquiry)1 VolumeSpec (com.emc.sa.service.aix.UnmountBlockVolumeHelper.VolumeSpec)1 FindPowerPathEntryForVolume (com.emc.sa.service.linux.tasks.FindPowerPathEntryForVolume)1 RemovePowerPathDevice (com.emc.sa.service.linux.tasks.RemovePowerPathDevice)1 PowerPathHDSInquiry (com.iwave.ext.linux.command.powerpath.PowerPathHDSInquiry)1 PowerPathInvistaInquiry (com.iwave.ext.linux.command.powerpath.PowerPathInvistaInquiry)1