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);
}
}
}
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);
}
}
}
Aggregations