Search in sources :

Example 1 with UnmountCommand

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

the class LinuxMountUtils method unmountPath.

public void unmountPath(String path) throws InternalException {
    UnmountCommand command = new UnmountCommand(STD_TIMEOUT);
    command.setPath(path);
    command.addArgument("; if [ $? -eq 124 ] ; then >&2 echo TIMEOUT ; else >&2 echo SUCCESSFUL ; fi");
    _log.info("unmount command:" + command.getResolvedCommandLine());
    cli.executeCommand(command);
    CommandOutput output = command.getOutput();
    if (output.getStderr().contains("TIMEOUT")) {
        ComputeSystemControllerException exception = ComputeSystemControllerException.exceptions.commandTimedOut(host.getHostName());
        throw exception;
    } else {
        String errMessage = output.getStderr().replace("SUCCESSFUL", "").replace("\n", "");
        if (!errMessage.isEmpty()) {
            ComputeSystemControllerException exception = ComputeSystemControllerException.exceptions.unableToUnmount(host.getHostName(), new Exception(errMessage));
            throw exception;
        }
    }
}
Also used : ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) UnmountCommand(com.iwave.ext.linux.command.UnmountCommand) CommandOutput(com.iwave.ext.command.CommandOutput) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)

Example 2 with UnmountCommand

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

the class UnmountPath method execute.

@Override
public void execute() throws Exception {
    try {
        UnmountCommand command = new UnmountCommand();
        command.setPath(path);
        executeCommand(command, SHORT_TIMEOUT);
    } catch (Exception ex) {
        ExecutionUtils.fail("failTask.UnmountPath", new Object[] { path }, path, ex.getMessage(), path);
    }
}
Also used : UnmountCommand(com.iwave.ext.linux.command.UnmountCommand)

Example 3 with UnmountCommand

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

the class UnmountPath method execute.

@Override
public void execute() throws Exception {
    UnmountCommand command = new UnmountCommand();
    command.setPath(path);
    executeCommand(command, SHORT_TIMEOUT);
}
Also used : UnmountCommand(com.iwave.ext.linux.command.UnmountCommand)

Example 4 with UnmountCommand

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

the class UnmountPath method execute.

@Override
public void execute() throws Exception {
    try {
        UnmountCommand command = new UnmountCommand();
        command.setPath(path);
        executeCommand(command, SHORT_TIMEOUT);
    } catch (Exception ex) {
        ExecutionUtils.fail("failTask.UnmountPath", new Object[] { path }, path, ex.getMessage(), path);
    }
}
Also used : UnmountCommand(com.iwave.ext.linux.command.UnmountCommand)

Aggregations

UnmountCommand (com.iwave.ext.linux.command.UnmountCommand)4 ComputeSystemControllerException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 CommandOutput (com.iwave.ext.command.CommandOutput)1