Search in sources :

Example 1 with MirrorFilePauseTaskCompleter

use of com.emc.storageos.volumecontroller.impl.file.MirrorFilePauseTaskCompleter in project coprhd-controller by CoprHD.

the class FileDeviceController method performFileReplicationOperation.

@Override
public void performFileReplicationOperation(URI storage, URI sourceFSURI, String opType, String opId) throws ControllerException {
    StorageSystem system = _dbClient.queryObject(StorageSystem.class, storage);
    FileShare fileShare = _dbClient.queryObject(FileShare.class, sourceFSURI);
    TaskCompleter completer = null;
    BiosCommandResult result = new BiosCommandResult();
    WorkflowStepCompleter.stepExecuting(opId);
    _log.info("file replication operation {} started for file systerm {}", opType, fileShare.getName());
    try {
        if ("pause".equalsIgnoreCase(opType)) {
            completer = new MirrorFilePauseTaskCompleter(FileShare.class, sourceFSURI, opId);
            result = getDevice(system.getSystemType()).doPauseLink(system, fileShare);
        } else if ("resume".equalsIgnoreCase(opType)) {
            completer = new MirrorFileResumeTaskCompleter(FileShare.class, sourceFSURI, opId);
            result = getDevice(system.getSystemType()).doResumeLink(system, fileShare, completer);
        } else if ("start".equalsIgnoreCase(opType)) {
            completer = new MirrorFileStartTaskCompleter(FileShare.class, sourceFSURI, opId);
            result = getDevice(system.getSystemType()).doStartMirrorLink(system, fileShare, completer);
        } else if ("refresh".equalsIgnoreCase(opType)) {
            completer = new MirrorFileRefreshTaskCompleter(FileShare.class, sourceFSURI, opId);
            result = getDevice(system.getSystemType()).doRefreshMirrorLink(system, fileShare);
        } else if ("resync".equalsIgnoreCase(opType)) {
            completer = new MirrorFileResyncTaskCompleter(FileShare.class, sourceFSURI, opId);
            result = getDevice(system.getSystemType()).doResyncLink(system, fileShare, completer);
        }
        if (result.getCommandSuccess()) {
            _log.info("file replication operation {} finished successfully for file systerm {}", opType, fileShare.getName());
            completer.ready(_dbClient);
        } else if (result.getCommandPending()) {
            completer.statusPending(_dbClient, result.getMessage());
        } else {
            completer.error(_dbClient, result.getServiceCoded());
        }
    } catch (Exception e) {
        _log.error("unable to perform mirror operation {} on file system {} ", opType, sourceFSURI, e);
        updateTaskStatus(opId, fileShare, e);
        ServiceError error = DeviceControllerException.errors.jobFailed(e);
        WorkflowStepCompleter.stepFailed(opId, error);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) MirrorFileResumeTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileResumeTaskCompleter) MirrorFileRefreshTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileRefreshTaskCompleter) MirrorFilePauseTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFilePauseTaskCompleter) MirrorFileStartTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileStartTaskCompleter) MirrorFileResyncTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileResyncTaskCompleter) MirrorFileRefreshTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileRefreshTaskCompleter) MirrorFileResumeTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileResumeTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) MirrorFileStartTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileStartTaskCompleter) MirrorFileResyncTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFileResyncTaskCompleter) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) MirrorFilePauseTaskCompleter(com.emc.storageos.volumecontroller.impl.file.MirrorFilePauseTaskCompleter) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) URISyntaxException(java.net.URISyntaxException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

FileShare (com.emc.storageos.db.client.model.FileShare)1 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)1 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 ControllerException (com.emc.storageos.volumecontroller.ControllerException)1 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)1 MirrorFilePauseTaskCompleter (com.emc.storageos.volumecontroller.impl.file.MirrorFilePauseTaskCompleter)1 MirrorFileRefreshTaskCompleter (com.emc.storageos.volumecontroller.impl.file.MirrorFileRefreshTaskCompleter)1 MirrorFileResumeTaskCompleter (com.emc.storageos.volumecontroller.impl.file.MirrorFileResumeTaskCompleter)1 MirrorFileResyncTaskCompleter (com.emc.storageos.volumecontroller.impl.file.MirrorFileResyncTaskCompleter)1 MirrorFileStartTaskCompleter (com.emc.storageos.volumecontroller.impl.file.MirrorFileStartTaskCompleter)1 WorkflowException (com.emc.storageos.workflow.WorkflowException)1 URISyntaxException (java.net.URISyntaxException)1