Search in sources :

Example 1 with HostDeviceInputOutput

use of com.emc.storageos.computesystemcontroller.hostmountadapters.HostDeviceInputOutput in project coprhd-controller by CoprHD.

the class ComputeSystemOrchestrationDeviceController method unmountDevice.

@Override
public void unmountDevice(URI hostId, URI resId, String mountPath, String opId) throws ControllerException {
    HostDeviceInputOutput args = new HostDeviceInputOutput();
    args.setHostId(hostId);
    args.setResId(resId);
    args.setMountPath(mountPath);
    // Generate the Workflow.
    Workflow workflow = null;
    MountCompleter completer = new MountCompleter(args.getResId(), opId);
    try {
        // Generate the Workflow.
        workflow = _workflowService.getNewWorkflow(this, UNMOUNT_DEVICE_WF_NAME, false, opId);
        _computeSystemControllerImpl.addStepsForUnmountDevice(workflow, args);
        // Finish up and execute the plan.
        // The Workflow will handle the TaskCompleter
        String successMessage = "Unmount device successful for: " + args.getHostId().toString();
        workflow.executePlan(completer, successMessage);
    } catch (Exception ex) {
        _log.error("Could not unmount device: " + args, ex);
        ComputeSystemControllerException exception = ComputeSystemControllerException.exceptions.unableToUnmount(_dbClient.queryObject(Host.class, args.getHostId()).getType(), ex);
        completer.error(_dbClient, exception);
        _workflowService.releaseAllWorkflowLocks(workflow);
        throw ex;
    }
}
Also used : ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) MountCompleter(com.emc.storageos.computesystemcontroller.hostmountadapters.MountCompleter) HostDeviceInputOutput(com.emc.storageos.computesystemcontroller.hostmountadapters.HostDeviceInputOutput) Workflow(com.emc.storageos.workflow.Workflow) Host(com.emc.storageos.db.client.model.Host) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)

Example 2 with HostDeviceInputOutput

use of com.emc.storageos.computesystemcontroller.hostmountadapters.HostDeviceInputOutput in project coprhd-controller by CoprHD.

the class ComputeSystemOrchestrationDeviceController method mountDevice.

@Override
public void mountDevice(URI hostId, URI resId, String subDirectory, String security, String mountPath, String fsType, String opId) throws ControllerException {
    HostDeviceInputOutput args = new HostDeviceInputOutput();
    args.setSubDirectory(subDirectory);
    args.setHostId(hostId);
    args.setResId(resId);
    args.setSecurity(security);
    args.setMountPath(mountPath);
    args.setFsType(fsType);
    // Generate the Workflow.
    Workflow workflow = null;
    MountCompleter completer = new MountCompleter(args.getResId(), opId);
    try {
        // Generate the Workflow.
        workflow = _workflowService.getNewWorkflow(this, MOUNT_DEVICE_WF_NAME, false, opId);
        _computeSystemControllerImpl.addStepsForMountDevice(workflow, args);
        // Finish up and execute the plan.
        // The Workflow will handle the TaskCompleter
        String successMessage = "Mount device successful for: " + args.getHostId().toString();
        workflow.executePlan(completer, successMessage);
    } catch (Exception ex) {
        _log.error("Could not mount device: " + args, ex);
        ComputeSystemControllerException exception = ComputeSystemControllerException.exceptions.unableToMount(_dbClient.queryObject(Host.class, args.getHostId()).getType(), ex);
        completer.error(_dbClient, exception);
        _workflowService.releaseAllWorkflowLocks(workflow);
        throw ex;
    }
}
Also used : ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) MountCompleter(com.emc.storageos.computesystemcontroller.hostmountadapters.MountCompleter) HostDeviceInputOutput(com.emc.storageos.computesystemcontroller.hostmountadapters.HostDeviceInputOutput) Workflow(com.emc.storageos.workflow.Workflow) Host(com.emc.storageos.db.client.model.Host) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)

Aggregations

ComputeSystemControllerException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)2 HostDeviceInputOutput (com.emc.storageos.computesystemcontroller.hostmountadapters.HostDeviceInputOutput)2 MountCompleter (com.emc.storageos.computesystemcontroller.hostmountadapters.MountCompleter)2 Host (com.emc.storageos.db.client.model.Host)2 ControllerException (com.emc.storageos.volumecontroller.ControllerException)2 Workflow (com.emc.storageos.workflow.Workflow)2