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