Search in sources :

Example 61 with ServiceError

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

the class ComputeSystemControllerImpl method updateExportGroup.

public void updateExportGroup(URI exportGroup, Map<URI, Integer> newVolumesMap, Set<URI> addedClusters, Set<URI> removedClusters, Set<URI> adedHosts, Set<URI> removedHosts, Set<URI> addedInitiators, Set<URI> removedInitiators, String stepId) throws Exception {
    Map<URI, Integer> addedBlockObjects = new HashMap<URI, Integer>();
    Map<URI, Integer> removedBlockObjects = new HashMap<URI, Integer>();
    try {
        ExportGroup exportGroupObject = _dbClient.queryObject(ExportGroup.class, exportGroup);
        ExportUtils.getAddedAndRemovedBlockObjects(newVolumesMap, exportGroupObject, addedBlockObjects, removedBlockObjects);
        BlockExportController blockController = getController(BlockExportController.class, BlockExportController.EXPORT);
        Operation op = _dbClient.createTaskOpStatus(ExportGroup.class, exportGroup, stepId, ResourceOperationTypeEnum.UPDATE_EXPORT_GROUP);
        exportGroupObject.getOpStatus().put(stepId, op);
        _dbClient.updateObject(exportGroupObject);
        // Test mechanism to invoke a failure. No-op on production systems.
        InvokeTestFailure.internalOnlyInvokeTestFailure(InvokeTestFailure.ARTIFICIAL_FAILURE_026);
        blockController.exportGroupUpdate(exportGroup, addedBlockObjects, removedBlockObjects, addedClusters, removedClusters, adedHosts, removedHosts, addedInitiators, removedInitiators, stepId);
    // No code should be added following the call to the block controller to preserve rollback integrity
    } catch (Exception ex) {
        _log.error("Exception occured while updating export group {}", exportGroup, ex);
        // Clean up any pending tasks
        ExportTaskCompleter taskCompleter = new ExportUpdateCompleter(exportGroup, addedBlockObjects, removedBlockObjects, addedInitiators, removedInitiators, adedHosts, removedHosts, addedClusters, removedClusters, stepId);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
        taskCompleter.error(_dbClient, serviceError);
        // Fail the step
        WorkflowStepCompleter.stepFailed(stepId, DeviceControllerException.errors.jobFailed(ex));
    }
}
Also used : ExportGroup(com.emc.storageos.db.client.model.ExportGroup) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockExportController(com.emc.storageos.volumecontroller.BlockExportController) ExportTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter) ExportUpdateCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportUpdateCompleter) HashMap(java.util.HashMap) InitiatorOperation(com.emc.storageos.computesystemcontroller.impl.InitiatorCompleter.InitiatorOperation) Operation(com.emc.storageos.db.client.model.Operation) URI(java.net.URI) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) RemoteException(java.rmi.RemoteException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException)

Example 62 with ServiceError

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

the class ComputeSystemControllerImpl method removeHostsFromExport.

@Override
public void removeHostsFromExport(URI eventId, List<URI> hostIds, URI clusterId, boolean isVcenter, URI vCenterDataCenterId, String taskId) throws ControllerException {
    HostCompleter completer = null;
    try {
        completer = new HostCompleter(eventId, hostIds, false, taskId);
        Workflow workflow = _workflowService.getNewWorkflow(this, REMOVE_HOST_STORAGE_WF_NAME, true, taskId);
        String waitFor = null;
        waitFor = addStepsForRemoveHost(workflow, waitFor, hostIds, clusterId, vCenterDataCenterId, isVcenter);
        // Pass a null completer so if an error occurs we do not change the host/initiator cluster value or host
        // vcenterdatacenter value.
        waitFor = addStepForUpdatingHostAndInitiatorClusterReferences(workflow, waitFor, hostIds, NullColumnValueGetter.getNullURI(), vCenterDataCenterId, null);
        workflow.executePlan(completer, "Success", null, null, null, null);
    } catch (Exception ex) {
        String message = "removeHostFromExport caught an exception.";
        _log.error(message, ex);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
        completer.error(_dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Workflow(com.emc.storageos.workflow.Workflow) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) RemoteException(java.rmi.RemoteException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException)

Example 63 with ServiceError

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

the class ComputeSystemControllerImpl method setHostBootVolume.

@Override
public void setHostBootVolume(URI host, URI bootVolumeId, boolean updateSanBootTargets, String taskId) throws ControllerException {
    TaskCompleter completer = null;
    try {
        completer = new HostCompleter(host, false, taskId);
        Workflow workflow = _workflowService.getNewWorkflow(this, SET_SAN_BOOT_TARGETS_WF_NAME, true, taskId);
        String waitFor = addStepsForBootVolume(workflow, host, bootVolumeId);
        if (updateSanBootTargets) {
            waitFor = addStepsForSanBootTargets(workflow, host, bootVolumeId, waitFor);
        }
        workflow.executePlan(completer, "Success", null, null, null, null);
    } catch (Exception ex) {
        String message = "setHostSanBootTargets caught an exception.";
        _log.error(message, ex);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
        completer.error(_dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Workflow(com.emc.storageos.workflow.Workflow) ExportTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) RemoteException(java.rmi.RemoteException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException)

Example 64 with ServiceError

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

the class BlockDeviceController method createMirror.

/**
 * {@inheritDoc} NOTE NOTE: The signature here MUST match the Workflow.Method createMirrorMethod just above (except
 * opId).
 */
@Override
public void createMirror(URI storage, List<URI> mirrorList, Boolean isCG, Boolean createInactive, String opId) throws ControllerException {
    TaskCompleter completer = null;
    try {
        WorkflowStepCompleter.stepExecuting(opId);
        StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
        if (!isCG && mirrorList.size() == 1) {
            completer = new BlockMirrorCreateCompleter(mirrorList.get(0), opId);
            getDevice(storageObj.getSystemType()).doCreateMirror(storageObj, mirrorList.get(0), createInactive, completer);
        } else {
            boolean isListReplicaFlow = false;
            BlockMirror mirrorObj = _dbClient.queryObject(BlockMirror.class, mirrorList.get(0));
            Volume sourceVolume = _dbClient.queryObject(Volume.class, mirrorObj.getSource().getURI());
            /**
             * VPLEX/RP CG volumes may not be having back end Array Group.
             * In this case we should create element replica using createListReplica.
             * We should not use createGroup replica as backend cg will not be available in this case.
             */
            isListReplicaFlow = isListReplicaFlow(sourceVolume);
            completer = new BlockMirrorCreateCompleter(mirrorList, opId);
            if (!isListReplicaFlow) {
                getDevice(storageObj.getSystemType()).doCreateGroupMirrors(storageObj, mirrorList, createInactive, completer);
            } else {
                // List Replica
                getDevice(storageObj.getSystemType()).doCreateListReplica(storageObj, mirrorList, createInactive, 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) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) 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) BlockMirrorCreateCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorCreateCompleter) 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 65 with ServiceError

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

the class BlockDeviceController method fractureListClone.

public void fractureListClone(URI storage, List<URI> cloneList, Boolean sync, String taskId) {
    TaskCompleter completer = null;
    try {
        WorkflowStepCompleter.stepExecuting(taskId);
        StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
        completer = new CloneFractureCompleter(cloneList, taskId);
        getDevice(storageSystem.getSystemType()).doFractureListReplica(storageSystem, cloneList, sync, completer);
    } catch (Exception e) {
        _log.error(e.getMessage(), e);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        doFailTask(Volume.class, cloneList, taskId, serviceError);
        if (completer != null) {
            completer.error(_dbClient, serviceError);
        }
        WorkflowStepCompleter.stepFailed(taskId, serviceError);
    }
}
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)

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