use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method pauseNativeContinuousCopies.
@Override
public void pauseNativeContinuousCopies(URI storage, List<URI> mirrors, Boolean sync, String opId) throws ControllerException {
_log.info("START pause continuous copies workflow");
boolean isCG = isCGMirror(mirrors.get(0), _dbClient);
if (mirrors.size() == 1 || isCG) {
fractureMirror(storage, mirrors, isCG, sync, opId);
return;
}
Workflow workflow = _workflowService.getNewWorkflow(this, PAUSE_MIRRORS_WF_NAME, false, opId);
TaskCompleter taskCompleter = null;
BlockMirror mirror = _dbClient.queryObject(BlockMirror.class, mirrors.get(0));
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
try {
for (URI mirrorUri : mirrors) {
BlockMirror blockMirror = _dbClient.queryObject(BlockMirror.class, mirrorUri);
if (!mirrorIsPausable(asList(blockMirror))) {
String errorMsg = format("Can not pause continuous copy %s with synchronization state %s for volume %s", blockMirror.getId(), blockMirror.getSyncState(), blockMirror.getSource().getURI());
_log.error(errorMsg);
String opName = ResourceOperationTypeEnum.PAUSE_NATIVE_CONTINUOUS_COPIES.getName();
ServiceError serviceError = DeviceControllerException.errors.jobFailedOp(opName);
WorkflowStepCompleter.stepFailed(opId, serviceError);
throw new IllegalStateException(errorMsg);
}
workflow.createStep("pauseMirror", "pause mirror", null, storage, storageObj.getSystemType(), this.getClass(), fractureMirrorMethod(storage, asList(mirrorUri), isCG, sync), null, null);
}
taskCompleter = new BlockMirrorTaskCompleter(Volume.class, asList(mirror.getSource().getURI()), opId);
workflow.executePlan(taskCompleter, "Successfully paused continuous copies");
} catch (Exception e) {
String msg = String.format("Failed to execute pause continuous copies workflow for volume %s", mirror.getSource().getURI());
_log.error(msg, e);
if (taskCompleter != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
taskCompleter.error(_dbClient, serviceError);
}
}
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method removeMirrorFromGroup.
public void removeMirrorFromGroup(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 BlockMirrorTaskCompleter(BlockMirror.class, mirrorList, opId);
getDevice(storageObj.getSystemType()).doRemoveMirrorFromDeviceMaskingGroup(storageObj, mirrorList, completer);
} catch (Exception e) {
if (completer != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
completer.error(_dbClient, serviceError);
}
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(opId, serviceError);
}
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method resumeNativeContinuousCopies.
@Override
public void resumeNativeContinuousCopies(URI storage, List<URI> mirrors, String opId) throws ControllerException {
_log.info("START resume continuous copies workflow");
Workflow workflow = _workflowService.getNewWorkflow(this, RESUME_MIRRORS_WF_NAME, false, opId);
TaskCompleter taskCompleter = null;
List<BlockMirror> mirrorList = _dbClient.queryObject(BlockMirror.class, mirrors);
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
List<URI> sourceVolumes = getSourceVolumes(mirrorList);
try {
taskCompleter = new BlockMirrorTaskCompleter(Volume.class, sourceVolumes, opId);
boolean isCG = ControllerUtils.checkMirrorConsistencyGroup(mirrors, _dbClient, taskCompleter);
if (!isCG) {
for (BlockMirror blockMirror : mirrorList) {
if (SynchronizationState.FRACTURED.toString().equals(blockMirror.getSyncState())) {
workflow.createStep("resumeStep", "resume", null, storage, storageObj.getSystemType(), this.getClass(), resumeNativeContinuousCopyMethod(storage, asList(blockMirror.getId()), isCG), null, null);
}
}
} else {
if (hasFracturedState(mirrorList)) {
workflow.createStep("resumeStep", "resume", null, storage, storageObj.getSystemType(), this.getClass(), resumeNativeContinuousCopyMethod(storage, mirrors, isCG), null, null);
}
}
workflow.executePlan(taskCompleter, "Successfully resumed continuous copies");
} catch (Exception e) {
String msg = String.format("Failed to execute resume continuous copies workflow for volume %s", Joiner.on("\t").join(sourceVolumes));
_log.error(msg, e);
if (taskCompleter != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
taskCompleter.error(_dbClient, serviceError);
}
}
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method attachNativeContinuousCopies.
@Override
public void attachNativeContinuousCopies(URI storage, URI sourceVolume, List<URI> mirrorList, String opId) throws ControllerException {
_log.info("START attach continuous copies workflow");
Workflow workflow = _workflowService.getNewWorkflow(this, ATTACH_MIRRORS_WF_NAME, true, opId);
TaskCompleter taskCompleter = null;
Volume sourceVolumeObj = _dbClient.queryObject(Volume.class, sourceVolume);
boolean isCG = sourceVolumeObj.isInCG();
try {
addStepsForCreateMirrors(workflow, null, storage, sourceVolume, mirrorList, isCG);
taskCompleter = new BlockMirrorTaskCompleter(BlockMirror.class, mirrorList, opId);
workflow.executePlan(taskCompleter, "Successfully attached continuous copies");
} catch (Exception e) {
String msg = String.format("Failed to execute attach continuous copies workflow for volume %s", sourceVolume);
_log.error(msg, e);
if (taskCompleter != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
taskCompleter.error(_dbClient, serviceError);
}
}
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockMirrorTaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method establishVolumeAndNativeContinuousCopyGroupRelation.
@Override
public void establishVolumeAndNativeContinuousCopyGroupRelation(URI storage, URI sourceVolume, URI mirror, String opId) throws ControllerException {
_log.info("START establishVolumeAndNativeContinuousCopyGroupRelation workflow");
Workflow workflow = _workflowService.getNewWorkflow(this, ESTABLISH_VOLUME_MIRROR_GROUP_WF_NAME, false, opId);
TaskCompleter taskCompleter = null;
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
try {
workflow.createStep("establishStep", "create group relation between Volume group and Mirror group", null, storage, storageObj.getSystemType(), this.getClass(), establishVolumeAndNativeContinuousCopyGroupRelationMethod(storage, sourceVolume, mirror), null, null);
taskCompleter = new BlockMirrorTaskCompleter(Volume.class, asList(sourceVolume), opId);
workflow.executePlan(taskCompleter, "Successfully created group relation between Volume group and Mirror group");
} catch (Exception e) {
String msg = String.format("Failed to create group relation between Volume group and Mirror group." + "Source volume: %s, Mirror: %s", sourceVolume, mirror);
_log.error(msg, e);
if (taskCompleter != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
taskCompleter.error(_dbClient, serviceError);
}
}
}
Aggregations