Search in sources :

Example 1 with WorkflowService

use of com.emc.storageos.workflow.WorkflowService in project coprhd-controller by CoprHD.

the class ReplicaDeviceController method removeFromReplicationGroup.

/**
 * Orchestration method for removing members from a replication group.
 *
 * @param storage
 * @param consistencyGroup
 * @param repGroupName
 * @param addVolumesList
 * @param opId
 * @return
 * @throws ControllerException
 */
public boolean removeFromReplicationGroup(URI storage, URI consistencyGroup, String repGroupName, List<URI> addVolumesList, String opId) throws ControllerException {
    TaskCompleter taskCompleter = new BlockConsistencyGroupUpdateCompleter(consistencyGroup, opId);
    try {
        List<String> lockKeys = new ArrayList<>();
        lockKeys.add(ControllerLockingUtil.getReplicationGroupStorageKey(_dbClient, repGroupName, storage));
        WorkflowService workflowService = _blockDeviceController.getWorkflowService();
        workflowService.acquireWorkflowStepLocks(opId, lockKeys, LockTimeoutValue.get(LockType.ARRAY_CG));
        StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
        _blockDeviceController.getDevice(storageSystem.getSystemType()).doRemoveFromReplicationGroup(storageSystem, consistencyGroup, repGroupName, addVolumesList, taskCompleter);
    } catch (Exception e) {
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        taskCompleter.error(_dbClient, serviceError);
        WorkflowStepCompleter.stepFailed(opId, serviceError);
        return false;
    }
    return true;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockConsistencyGroupUpdateCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockConsistencyGroupUpdateCompleter) WorkflowService(com.emc.storageos.workflow.WorkflowService) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 2 with WorkflowService

use of com.emc.storageos.workflow.WorkflowService in project coprhd-controller by CoprHD.

the class SRDFOperationContext method insertContextOperation.

public static void insertContextOperation(TaskCompleter completer, SRDFOperationType operation, Object... args) {
    checkNotNull(completer);
    WorkflowService service = WorkflowService.getInstance();
    SRDFOperationContext ctx = (SRDFOperationContext) service.loadStepData(completer.getOpId());
    if (ctx == null) {
        ctx = new SRDFOperationContext();
    }
    ctx.insertOperation(operation.toString(), args);
    service.storeStepData(completer.getOpId(), ctx);
}
Also used : WorkflowService(com.emc.storageos.workflow.WorkflowService)

Example 3 with WorkflowService

use of com.emc.storageos.workflow.WorkflowService in project coprhd-controller by CoprHD.

the class ReplicaDeviceController method addToReplicationGroup.

/**
 * Orchestration method for adding members to a replication group.
 *
 * @param storage
 * @param consistencyGroup
 * @param replicationGroupName
 * @param addVolumesList
 * @param opId
 * @return
 * @throws ControllerException
 */
public boolean addToReplicationGroup(URI storage, URI consistencyGroup, String replicationGroupName, List<URI> addVolumesList, String opId) throws ControllerException {
    WorkflowStepCompleter.stepExecuting(opId);
    TaskCompleter taskCompleter = null;
    try {
        List<String> lockKeys = new ArrayList<String>();
        lockKeys.add(ControllerLockingUtil.getReplicationGroupStorageKey(_dbClient, replicationGroupName, storage));
        WorkflowService workflowService = _blockDeviceController.getWorkflowService();
        workflowService.acquireWorkflowStepLocks(opId, lockKeys, LockTimeoutValue.get(LockType.ARRAY_CG));
        StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
        taskCompleter = new BlockConsistencyGroupUpdateCompleter(consistencyGroup, opId);
        _blockDeviceController.getDevice(storageSystem.getSystemType()).doAddToReplicationGroup(storageSystem, consistencyGroup, replicationGroupName, addVolumesList, taskCompleter);
        WorkflowStepCompleter.stepSucceded(opId);
    } catch (Exception e) {
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        taskCompleter.error(_dbClient, serviceError);
        WorkflowStepCompleter.stepFailed(opId, serviceError);
        return false;
    }
    return true;
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) WorkflowService(com.emc.storageos.workflow.WorkflowService) BlockConsistencyGroupUpdateCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockConsistencyGroupUpdateCompleter) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

WorkflowService (com.emc.storageos.workflow.WorkflowService)3 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)2 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)2 ControllerException (com.emc.storageos.volumecontroller.ControllerException)2 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)2 BlockConsistencyGroupUpdateCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockConsistencyGroupUpdateCompleter)2 WorkflowException (com.emc.storageos.workflow.WorkflowException)2 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)2 ArrayList (java.util.ArrayList)2