Search in sources :

Example 1 with BlockMirrorDeleteCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorDeleteCompleter in project coprhd-controller by CoprHD.

the class BlockDeviceController method deleteMirror.

/**
 * {@inheritDoc} NOTE NOTE: The signature here MUST match the Workflow.Method deleteMirrorMethod just above (except
 * opId).
 */
@Override
public void deleteMirror(URI storage, List<URI> mirrorList, Boolean isCG, String opId) throws ControllerException {
    TaskCompleter completer = null;
    try {
        WorkflowStepCompleter.stepExecuting(opId);
        StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
        completer = new BlockMirrorDeleteCompleter(mirrorList, opId);
        if (!isCG) {
            getDevice(storageObj.getSystemType()).doDeleteMirror(storageObj, mirrorList.get(0), completer);
        } else {
            getDevice(storageObj.getSystemType()).doDeleteGroupMirrors(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 2 with BlockMirrorDeleteCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorDeleteCompleter 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 3 with BlockMirrorDeleteCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorDeleteCompleter in project coprhd-controller by CoprHD.

the class SmisBlockDeleteMirrorJob method updateStatus.

@Override
public void updateStatus(JobContext jobContext) throws Exception {
    DbClient dbClient = jobContext.getDbClient();
    JobStatus jobStatus = getJobStatus();
    try {
        if (jobStatus == JobStatus.IN_PROGRESS) {
            return;
        }
        BlockMirrorDeleteCompleter completer = (BlockMirrorDeleteCompleter) getTaskCompleter();
        BlockMirror mirror = dbClient.queryObject(BlockMirror.class, completer.getMirrorURI());
        // If terminal state update storage pool capacity
        if (jobStatus == JobStatus.SUCCESS || jobStatus == JobStatus.FAILED || jobStatus == JobStatus.FATAL_ERROR) {
            CIMConnectionFactory cimConnectionFactory = jobContext.getCimConnectionFactory();
            WBEMClient client = getWBEMClient(dbClient, cimConnectionFactory);
            URI poolURI = mirror.getPool();
            // Update capacity of storage pools.
            SmisUtils.updateStoragePoolCapacity(dbClient, client, poolURI);
        }
        if (jobStatus == JobStatus.SUCCESS) {
            _log.info("Mirror delete success");
            Volume volume = dbClient.queryObject(Volume.class, mirror.getSource().getURI());
            dbClient.markForDeletion(mirror);
            _log.info(String.format("Deleted BlockMirror %s on Volume %s", mirror, volume));
        } else if (jobStatus == JobStatus.FATAL_ERROR || jobStatus == JobStatus.FAILED) {
            String msg = String.format("Failed to delete mirror %s", mirror.getId());
            _log.error(msg);
            getTaskCompleter().error(dbClient, DeviceControllerErrors.smis.jobFailed(msg));
        }
    } catch (Exception e) {
        setFatalErrorStatus("Encountered an internal error during block delete mirror job status processing: " + e.getMessage());
        _log.error("Caught an exception while trying to updateStatus for SmisBlockDeleteMirrorJob", e);
        getTaskCompleter().error(dbClient, DeviceControllerErrors.smis.jobFailed(e.getMessage()));
    } finally {
        super.updateStatus(jobContext);
    }
}
Also used : BlockMirrorDeleteCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorDeleteCompleter) DbClient(com.emc.storageos.db.client.DbClient) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) CIMConnectionFactory(com.emc.storageos.volumecontroller.impl.smis.CIMConnectionFactory) Volume(com.emc.storageos.db.client.model.Volume) WBEMClient(javax.wbem.client.WBEMClient) URI(java.net.URI)

Example 4 with BlockMirrorDeleteCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorDeleteCompleter in project coprhd-controller by CoprHD.

the class SmisBlockDeleteCGMirrorJob method updateStatus.

@Override
public void updateStatus(JobContext jobContext) throws Exception {
    DbClient dbClient = jobContext.getDbClient();
    JobStatus jobStatus = getJobStatus();
    try {
        if (jobStatus == JobStatus.IN_PROGRESS) {
            return;
        }
        BlockMirrorDeleteCompleter completer = (BlockMirrorDeleteCompleter) getTaskCompleter();
        List<BlockMirror> mirrors = dbClient.queryObject(BlockMirror.class, completer.getIds());
        // If terminal state update storage pool capacity
        if (jobStatus == JobStatus.SUCCESS || jobStatus == JobStatus.FAILED || jobStatus == JobStatus.FATAL_ERROR) {
            CIMConnectionFactory cimConnectionFactory = jobContext.getCimConnectionFactory();
            WBEMClient client = getWBEMClient(dbClient, cimConnectionFactory);
            Set<URI> poolURIs = new HashSet<URI>();
            for (BlockMirror mirror : mirrors) {
                poolURIs.add(mirror.getPool());
            }
            for (URI poolURI : poolURIs) {
                // Update capacity of storage pools.
                SmisUtils.updateStoragePoolCapacity(dbClient, client, poolURI);
            }
        }
        if (jobStatus == JobStatus.SUCCESS) {
            _log.info("Group mirror delete success");
            dbClient.markForDeletion(mirrors);
        } else if (jobStatus == JobStatus.FATAL_ERROR || jobStatus == JobStatus.FAILED) {
            String msg = String.format("Failed to delete group mirrors");
            _log.error(msg);
            getTaskCompleter().error(dbClient, DeviceControllerErrors.smis.jobFailed(msg));
        }
    } catch (Exception e) {
        setFatalErrorStatus("Encountered an internal error during block delete group mirror job status processing: " + e.getMessage());
        _log.error("Caught an exception while trying to updateStatus for SmisBlockDeleteCGMirrorJob", e);
        getTaskCompleter().error(dbClient, DeviceControllerErrors.smis.jobFailed(e.getMessage()));
    } finally {
        super.updateStatus(jobContext);
    }
}
Also used : BlockMirrorDeleteCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorDeleteCompleter) DbClient(com.emc.storageos.db.client.DbClient) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) CIMConnectionFactory(com.emc.storageos.volumecontroller.impl.smis.CIMConnectionFactory) WBEMClient(javax.wbem.client.WBEMClient) URI(java.net.URI) HashSet(java.util.HashSet)

Aggregations

BlockMirrorDeleteCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorDeleteCompleter)4 DbClient (com.emc.storageos.db.client.DbClient)2 BlockMirror (com.emc.storageos.db.client.model.BlockMirror)2 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)2 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)2 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)2 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)2 ControllerException (com.emc.storageos.volumecontroller.ControllerException)2 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)2 ApplicationTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.ApplicationTaskCompleter)2 BlockMirrorTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter)2 BlockSnapshotEstablishGroupTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotEstablishGroupTaskCompleter)2 CloneTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.CloneTaskCompleter)2 MultiVolumeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.MultiVolumeTaskCompleter)2 SimpleTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.SimpleTaskCompleter)2 VolumeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeTaskCompleter)2 DiscoverTaskCompleter (com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.DiscoverTaskCompleter)2 ScanTaskCompleter (com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.ScanTaskCompleter)2