Search in sources :

Example 6 with BlockMirrorTaskCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter in project coprhd-controller by CoprHD.

the class BlockDeviceController method establishVolumeNativeContinuousCopyGroupRelation.

public void establishVolumeNativeContinuousCopyGroupRelation(URI storage, URI sourceVolume, URI mirror, String opId) throws ControllerException {
    try {
        WorkflowStepCompleter.stepExecuting(opId);
        StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
        TaskCompleter completer = new BlockMirrorTaskCompleter(BlockMirror.class, mirror, opId);
        getDevice(storageObj.getSystemType()).doEstablishVolumeNativeContinuousCopyGroupRelation(storageObj, sourceVolume, mirror, completer);
    } catch (Exception e) {
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        WorkflowStepCompleter.stepFailed(opId, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirrorTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter) 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 7 with BlockMirrorTaskCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter in project coprhd-controller by CoprHD.

the class BlockDeviceController method detachNativeContinuousCopies.

@Override
public void detachNativeContinuousCopies(URI storage, List<URI> mirrors, List<URI> promotees, String opId) throws ControllerException {
    _log.info("START detach continuous copies workflow");
    Workflow workflow = _workflowService.getNewWorkflow(this, DETACH_MIRRORS_WF_NAME, false, opId);
    TaskCompleter taskCompleter = null;
    try {
        addStepsForPromoteMirrors(workflow, null, mirrors, promotees);
        // There is a task for the source volume, as well as for each newly promoted volume
        List<URI> volumesWithTasks = new ArrayList<URI>(promotees);
        volumesWithTasks.addAll(getSourceVolumesFromURIs(mirrors));
        taskCompleter = new BlockMirrorTaskCompleter(Volume.class, volumesWithTasks, opId);
        ControllerUtils.checkMirrorConsistencyGroup(mirrors, _dbClient, taskCompleter);
        workflow.executePlan(taskCompleter, "Successfully detached continuous copies");
    } catch (Exception e) {
        List<Volume> promotedVolumes = _dbClient.queryObject(Volume.class, promotees);
        for (Volume promotedVolume : promotedVolumes) {
            promotedVolume.setInactive(true);
        }
        _dbClient.updateObject(promotedVolumes);
        String msg = String.format("Failed to execute detach continuous copies workflow for mirrors: %s", mirrors);
        _log.error(msg, e);
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) ArrayList(java.util.ArrayList) BlockMirrorTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter) Workflow(com.emc.storageos.workflow.Workflow) Arrays.asList(java.util.Arrays.asList) ApplicationAddVolumeList(com.emc.storageos.volumecontroller.ApplicationAddVolumeList) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) List(java.util.List) 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) 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)

Aggregations

DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)7 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)7 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)7 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)7 ControllerException (com.emc.storageos.volumecontroller.ControllerException)7 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)7 ApplicationTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.ApplicationTaskCompleter)7 BlockMirrorTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter)7 BlockSnapshotEstablishGroupTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotEstablishGroupTaskCompleter)7 CloneTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneTaskCompleter)7 MultiVolumeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.MultiVolumeTaskCompleter)7 SimpleTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.SimpleTaskCompleter)7 VolumeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeTaskCompleter)7 DiscoverTaskCompleter (com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.DiscoverTaskCompleter)7 ScanTaskCompleter (com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.ScanTaskCompleter)7 WorkflowException (com.emc.storageos.workflow.WorkflowException)7 DataBindingException (javax.xml.bind.DataBindingException)7 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)6 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)5 Volume (com.emc.storageos.db.client.model.Volume)5