Search in sources :

Example 31 with ControllerException

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

the class BlockDeviceController method restoreFromCloneStep.

public boolean restoreFromCloneStep(URI storage, List<URI> clones, Boolean updateOpStatus, boolean isCG, String opId) throws ControllerException {
    TaskCompleter completer = null;
    try {
        StorageSystem storageDevice = _dbClient.queryObject(StorageSystem.class, storage);
        if (!isCG) {
            completer = new CloneRestoreCompleter(clones.get(0), opId);
            getDevice(storageDevice.getSystemType()).doRestoreFromClone(storageDevice, clones.get(0), completer);
        } else {
            CloneRestoreCompleter taskCompleter = new CloneRestoreCompleter(clones, opId);
            getDevice(storageDevice.getSystemType()).doRestoreFromGroupClone(storageDevice, clones, taskCompleter);
        }
    } catch (Exception e) {
        _log.error(String.format("restoreFromClone failed - storage: %s,clone: %s", storage.toString(), clones.get(0).toString()));
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        completer.error(_dbClient, serviceError);
        doFailTask(Volume.class, clones, opId, serviceError);
        WorkflowStepCompleter.stepFailed(opId, serviceError);
        return false;
    }
    return true;
}
Also used : CloneRestoreCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneRestoreCompleter) 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)

Example 32 with ControllerException

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

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

the class BlockDeviceController method createMetaVolume.

/**
 * {@inheritDoc} NOTE NOTE: The signature here MUST match the Workflow.Method createMetaVolumeMethod just above
 * (except opId).
 */
@Override
public void createMetaVolume(URI systemURI, URI poolURI, URI volumeURI, VirtualPoolCapabilityValuesWrapper capabilities, String opId) throws ControllerException {
    try {
        StringBuilder logMsgBuilder = new StringBuilder(String.format("createMetaVolume start - Array:%s Pool:%s, Volume:%s", systemURI.toString(), poolURI.toString(), volumeURI.toString()));
        _log.info(logMsgBuilder.toString());
        StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, systemURI);
        Volume volume = _dbClient.queryObject(Volume.class, volumeURI);
        StoragePool storagePool = _dbClient.queryObject(StoragePool.class, poolURI);
        VirtualPool vpool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
        MetaVolumeRecommendation recommendation = MetaVolumeUtils.getCreateRecommendation(storageSystem, storagePool, volume.getCapacity(), volume.getThinlyProvisioned(), vpool.getFastExpansion(), capabilities);
        MetaVolumeUtils.prepareMetaVolume(volume, recommendation.getMetaMemberSize(), recommendation.getMetaMemberCount(), recommendation.getMetaVolumeType().toString(), _dbClient);
        VolumeCreateCompleter completer = new VolumeCreateCompleter(volumeURI, opId);
        WorkflowStepCompleter.stepExecuting(completer.getOpId());
        getDevice(storageSystem.getSystemType()).doCreateMetaVolume(storageSystem, storagePool, volume, capabilities, recommendation, completer);
        logMsgBuilder = new StringBuilder(String.format("createMetaVolume end - Array:%s Pool:%s, Volume:%s", systemURI.toString(), poolURI.toString(), volumeURI.toString()));
        _log.info(logMsgBuilder.toString());
    } catch (InternalException e) {
        _log.error(String.format("createMetaVolume Failed - Array:%s Pool:%s, Volume:%s", systemURI.toString(), poolURI.toString(), volumeURI.toString()));
        doFailTask(Volume.class, volumeURI, opId, e);
        WorkflowStepCompleter.stepFailed(opId, e);
    } catch (Exception e) {
        _log.error(String.format("createMetaVolume Failed - Array:%s Pool:%s, Volume:%s", systemURI.toString(), poolURI.toString(), volumeURI.toString()));
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        doFailTask(Volume.class, volumeURI, opId, serviceError);
        WorkflowStepCompleter.stepFailed(opId, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) StoragePool(com.emc.storageos.db.client.model.StoragePool) Volume(com.emc.storageos.db.client.model.Volume) VolumeCreateCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeCreateCompleter) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) MetaVolumeRecommendation(com.emc.storageos.volumecontroller.impl.smis.MetaVolumeRecommendation) 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) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException)

Example 34 with ControllerException

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

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

the class BlockDeviceController method resyncSnapshot.

@Override
public void resyncSnapshot(URI storage, 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 BlockSnapshotResyncCompleter(snapObj, opId, updateOpStatus);
        getDevice(storageDevice.getSystemType()).doResyncSnapshot(storageDevice, volume, snapshot, completer);
    } catch (Exception e) {
        _log.error(String.format("resync snapshot failed - storage: %s, volume: %s, snapshot: %s", storage.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);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockSnapshotResyncCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotResyncCompleter) 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)

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