Search in sources :

Example 96 with ControllerException

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

the class BlockDeviceController method deleteListMirror.

public void deleteListMirror(URI storage, List<URI> mirrorList, String opId) throws ControllerException {
    TaskCompleter completer = null;
    try {
        WorkflowStepCompleter.stepExecuting(opId);
        StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
        completer = new BlockMirrorDeleteCompleter(mirrorList, opId);
        getDevice(storageObj.getSystemType()).doDeleteListReplica(storageObj, mirrorList, 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) BlockMirrorDeleteCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorDeleteCompleter) 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 97 with ControllerException

use of com.emc.storageos.volumecontroller.ControllerException 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 98 with ControllerException

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

the class BlockDeviceController method resumeNativeContinuousCopies.

@Override
public void resumeNativeContinuousCopies(URI storage, List<URI> mirrors, String opId) throws ControllerException {
    _log.info("START resume continuous copies workflow");
    Workflow workflow = _workflowService.getNewWorkflow(this, RESUME_MIRRORS_WF_NAME, false, opId);
    TaskCompleter taskCompleter = null;
    List<BlockMirror> mirrorList = _dbClient.queryObject(BlockMirror.class, mirrors);
    StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
    List<URI> sourceVolumes = getSourceVolumes(mirrorList);
    try {
        taskCompleter = new BlockMirrorTaskCompleter(Volume.class, sourceVolumes, opId);
        boolean isCG = ControllerUtils.checkMirrorConsistencyGroup(mirrors, _dbClient, taskCompleter);
        if (!isCG) {
            for (BlockMirror blockMirror : mirrorList) {
                if (SynchronizationState.FRACTURED.toString().equals(blockMirror.getSyncState())) {
                    workflow.createStep("resumeStep", "resume", null, storage, storageObj.getSystemType(), this.getClass(), resumeNativeContinuousCopyMethod(storage, asList(blockMirror.getId()), isCG), null, null);
                }
            }
        } else {
            if (hasFracturedState(mirrorList)) {
                workflow.createStep("resumeStep", "resume", null, storage, storageObj.getSystemType(), this.getClass(), resumeNativeContinuousCopyMethod(storage, mirrors, isCG), null, null);
            }
        }
        workflow.executePlan(taskCompleter, "Successfully resumed continuous copies");
    } catch (Exception e) {
        String msg = String.format("Failed to execute resume continuous copies workflow for volume %s", Joiner.on("\t").join(sourceVolumes));
        _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) BlockMirrorTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter) Workflow(com.emc.storageos.workflow.Workflow) 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) 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) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 99 with ControllerException

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

the class MaskingWorkflowEntryPoints method doExportMaskZoningMapUpdate.

/**
 * Zoning map update entry point
 */
public void doExportMaskZoningMapUpdate(URI exportGroupURI, URI storageURI, String token) throws ControllerException {
    _log.info("START - doExportMaskZoningMapUpdate");
    WorkflowStepCompleter.stepExecuting(token);
    try {
        ExportGroup eg = _dbClient.queryObject(ExportGroup.class, exportGroupURI);
        List<ExportMask> exportMasks = ExportMaskUtils.getExportMasks(_dbClient, eg);
        // so fetch the 0th URI
        if (!exportMasks.isEmpty()) {
            ExportMask mask = exportMasks.get(0);
            _blockScheduler.updateZoningMap(mask, eg.getVirtualArray(), exportGroupURI);
        }
        WorkflowStepCompleter.stepSucceded(token);
    } catch (final InternalException e) {
        _log.error("Encountered an exception", e);
        WorkflowStepCompleter.stepFailed(token, e);
    } catch (final Exception e) {
        _log.error("Encountered an exception", e);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        WorkflowStepCompleter.stepFailed(token, serviceError);
    }
    _log.info("END - doExportMaskZoningMapUpdate");
}
Also used : ExportGroup(com.emc.storageos.db.client.model.ExportGroup) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) ExportMask(com.emc.storageos.db.client.model.ExportMask) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException)

Example 100 with ControllerException

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

the class MaskingWorkflowEntryPoints method doExportGroupRemoveVolumes.

public void doExportGroupRemoveVolumes(URI storageURI, URI exportGroupURI, URI exportMaskURI, List<URI> volumeURIs, List<URI> initiatorURIs, TaskCompleter taskCompleter, String token) throws ControllerException {
    String call = String.format("doExportGroupRemoveVolumes(%s, %s, %s, [%s], [%s], %s)", storageURI.toString(), exportGroupURI.toString(), exportMaskURI.toString(), volumeURIs != null ? Joiner.on(',').join(volumeURIs) : "No Volumes", initiatorURIs != null ? Joiner.on(',').join(initiatorURIs) : "No Initiators", taskCompleter.getOpId());
    try {
        WorkflowStepCompleter.stepExecuting(token);
        ExportMask exportMask = _dbClient.queryObject(ExportMask.class, exportMaskURI);
        StorageSystem storage = _dbClient.queryObject(StorageSystem.class, storageURI);
        List<Initiator> initiators = new ArrayList<>();
        if (initiatorURIs != null && !initiatorURIs.isEmpty()) {
            initiators = _dbClient.queryObject(Initiator.class, initiatorURIs);
        }
        // Test mechanism to invoke a failure. No-op on production systems.
        InvokeTestFailure.internalOnlyInvokeTestFailure(InvokeTestFailure.ARTIFICIAL_FAILURE_017);
        getDevice(storage).doExportRemoveVolumes(storage, exportMask, volumeURIs, initiators, taskCompleter);
        _log.info(String.format("%s end", call));
    } catch (final InternalException e) {
        _log.info(call + " Encountered an exception", e);
        taskCompleter.error(_dbClient, e);
    } catch (final Exception e) {
        _log.info(call + " Encountered an exception", e);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        taskCompleter.error(_dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Initiator(com.emc.storageos.db.client.model.Initiator) ExportMask(com.emc.storageos.db.client.model.ExportMask) ArrayList(java.util.ArrayList) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException)

Aggregations

ControllerException (com.emc.storageos.volumecontroller.ControllerException)299 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)280 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)211 WorkflowException (com.emc.storageos.workflow.WorkflowException)188 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)182 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)151 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)121 ArrayList (java.util.ArrayList)93 URI (java.net.URI)87 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)75 Workflow (com.emc.storageos.workflow.Workflow)68 URISyntaxException (java.net.URISyntaxException)63 Volume (com.emc.storageos.db.client.model.Volume)62 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)61 DataBindingException (javax.xml.bind.DataBindingException)61 VolumeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeTaskCompleter)55 CloneTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneTaskCompleter)52 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)51 NamedURI (com.emc.storageos.db.client.model.NamedURI)50 FileShare (com.emc.storageos.db.client.model.FileShare)49