use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockConsistencyGroupDeleteCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method deleteReplicationGroup.
/**
* Delete array clone replication group
*
* @param storage
* storage system
* @param consistencyGroup
* consistency group URI
* @param groupName
* clone group name
* @param keepRGName
* @param markInactive
* @param sourceGroupName
* source group name
* @return the created workflow Method
*/
public void deleteReplicationGroup(URI storage, URI consistencyGroup, String groupName, Boolean keepRGName, Boolean markInactive, String sourceGroupName, String opId) throws ControllerException {
TaskCompleter completer = null;
try {
WorkflowStepCompleter.stepExecuting(opId);
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
completer = new BlockConsistencyGroupDeleteCompleter(consistencyGroup, storage, groupName, keepRGName, markInactive, opId);
getDevice(storageObj.getSystemType()).doDeleteConsistencyGroup(storageObj, consistencyGroup, groupName, keepRGName, markInactive, sourceGroupName, completer);
} catch (Exception e) {
if (completer != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
completer.error(_dbClient, serviceError);
}
throw DeviceControllerException.exceptions.deleteConsistencyGroupFailed(e);
}
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockConsistencyGroupDeleteCompleter in project coprhd-controller by CoprHD.
the class BlockStorageDeviceTest method testDeleteConsistencyGroup.
@Test
public void testDeleteConsistencyGroup() {
URI consistencyGroup = getConsistencyGroup().getId();
String token = UUID.randomUUID().toString() + UUID.randomUUID().toString();
BlockConsistencyGroupDeleteCompleter taskCompleter = new BlockConsistencyGroupDeleteCompleter(consistencyGroup, null, null, false, true, token);
_deviceController.doDeleteConsistencyGroup(_storageSystem, consistencyGroup, null, null, true, taskCompleter);
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockConsistencyGroupDeleteCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method deleteReplicationGroupInConsistencyGroup.
public void deleteReplicationGroupInConsistencyGroup(URI storage, URI consistencyGroup, String groupName, Boolean keepRGName, Boolean markInactive, Boolean throwErrorIfNotDeleted, String opId) throws ControllerException {
TaskCompleter completer = null;
try {
WorkflowStepCompleter.stepExecuting(opId);
completer = new BlockConsistencyGroupDeleteCompleter(consistencyGroup, storage, groupName, keepRGName, markInactive, opId);
List<String> lockKeys = new ArrayList<String>();
if (groupName != null && !groupName.isEmpty()) {
lockKeys.add(ControllerLockingUtil.getReplicationGroupStorageKey(_dbClient, groupName, storage));
} else if (!NullColumnValueGetter.isNullURI(consistencyGroup)) {
// Lock the CG for the step duration.
lockKeys.add(ControllerLockingUtil.getConsistencyGroupStorageKey(_dbClient, consistencyGroup, storage));
}
if (!lockKeys.isEmpty()) {
_workflowService.acquireWorkflowStepLocks(opId, lockKeys, LockTimeoutValue.get(LockType.ARRAY_CG));
}
// Check if there is any members in the replication group before delete it.
if (groupName != null && !groupName.isEmpty()) {
List<Volume> groupVolumes = ControllerUtils.getVolumesPartOfRG(storage, groupName, _dbClient);
if (groupVolumes != null && !groupVolumes.isEmpty()) {
String msg = String.format("The replication group %s still have volumes, will not delete the replication group", groupName);
_log.warn(msg);
if (throwErrorIfNotDeleted) {
completer.error(_dbClient, DeviceControllerException.exceptions.couldNotDeleteReplicationGroup(msg));
} else {
completer.ready(_dbClient);
}
return;
}
}
InvokeTestFailure.internalOnlyInvokeTestFailure(InvokeTestFailure.ARTIFICIAL_FAILURE_086);
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
getDevice(storageObj.getSystemType()).doDeleteConsistencyGroup(storageObj, consistencyGroup, groupName, keepRGName, markInactive, completer);
} catch (Exception e) {
if (completer != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
completer.error(_dbClient, serviceError);
}
throw DeviceControllerException.exceptions.deleteConsistencyGroupFailed(e);
}
}
Aggregations