Search in sources :

Example 1 with MultipathCommand

use of com.iwave.ext.linux.command.MultipathCommand in project coprhd-controller by CoprHD.

the class CheckForMultipath method executeTask.

@Override
public String executeTask() throws Exception {
    MultipathCommand command = new MultipathCommand();
    command.addArgument("-l");
    try {
        executeCommand(command, SHORT_TIMEOUT);
        CommandOutput output = command.getOutput();
        if (output.getExitValue() != 0) {
            return getMessage("CheckForMultipath.noMultipath");
        }
        return null;
    } catch (Exception e) {
        return e.getMessage();
    }
}
Also used : CommandOutput(com.iwave.ext.command.CommandOutput) MultipathCommand(com.iwave.ext.linux.command.MultipathCommand)

Example 2 with MultipathCommand

use of com.iwave.ext.linux.command.MultipathCommand in project coprhd-controller by CoprHD.

the class LinuxHostDiscoveryAdapter method checkMultipathSoftwareCompatibility.

private void checkMultipathSoftwareCompatibility(Host host) {
    LinuxSystemCLI cli = createLinuxCLI(host);
    String powerpathMessage = null;
    String multipathMessage = null;
    try {
        PowermtCheckRegistrationCommand command = new PowermtCheckRegistrationCommand();
        cli.executeCommand(command, SecureShellSupport.SHORT_TIMEOUT);
        // powerpath is installed
        LOG.info("PowerPath is installed");
        return;
    } catch (PowerPathException e) {
        powerpathMessage = e.getMessage();
        LOG.info("PowerPath is unavailable: " + powerpathMessage);
    } catch (Exception e) {
        LOG.info("Error while checking for powerpath: " + e.getMessage(), e);
    }
    try {
        MultipathCommand command = new MultipathCommand();
        command.addArgument("-l");
        cli.executeCommand(command, SecureShellSupport.SHORT_TIMEOUT);
        // multipath is installed
        LOG.info("Multipath is installed");
        return;
    } catch (MultipathException e) {
        multipathMessage = e.getMessage();
        LOG.info("Multipath is unavailable: " + multipathMessage);
    } catch (Exception e) {
        LOG.info("Error while checking for multipath: " + e.getMessage(), e);
    }
    throw new CompatibilityException("No multipath software available: \n" + powerpathMessage + "\n" + multipathMessage);
}
Also used : LinuxSystemCLI(com.iwave.ext.linux.LinuxSystemCLI) CompatibilityException(com.emc.storageos.computesystemcontroller.exceptions.CompatibilityException) PowermtCheckRegistrationCommand(com.iwave.ext.linux.command.powerpath.PowermtCheckRegistrationCommand) MultipathCommand(com.iwave.ext.linux.command.MultipathCommand) MultipathException(com.iwave.ext.linux.command.MultipathException) PowerPathException(com.iwave.ext.linux.command.powerpath.PowerPathException) MultipathException(com.iwave.ext.linux.command.MultipathException) PowerPathException(com.iwave.ext.linux.command.powerpath.PowerPathException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CompatibilityException(com.emc.storageos.computesystemcontroller.exceptions.CompatibilityException) CommandException(com.iwave.ext.command.CommandException) JSchException(com.jcraft.jsch.JSchException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)

Aggregations

MultipathCommand (com.iwave.ext.linux.command.MultipathCommand)2 CompatibilityException (com.emc.storageos.computesystemcontroller.exceptions.CompatibilityException)1 ComputeSystemControllerException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 CommandException (com.iwave.ext.command.CommandException)1 CommandOutput (com.iwave.ext.command.CommandOutput)1 LinuxSystemCLI (com.iwave.ext.linux.LinuxSystemCLI)1 MultipathException (com.iwave.ext.linux.command.MultipathException)1 PowerPathException (com.iwave.ext.linux.command.powerpath.PowerPathException)1 PowermtCheckRegistrationCommand (com.iwave.ext.linux.command.powerpath.PowermtCheckRegistrationCommand)1 JSchException (com.jcraft.jsch.JSchException)1