use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGCopyVolumeCompleter in project coprhd-controller by CoprHD.
the class RPDeviceController method disableImageAccessForCreateReplicaStep.
/**
* Disable image access for after create native array replica operation
*
* @param protectionDevice
* @param clazz
* type of replica (such as Volume, BlockSnapshot or BlockSnapshotSession)
* @param copyList
* list of replica ids
* @param volumeWWNs
* wwns of volumes that are parents to replica objects
* @param opId
* @throws ControllerException
*/
public void disableImageAccessForCreateReplicaStep(URI protectionDevice, Class<? extends DataObject> clazz, List<URI> copyList, Set<String> volumeWWNs, String opId) throws ControllerException {
TaskCompleter completer = null;
try {
_log.info("Deactivating a bookmark on the RP CG(s)");
completer = new RPCGCopyVolumeCompleter(clazz, copyList, opId);
// Verify non-null storage device returned from the database client.
ProtectionSystem system = _dbClient.queryObject(ProtectionSystem.class, protectionDevice);
if (system == null || system.getInactive()) {
throw DeviceControllerExceptions.recoverpoint.databaseExceptionActivateSnapshot(protectionDevice);
}
// disable image access to that bookmark
RecoverPointClient rp = RPHelper.getRecoverPointClient(system);
MultiCopyDisableImageRequestParams request = new MultiCopyDisableImageRequestParams();
request.setVolumeWWNSet(volumeWWNs);
MultiCopyDisableImageResponse response = rp.disableImageCopies(request);
if (response == null) {
throw DeviceControllerExceptions.recoverpoint.failedDisableAccessOnRP();
}
completer.ready(_dbClient);
} catch (InternalException e) {
_log.error("Operation failed with Exception: ", e);
if (completer != null) {
completer.error(_dbClient, e);
}
} catch (Exception e) {
_log.error("Operation failed with Exception: ", e);
if (completer != null) {
completer.error(_dbClient, DeviceControllerException.errors.jobFailed(e));
}
}
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGCopyVolumeCompleter in project coprhd-controller by CoprHD.
the class RPDeviceController method enableImageAccessForCreateReplicaStep.
/**
* Enable image access before create native array replica operation
*
* @param protectionDevice
* @param clazz
* type of replica (such as Volume, BlockSnapshot or BlockSnapshotSession)
* @param copyList
* list of replica ids
* @param bookmarkName
* name of the bookmark created for this operation
* @param volumeWWNs
* wwns of volumes that are parents to replica objects
* @param opId
* @return
* @throws ControllerException
*/
public boolean enableImageAccessForCreateReplicaStep(URI protectionDevice, Class<? extends DataObject> clazz, List<URI> copyList, String bookmarkName, Set<String> volumeWWNs, String opId) throws ControllerException {
TaskCompleter completer = null;
try {
WorkflowStepCompleter.stepExecuting(opId);
_log.info(String.format("Activating bookmark %s on the RP CG(s)", bookmarkName));
completer = new RPCGCopyVolumeCompleter(clazz, copyList, opId);
// Verify non-null storage device returned from the database client.
ProtectionSystem system = _dbClient.queryObject(ProtectionSystem.class, protectionDevice);
if (system == null || system.getInactive()) {
throw DeviceControllerExceptions.recoverpoint.databaseExceptionActivateSnapshot(protectionDevice);
}
// enable image access to that bookmark
RecoverPointClient rp = RPHelper.getRecoverPointClient(system);
MultiCopyEnableImageRequestParams request = new MultiCopyEnableImageRequestParams();
request.setVolumeWWNSet(volumeWWNs);
request.setBookmark(bookmarkName);
MultiCopyEnableImageResponse response = rp.enableImageCopies(request);
if (response == null) {
throw DeviceControllerExceptions.recoverpoint.failedEnableAccessOnRP();
}
completer.ready(_dbClient);
// Update the workflow state.
WorkflowStepCompleter.stepSucceded(opId);
return true;
} catch (InternalException e) {
_log.error("Operation failed with Exception: ", e);
if (completer != null) {
completer.error(_dbClient, e);
}
stepFailed(opId, "enableImageAccessStep: Failed to enable image");
return false;
} catch (Exception e) {
_log.error("Operation failed with Exception: ", e);
if (completer != null) {
completer.error(_dbClient, DeviceControllerException.errors.jobFailed(e));
}
stepFailed(opId, "enableImageAccessStep: Failed to enable image");
return false;
}
}
Aggregations