Search in sources :

Example 1 with HostMountAdapter

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

the class ComputeSystemControllerImpl method mountDir.

public void mountDir(URI resId, URI hostId, String mountPath, String subDir, String security, String fsType, String stepId) {
    try {
        HostMountAdapter adapter = getMountAdapters().get(_dbClient.queryObject(Host.class, hostId).getType());
        WorkflowStepCompleter.stepExecuting(stepId);
        List<String> lockKeys = new ArrayList<String>();
        lockKeys.add(ControllerLockingUtil.getMountHostKey(_dbClient, hostId));
        _workflowService.acquireWorkflowStepLocks(stepId, lockKeys, LockTimeoutValue.get(LockType.FILE_MOUNT_OPERATIONS));
        adapter.mountDevice(hostId, mountPath);
        WorkflowStepCompleter.stepSucceded(stepId);
    } catch (ControllerException e) {
        WorkflowStepCompleter.stepFailed(stepId, e);
        throw e;
    } catch (Exception ex) {
        WorkflowStepCompleter.stepFailed(stepId, APIException.badRequests.commandFailedToComplete(ex.getMessage()));
        throw ex;
    }
}
Also used : ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException) HostMountAdapter(com.emc.storageos.computesystemcontroller.hostmountadapters.HostMountAdapter) ArrayList(java.util.ArrayList) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) RemoteException(java.rmi.RemoteException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException)

Example 2 with HostMountAdapter

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

the class ComputeSystemControllerImpl method removeFromFSTab.

public void removeFromFSTab(URI hostId, String mountPath, String stepId) {
    try {
        HostMountAdapter adapter = getMountAdapters().get(_dbClient.queryObject(Host.class, hostId).getType());
        WorkflowStepCompleter.stepExecuting(stepId);
        List<String> lockKeys = new ArrayList<String>();
        lockKeys.add(ControllerLockingUtil.getMountHostKey(_dbClient, hostId));
        _workflowService.acquireWorkflowStepLocks(stepId, lockKeys, LockTimeoutValue.get(LockType.FILE_MOUNT_OPERATIONS));
        adapter.removeFromFSTab(hostId, mountPath);
        WorkflowStepCompleter.stepSucceded(stepId);
    } catch (ControllerException e) {
        WorkflowStepCompleter.stepFailed(stepId, e);
        throw e;
    } catch (Exception ex) {
        WorkflowStepCompleter.stepFailed(stepId, APIException.badRequests.commandFailedToComplete(ex.getMessage()));
        throw ex;
    }
}
Also used : ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException) HostMountAdapter(com.emc.storageos.computesystemcontroller.hostmountadapters.HostMountAdapter) ArrayList(java.util.ArrayList) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) RemoteException(java.rmi.RemoteException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException)

Example 3 with HostMountAdapter

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

the class ComputeSystemControllerImpl method removeFromFSTabRollBack.

public void removeFromFSTabRollBack(URI hostId, String mountPath, URI resId, String stepId) {
    try {
        HostMountAdapter adapter = getMountAdapters().get(_dbClient.queryObject(Host.class, hostId).getType());
        WorkflowStepCompleter.stepExecuting(stepId);
        FileMountInfo fsMount = getMountInfo(hostId, mountPath, resId);
        List<String> lockKeys = new ArrayList<String>();
        lockKeys.add(ControllerLockingUtil.getMountHostKey(_dbClient, hostId));
        _workflowService.acquireWorkflowStepLocks(stepId, lockKeys, LockTimeoutValue.get(LockType.FILE_MOUNT_OPERATIONS));
        adapter.addToFSTab(hostId, mountPath, resId, fsMount.getSubDirectory(), fsMount.getSecurityType(), "auto");
        WorkflowStepCompleter.stepSucceded(stepId);
    } catch (ControllerException e) {
        WorkflowStepCompleter.stepFailed(stepId, e);
        throw e;
    } catch (Exception ex) {
        WorkflowStepCompleter.stepFailed(stepId, APIException.badRequests.commandFailedToComplete(ex.getMessage()));
        throw ex;
    }
}
Also used : ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException) HostMountAdapter(com.emc.storageos.computesystemcontroller.hostmountadapters.HostMountAdapter) ArrayList(java.util.ArrayList) FileMountInfo(com.emc.storageos.db.client.model.FileMountInfo) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) RemoteException(java.rmi.RemoteException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException)

Example 4 with HostMountAdapter

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

the class ComputeSystemControllerImpl method verifyMountPoint.

public void verifyMountPoint(URI hostId, String mountPath, String stepId) {
    try {
        HostMountAdapter adapter = getMountAdapters().get(_dbClient.queryObject(Host.class, hostId).getType());
        WorkflowStepCompleter.stepExecuting(stepId);
        List<String> lockKeys = new ArrayList<String>();
        lockKeys.add(ControllerLockingUtil.getMountHostKey(_dbClient, hostId));
        _workflowService.acquireWorkflowStepLocks(stepId, lockKeys, LockTimeoutValue.get(LockType.FILE_MOUNT_OPERATIONS));
        adapter.verifyMountPoint(hostId, mountPath);
        WorkflowStepCompleter.stepSucceded(stepId);
    } catch (ControllerException e) {
        WorkflowStepCompleter.stepFailed(stepId, e);
        throw e;
    } catch (Exception ex) {
        WorkflowStepCompleter.stepFailed(stepId, APIException.badRequests.commandFailedToComplete(ex.getMessage()));
        throw ex;
    }
}
Also used : ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException) HostMountAdapter(com.emc.storageos.computesystemcontroller.hostmountadapters.HostMountAdapter) ArrayList(java.util.ArrayList) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) RemoteException(java.rmi.RemoteException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException)

Example 5 with HostMountAdapter

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

the class ComputeSystemControllerImpl method unmount.

public void unmount(URI hostId, String mountPath, String stepId) {
    try {
        HostMountAdapter adapter = getMountAdapters().get(_dbClient.queryObject(Host.class, hostId).getType());
        WorkflowStepCompleter.stepExecuting(stepId);
        List<String> lockKeys = new ArrayList<String>();
        lockKeys.add(ControllerLockingUtil.getMountHostKey(_dbClient, hostId));
        _workflowService.acquireWorkflowStepLocks(stepId, lockKeys, LockTimeoutValue.get(LockType.FILE_MOUNT_OPERATIONS));
        adapter.unmountDevice(hostId, mountPath);
        WorkflowStepCompleter.stepSucceded(stepId);
    } catch (ControllerException e) {
        WorkflowStepCompleter.stepFailed(stepId, e);
        throw e;
    } catch (Exception ex) {
        WorkflowStepCompleter.stepFailed(stepId, APIException.badRequests.commandFailedToComplete(ex.getMessage()));
        throw ex;
    }
}
Also used : ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException) HostMountAdapter(com.emc.storageos.computesystemcontroller.hostmountadapters.HostMountAdapter) ArrayList(java.util.ArrayList) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) RemoteException(java.rmi.RemoteException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException)

Aggregations

ComputeSystemControllerException (com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException)8 HostMountAdapter (com.emc.storageos.computesystemcontroller.hostmountadapters.HostMountAdapter)8 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)8 ClientControllerException (com.emc.storageos.exceptions.ClientControllerException)8 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)8 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)8 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)8 ControllerException (com.emc.storageos.volumecontroller.ControllerException)8 WorkflowException (com.emc.storageos.workflow.WorkflowException)8 RemoteException (java.rmi.RemoteException)8 ArrayList (java.util.ArrayList)8 FileMountInfo (com.emc.storageos.db.client.model.FileMountInfo)1