Search in sources :

Example 1 with BlockSnapshotSessionUnlinkTargetCompleter

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

the class SmisBlockSnapshotSessionUnlinkTargetJob method updateStatus.

/**
 * {@inheritDoc}
 */
@Override
public void updateStatus(JobContext jobContext) throws Exception {
    DbClient dbClient = jobContext.getDbClient();
    JobStatus jobStatus = getJobStatus();
    BlockSnapshotSessionUnlinkTargetCompleter completer = (BlockSnapshotSessionUnlinkTargetCompleter) getTaskCompleter();
    boolean deleteTarget = completer.getDeleteTarget();
    try {
        if (jobStatus == JobStatus.IN_PROGRESS) {
            return;
        }
        if (jobStatus == JobStatus.SUCCESS) {
            // not be represented by a BlockSnapshot instance in ViPR.
            if (!deleteTarget) {
                List<BlockSnapshot> allSnapshots = completer.getAllSnapshots(dbClient);
                promoteSnapshotsToVolume(allSnapshots, dbClient);
            } else {
            // TBD - Update capacity of storage pools when deleted?
            // SmisUtils.updateStoragePoolCapacity(dbClient, client, poolURI);
            }
            s_logger.info("Post-processing successful for unlink snapshot session target for task ", getTaskCompleter().getOpId());
        } else if (jobStatus == JobStatus.FAILED || jobStatus == JobStatus.FATAL_ERROR) {
            s_logger.info("Failed to unlink snapshot session target for task ", getTaskCompleter().getOpId());
        }
    } catch (Exception e) {
        setPostProcessingErrorStatus("Encountered an internal error in unlink snapshot session target job status processing: " + e.getMessage());
        s_logger.error("Encountered an internal error in unlink snapshot session target job status processing", e);
    } finally {
        if (!deleteTarget) {
            // We only want to invoke the completer if we are
            // not deleting the target after we unlink the target
            // from the array snapshot.
            super.updateStatus(jobContext);
        }
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) BlockSnapshotSessionUnlinkTargetCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotSessionUnlinkTargetCompleter)

Example 2 with BlockSnapshotSessionUnlinkTargetCompleter

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

the class BlockDeviceController method unlinkBlockSnapshotSessionTarget.

/**
 * Unlinks the target from the array snapshot on the storage system
 * with the passed URI. Additionally, the target device will be deleted
 * if so requested.
 *
 * @param systemURI
 *            The URI of the storage system.
 * @param snapSessionURI
 *            The URI of the BlockSnapshotSession instance.
 * @param snapshotURI
 *            The URI of the BlockSnapshot instance representing the linked target volume.
 * @param deleteTarget
 *            True if the target volume should be deleted.
 * @param stepId
 *            The unique id of the workflow step in which the target is unlinked.
 */
public void unlinkBlockSnapshotSessionTarget(URI systemURI, URI snapSessionURI, URI snapshotURI, Boolean deleteTarget, String stepId) {
    TaskCompleter completer = null;
    try {
        StorageSystem system = _dbClient.queryObject(StorageSystem.class, systemURI);
        completer = new BlockSnapshotSessionUnlinkTargetCompleter(snapSessionURI, snapshotURI, deleteTarget, stepId);
        getDevice(system.getSystemType()).doUnlinkBlockSnapshotSessionTarget(system, snapSessionURI, snapshotURI, deleteTarget, completer);
    } catch (Exception e) {
        if (completer != null) {
            ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
            completer.error(_dbClient, serviceError);
        } else {
            throw DeviceControllerException.exceptions.unlinkBlockSnapshotSessionTargetsFailed(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) BlockSnapshotSessionUnlinkTargetCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotSessionUnlinkTargetCompleter) 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

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