Search in sources :

Example 66 with ServiceError

use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.

the class BlockDeviceController method pauseNativeContinuousCopies.

@Override
public void pauseNativeContinuousCopies(URI storage, List<URI> mirrors, Boolean sync, String opId) throws ControllerException {
    _log.info("START pause continuous copies workflow");
    boolean isCG = isCGMirror(mirrors.get(0), _dbClient);
    if (mirrors.size() == 1 || isCG) {
        fractureMirror(storage, mirrors, isCG, sync, opId);
        return;
    }
    Workflow workflow = _workflowService.getNewWorkflow(this, PAUSE_MIRRORS_WF_NAME, false, opId);
    TaskCompleter taskCompleter = null;
    BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, mirrors.get(0));
    StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
    try {
        for (URI mirrorUri : mirrors) {
            BlockMirror blockMirror = _dbClient.queryObject(BlockMirror.class, mirrorUri);
            if (!mirrorIsPausable(asList(blockMirror))) {
                String errorMsg = format("Can not pause continuous copy %s with synchronization state %s for volume %s", blockMirror.getId(), blockMirror.getSyncState(), blockMirror.getSource().getURI());
                _log.error(errorMsg);
                String opName = ResourceOperationTypeEnum.PAUSE_NATIVE_CONTINUOUS_COPIES.getName();
                ServiceError serviceError = DeviceControllerException.errors.jobFailedOp(opName);
                WorkflowStepCompleter.stepFailed(opId, serviceError);
                throw new IllegalStateException(errorMsg);
            }
            workflow.createStep("pauseMirror", "pause mirror", null, storage, storageObj.getSystemType(), this.getClass(), fractureMirrorMethod(storage, asList(mirrorUri), isCG, sync), null, null);
        }
        taskCompleter = new BlockMirrorTaskCompleter(Volume.class, asList(mirror.getSource().getURI()), opId);
        workflow.executePlan(taskCompleter, "Successfully paused continuous copies");
    } catch (Exception e) {
        String msg = String.format("Failed to execute pause continuous copies workflow for volume %s", mirror.getSource().getURI());
        _log.error(msg, e);
        if (taskCompleter != null) {
            ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
            taskCompleter.error(_dbClient, serviceError);
        }
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) BlockMirrorTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter) 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) 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)

Example 67 with ServiceError

use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.

the class BlockDeviceController method activateFullCopyStep.

public void activateFullCopyStep(URI storage, List<URI> fullCopy, String opId) {
    try {
        StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
        TaskCompleter taskCompleter = new CloneActivateCompleter(fullCopy, opId);
        if (checkCloneConsistencyGroup(fullCopy.get(0), _dbClient, taskCompleter)) {
            getDevice(storageSystem.getSystemType()).doActivateGroupFullCopy(storageSystem, fullCopy, taskCompleter);
        } else {
            getDevice(storageSystem.getSystemType()).doActivateFullCopy(storageSystem, fullCopy.get(0), taskCompleter);
        }
    } catch (Exception e) {
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        WorkflowStepCompleter.stepFailed(opId, serviceError);
        doFailTask(Volume.class, fullCopy, opId, serviceError);
    }
}
Also used : 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) CloneActivateCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneActivateCompleter) 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 ServiceError

use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.

the class BlockDeviceController method detachMirror.

/**
 * {@inheritDoc} NOTE NOTE: The signature here MUST match the Workflow.Method detachMirrorMethod just above (except
 * opId).
 */
@Override
public void detachMirror(URI storage, List<URI> mirrorList, Boolean isCG, Boolean deleteGroup, String opId) throws ControllerException {
    TaskCompleter completer = null;
    try {
        _log.info("Start detach Mirror for mirror {}, isCG {}", mirrorList, isCG);
        WorkflowStepCompleter.stepExecuting(opId);
        StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
        completer = new BlockMirrorDetachCompleter(mirrorList, opId);
        if (!isCG) {
            getDevice(storageObj.getSystemType()).doDetachMirror(storageObj, mirrorList.get(0), completer);
        } else {
            completer.addConsistencyGroupId(ConsistencyGroupUtils.getMirrorsConsistencyGroup(mirrorList, _dbClient).getId());
            getDevice(storageObj.getSystemType()).doDetachGroupMirrors(storageObj, mirrorList, deleteGroup, completer);
        }
    } catch (Exception e) {
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        if (completer != null) {
            completer.error(_dbClient, serviceError);
        }
        WorkflowStepCompleter.stepFailed(opId, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirrorDetachCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorDetachCompleter) 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 69 with ServiceError

use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.

the class BlockDeviceController method establishVolumeSnapshotGroupRelation.

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

use of com.emc.storageos.svcs.errorhandling.model.ServiceError in project coprhd-controller by CoprHD.

the class BlockDeviceController method createConsistencyGroupStep.

public boolean createConsistencyGroupStep(URI storage, URI consistencyGroup, String replicationGroupName, String opId) throws ControllerException {
    TaskCompleter taskCompleter = null;
    try {
        StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
        taskCompleter = new BlockConsistencyGroupCreateCompleter(consistencyGroup, opId);
        String groupName = ControllerUtils.generateReplicationGroupName(storageSystem, consistencyGroup, replicationGroupName, _dbClient);
        String lockKey = groupName;
        boolean isVNX = storageSystem.deviceIsType(Type.vnxblock);
        if (isVNX && lockKey == null) {
            lockKey = replicationGroupName;
        }
        if (lockKey == null) {
            BlockConsistencyGroup cgObj = _dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroup);
            lockKey = cgObj.getAlternateLabel() != null ? cgObj.getAlternateLabel() : cgObj.getLabel();
        }
        // Lock the CG for the step duration.
        List<String> lockKeys = new ArrayList<>();
        lockKeys.add(ControllerLockingUtil.getReplicationGroupStorageKey(_dbClient, lockKey, storage));
        _workflowService.acquireWorkflowStepLocks(opId, lockKeys, LockTimeoutValue.get(LockType.ARRAY_CG));
        if (isVNX) {
            // replication group may have been just created by another thread, in that case,
            // group name for VNX will be array generated name (if arrayConsistency is true), or
            // replicationGroupName if arrayConsistency is false
            // so get the group name again here to be used in ControllerUtils.replicationGroupExists call
            groupName = ControllerUtils.generateReplicationGroupName(storageSystem, consistencyGroup, replicationGroupName, _dbClient);
        }
        // make sure this array consistency group was not just created by another thread that held the lock
        if (groupName != null && ControllerUtils.replicationGroupExists(storage, groupName, _dbClient)) {
            taskCompleter.ready(_dbClient);
            return true;
        }
        getDevice(storageSystem.getSystemType()).doCreateConsistencyGroup(storageSystem, consistencyGroup, groupName, taskCompleter);
    } catch (Exception e) {
        _log.error("create consistency group job failed:", 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) BlockConsistencyGroupCreateCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockConsistencyGroupCreateCompleter) ArrayList(java.util.ArrayList) 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) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup)

Aggregations

ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)707 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)625 ControllerException (com.emc.storageos.volumecontroller.ControllerException)345 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)289 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)270 WorkflowException (com.emc.storageos.workflow.WorkflowException)258 URI (java.net.URI)250 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)246 ArrayList (java.util.ArrayList)238 Volume (com.emc.storageos.db.client.model.Volume)206 Workflow (com.emc.storageos.workflow.Workflow)127 WBEMException (javax.wbem.WBEMException)124 CIMObjectPath (javax.cim.CIMObjectPath)118 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)113 ExportMask (com.emc.storageos.db.client.model.ExportMask)107 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)105 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)104 URISyntaxException (java.net.URISyntaxException)94 HashMap (java.util.HashMap)86 NamedURI (com.emc.storageos.db.client.model.NamedURI)82