Search in sources :

Example 66 with TaskCompleter

use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.

the class BlockDeviceController method fractureClone.

public boolean fractureClone(URI storage, List<URI> clone, boolean isCG, String opId) {
    _log.info("Fracture clone: {}", clone.get(0));
    TaskCompleter completer = null;
    try {
        StorageSystem storageDevice = _dbClient.queryObject(StorageSystem.class, storage);
        WorkflowStepCompleter.stepExecuting(opId);
        if (!isCG) {
            Volume cloneVol = _dbClient.queryObject(Volume.class, clone.get(0));
            completer = new CloneFractureCompleter(clone.get(0), opId);
            WorkflowStepCompleter.stepExecuting(opId);
            // Synchronous operation
            getDevice(storageDevice.getSystemType()).doFractureClone(storageDevice, cloneVol.getAssociatedSourceVolume(), clone.get(0), completer);
        } else {
            _log.info("Fracture group clone.");
            completer = new CloneFractureCompleter(clone, opId);
            WorkflowStepCompleter.stepExecuting(opId);
            // Synchronous operation
            getDevice(storageDevice.getSystemType()).doFractureGroupClone(storageDevice, clone, completer);
        }
    } catch (Exception e) {
        _log.error(String.format("Fracture restore sessions step failed - storage: %s, clone: %s", storage.toString(), clone.toString()));
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        if (completer != null) {
            completer.error(_dbClient, serviceError);
        }
        doFailTask(Volume.class, clone, opId, serviceError);
        WorkflowStepCompleter.stepFailed(opId, serviceError);
        return false;
    }
    return true;
}
Also used : CloneFractureCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneFractureCompleter) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Volume(com.emc.storageos.db.client.model.Volume) ScanTaskCompleter(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.ScanTaskCompleter) BlockSnapshotEstablishGroupTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotEstablishGroupTaskCompleter) BlockMirrorTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter) CloneTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneTaskCompleter) ApplicationTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ApplicationTaskCompleter) SimpleTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SimpleTaskCompleter) VolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeTaskCompleter) DiscoverTaskCompleter(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.DiscoverTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) MultiVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MultiVolumeTaskCompleter) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) DataBindingException(javax.xml.bind.DataBindingException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 67 with TaskCompleter

use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.

the class BlockDeviceController method createSingleSnapshot.

@Override
public void createSingleSnapshot(URI storage, List<URI> snapshotList, Boolean createInactive, Boolean readOnly, String opId) throws ControllerException {
    WorkflowStepCompleter.stepExecuting(opId);
    TaskCompleter completer = null;
    try {
        StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
        completer = new BlockSnapshotCreateCompleter(snapshotList, opId);
        getDevice(storageObj.getSystemType()).doCreateSingleSnapshot(storageObj, snapshotList, createInactive, readOnly, completer);
    } catch (Exception e) {
        if (completer != null) {
            ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
            WorkflowStepCompleter.stepFailed(opId, serviceError);
            completer.error(_dbClient, serviceError);
        } else {
            throw DeviceControllerException.exceptions.createVolumeSnapshotFailed(e);
        }
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) ScanTaskCompleter(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.ScanTaskCompleter) BlockSnapshotEstablishGroupTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotEstablishGroupTaskCompleter) BlockMirrorTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter) CloneTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneTaskCompleter) ApplicationTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ApplicationTaskCompleter) SimpleTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SimpleTaskCompleter) VolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeTaskCompleter) DiscoverTaskCompleter(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.DiscoverTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) MultiVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MultiVolumeTaskCompleter) BlockSnapshotCreateCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotCreateCompleter) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) DataBindingException(javax.xml.bind.DataBindingException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 68 with TaskCompleter

use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.

the class BlockDeviceController method deleteConsistencyGroup.

@Override
public void deleteConsistencyGroup(URI storage, URI consistencyGroup, Boolean markInactive, String opId) throws ControllerException {
    _log.info("START delete consistency group");
    TaskCompleter wfCompleter = null;
    try {
        Workflow workflow = _workflowService.getNewWorkflow(this, "deleteReplicationGroupInConsistencyGroup", true, opId);
        wfCompleter = new SimpleTaskCompleter(BlockConsistencyGroup.class, consistencyGroup, opId);
        StorageSystem system = _dbClient.queryObject(StorageSystem.class, storage);
        BlockConsistencyGroup cg = _dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroup);
        Set<String> groupNames = BlockConsistencyGroupUtils.getGroupNamesForSystemCG(cg, system);
        String stepId = null;
        for (String groupName : groupNames) {
            Workflow.Method deleteStep = new Workflow.Method("deleteReplicationGroupInConsistencyGroup", storage, consistencyGroup, groupName, false, markInactive, true);
            stepId = workflow.createStep("DeleteReplicationGroup", "Deleting replication group", stepId, storage, system.getSystemType(), this.getClass(), deleteStep, rollbackMethodNullMethod(), null);
        }
        String successMsg = String.format("Successfully deleted replication groups %s", Joiner.on(',').join(groupNames));
        workflow.executePlan(wfCompleter, successMsg);
    } catch (Exception e) {
        if (wfCompleter != null) {
            ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
            wfCompleter.error(_dbClient, serviceError);
        }
        throw DeviceControllerException.exceptions.deleteConsistencyGroupFailed(e);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Workflow(com.emc.storageos.workflow.Workflow) SimpleTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SimpleTaskCompleter) ScanTaskCompleter(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.ScanTaskCompleter) BlockSnapshotEstablishGroupTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotEstablishGroupTaskCompleter) BlockMirrorTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter) CloneTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneTaskCompleter) ApplicationTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ApplicationTaskCompleter) SimpleTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SimpleTaskCompleter) VolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeTaskCompleter) DiscoverTaskCompleter(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.DiscoverTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) MultiVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MultiVolumeTaskCompleter) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) DataBindingException(javax.xml.bind.DataBindingException) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 69 with TaskCompleter

use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.

the class BlockDeviceController method activateSnapshot.

@Override
public void activateSnapshot(URI storage, List<URI> snapshotList, String opId) throws ControllerException {
    TaskCompleter completer = null;
    try {
        StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
        completer = new BlockSnapshotActivateCompleter(snapshotList, opId);
        getDevice(storageObj.getSystemType()).doActivateSnapshot(storageObj, snapshotList, completer);
    } catch (Exception e) {
        if (completer != null) {
            ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
            completer.error(_dbClient, serviceError);
        } else {
            throw DeviceControllerException.exceptions.activateVolumeSnapshotFailed(e);
        }
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) ScanTaskCompleter(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.ScanTaskCompleter) BlockSnapshotEstablishGroupTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotEstablishGroupTaskCompleter) BlockMirrorTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter) CloneTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneTaskCompleter) ApplicationTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ApplicationTaskCompleter) SimpleTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SimpleTaskCompleter) VolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeTaskCompleter) DiscoverTaskCompleter(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.DiscoverTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) MultiVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MultiVolumeTaskCompleter) BlockSnapshotActivateCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotActivateCompleter) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) DataBindingException(javax.xml.bind.DataBindingException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 70 with TaskCompleter

use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.

the class BlockDeviceController method activateFullCopy.

@Override
public void activateFullCopy(URI storage, List<URI> fullCopy, String opId) {
    TaskCompleter completer = new CloneWorkflowCompleter(fullCopy, opId);
    try {
        // need to create a workflow to wait sync finish, then do fracture/activate
        Workflow workflow = _workflowService.getNewWorkflow(this, ACTIVATE_CLONE_WF_NAME, false, opId);
        _log.info("Created new activate workflow with operation id {}", opId);
        StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
        // add CG to taskCompleter
        boolean isCG = checkCloneConsistencyGroup(fullCopy.get(0), _dbClient, completer);
        if (storageSystem.deviceIsType(Type.vnxblock)) {
            String previousStep = null;
            if (isCG) {
                for (URI cloneUri : fullCopy) {
                    Workflow.Method waitForSyncMethod = waitForSynchronizedMethod(Volume.class, storage, Arrays.asList(cloneUri), false);
                    String waitForSyncStep = workflow.createStep(FULL_COPY_WFS_STEP_GROUP, "Waiting for synchronization", previousStep, storage, storageSystem.getSystemType(), getClass(), waitForSyncMethod, null, null);
                    previousStep = waitForSyncStep;
                }
            } else {
                Workflow.Method waitForSyncMethod = waitForSynchronizedMethod(Volume.class, storage, fullCopy, isCG);
                String waitForSyncStep = workflow.createStep(FULL_COPY_WFS_STEP_GROUP, "Waiting for synchronization", previousStep, storage, storageSystem.getSystemType(), getClass(), waitForSyncMethod, null, null);
                previousStep = waitForSyncStep;
            }
            workflow.createStep(ACTIVATE_CLONE_GROUP, "Activating clone", previousStep, storage, getDeviceType(storage), BlockDeviceController.class, activateCloneMethod(storage, fullCopy), rollbackMethodNullMethod(), null);
        } else {
            workflow.createStep(ACTIVATE_CLONE_GROUP, "Activating clone", null, storage, getDeviceType(storage), BlockDeviceController.class, activateCloneMethod(storage, fullCopy), rollbackMethodNullMethod(), null);
        }
        _log.info("Executing Activate workflow");
        String msg = String.format("Actitvate %s completed successfully", fullCopy.get(0));
        workflow.executePlan(completer, msg);
    } catch (Exception e) {
        String msg = String.format("Could not activate the clone %s", fullCopy.get(0));
        _log.error(msg, e);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        completer.error(_dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Workflow(com.emc.storageos.workflow.Workflow) ScanTaskCompleter(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.ScanTaskCompleter) BlockSnapshotEstablishGroupTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotEstablishGroupTaskCompleter) BlockMirrorTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter) CloneTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneTaskCompleter) ApplicationTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ApplicationTaskCompleter) SimpleTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SimpleTaskCompleter) VolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeTaskCompleter) DiscoverTaskCompleter(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.DiscoverTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) MultiVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MultiVolumeTaskCompleter) CloneWorkflowCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneWorkflowCompleter) NamedURI(com.emc.storageos.db.client.model.NamedURI) FCTN_MIRROR_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_MIRROR_TO_URI) URI(java.net.URI) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) DataBindingException(javax.xml.bind.DataBindingException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)171 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)160 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)147 WorkflowException (com.emc.storageos.workflow.WorkflowException)141 ControllerException (com.emc.storageos.volumecontroller.ControllerException)127 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)113 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)106 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)103 VolumeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeTaskCompleter)89 CloneTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneTaskCompleter)88 Workflow (com.emc.storageos.workflow.Workflow)72 MultiVolumeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.MultiVolumeTaskCompleter)70 SimpleTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.SimpleTaskCompleter)70 URI (java.net.URI)70 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)69 ApplicationTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.ApplicationTaskCompleter)69 BlockMirrorTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter)69 BlockSnapshotEstablishGroupTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotEstablishGroupTaskCompleter)69 DiscoverTaskCompleter (com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.DiscoverTaskCompleter)69 ScanTaskCompleter (com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.ScanTaskCompleter)69