Search in sources :

Example 71 with ServiceError

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

the class BlockDeviceController method establishVolumeFullCopyGroupRelation.

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

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

the class BlockDeviceController method establishVolumeAndSnapshotGroupRelation.

@Override
public void establishVolumeAndSnapshotGroupRelation(URI storage, URI sourceVolume, URI snapshot, String opId) throws ControllerException {
    _log.info("START establishVolumeAndSnapshotGroupRelation workflow");
    Workflow workflow = _workflowService.getNewWorkflow(this, ESTABLISH_VOLUME_SNAPSHOT_GROUP_WF_NAME, false, opId);
    TaskCompleter taskCompleter = null;
    StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
    try {
        workflow.createStep("establishStep", "create group relation between Volume group and Snapshot group", null, storage, storageObj.getSystemType(), this.getClass(), establishVolumeAndSnapshotGroupRelationMethod(storage, sourceVolume, snapshot), null, null);
        taskCompleter = new BlockSnapshotEstablishGroupTaskCompleter(snapshot, opId);
        workflow.executePlan(taskCompleter, "Successfully created group relation between Volume group and Snapshot group");
    } catch (Exception e) {
        String msg = String.format("Failed to create group relation between Volume group and Snapshot group." + "Source volume: %s, Snapshot: %s", sourceVolume, snapshot);
        _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) BlockSnapshotEstablishGroupTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotEstablishGroupTaskCompleter) 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) 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 73 with ServiceError

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

the class BlockDeviceController method restoreVolumeStep.

public boolean restoreVolumeStep(URI storage, URI pool, URI volume, URI snapshot, Boolean updateOpStatus, String opId) throws ControllerException {
    TaskCompleter completer = null;
    try {
        StorageSystem storageDevice = _dbClient.queryObject(StorageSystem.class, storage);
        BlockSnapshot snapObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
        completer = new BlockSnapshotRestoreCompleter(snapObj, opId, updateOpStatus);
        getDevice(storageDevice.getSystemType()).doRestoreFromSnapshot(storageDevice, volume, snapshot, completer);
    } catch (Exception e) {
        _log.error(String.format("restoreVolume failed - storage: %s, pool: %s, volume: %s, snapshot: %s", storage.toString(), pool.toString(), volume.toString(), snapshot.toString()));
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        completer.error(_dbClient, serviceError);
        doFailTask(BlockSnapshot.class, snapshot, opId, serviceError);
        WorkflowStepCompleter.stepFailed(opId, serviceError);
        return false;
    }
    return true;
}
Also used : BlockSnapshotRestoreCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotRestoreCompleter) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) 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 74 with ServiceError

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

the class BlockDeviceController method detachListClone.

public void detachListClone(URI storage, List<URI> cloneList, String taskId) throws ControllerException {
    _log.info("START detachListClone: {}", Joiner.on("\t").join(cloneList));
    try {
        StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
        TaskCompleter taskCompleter = new VolumeDetachCloneCompleter(cloneList, taskId);
        getDevice(storageSystem.getSystemType()).doDetachListReplica(storageSystem, cloneList, taskCompleter);
    } catch (Exception e) {
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        WorkflowStepCompleter.stepFailed(taskId, serviceError);
        doFailTask(Volume.class, cloneList, taskId, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Volume(com.emc.storageos.db.client.model.Volume) VolumeDetachCloneCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeDetachCloneCompleter) 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 75 with ServiceError

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

the class BlockDeviceController method rollbackListClone.

public void rollbackListClone(URI storage, List<URI> cloneList, String taskId) {
    WorkflowStepCompleter.stepExecuting(taskId);
    _log.info("Rollback list clone");
    List<Volume> clones = _dbClient.queryObject(Volume.class, cloneList);
    List<Volume> clonesNoRollback = new ArrayList<Volume>();
    List<URI> clonesToRollback = new ArrayList<URI>();
    try {
        for (Volume clone : clones) {
            if (isNullOrEmpty(clone.getNativeId())) {
                clone.setInactive(true);
                clonesNoRollback.add(clone);
            } else {
                clonesToRollback.add(clone.getId());
            }
        }
        if (!clonesNoRollback.isEmpty()) {
            _dbClient.updateObject(clonesNoRollback);
        }
        if (!clonesToRollback.isEmpty()) {
            _log.info("Detach list clone for rollback");
            detachListClone(storage, clonesToRollback, generateStepIdForDependentCallDuringRollback());
            _log.info("Delete clones for rollback");
            deleteVolumes(storage, clonesToRollback, generateStepIdForDependentCallDuringRollback());
        }
        WorkflowStepCompleter.stepSucceded(taskId);
    } catch (InternalException ie) {
        _log.error(String.format("rollbackListClone failed - Array: %s, clones: %s", storage, Joiner.on("\t").join(cloneList)));
        _log.error(ie.getMessage(), ie);
        doFailTask(Volume.class, cloneList, taskId, ie);
        WorkflowStepCompleter.stepFailed(taskId, ie);
    } catch (Exception e) {
        _log.error(e.getMessage(), e);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        WorkflowStepCompleter.stepFailed(taskId, serviceError);
        doFailTask(Volume.class, cloneList, taskId, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Volume(com.emc.storageos.db.client.model.Volume) ArrayList(java.util.ArrayList) 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) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException)

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