Search in sources :

Example 6 with CreateBookmarkRequestParams

use of com.emc.storageos.recoverpoint.requests.CreateBookmarkRequestParams in project coprhd-controller by CoprHD.

the class RecoverPointClientIntegrationTest method recreateCGAndBookmark.

public void recreateCGAndBookmark() throws RecoverPointException {
    CreateBookmarkRequestParams params = new CreateBookmarkRequestParams();
    Bookmarkname = "BourneBookmark_";
    Random randomnumber = new Random();
    Bookmarkname += Math.abs(randomnumber.nextInt());
    params.setBookmark(Bookmarkname);
    Set<String> WWNSetToBookmark = new HashSet<String>();
    WWNSetToBookmark.add(BourneRPTestCRRLUN1WWN);
    WWNSetToBookmark.add(BourneRPTestCRRLUN2WWN);
    params.setVolumeWWNSet(WWNSetToBookmark);
    recreateCG();
    rpClient.createBookmarks(params);
}
Also used : CreateBookmarkRequestParams(com.emc.storageos.recoverpoint.requests.CreateBookmarkRequestParams) Random(java.util.Random) HashSet(java.util.HashSet)

Example 7 with CreateBookmarkRequestParams

use of com.emc.storageos.recoverpoint.requests.CreateBookmarkRequestParams in project coprhd-controller by CoprHD.

the class RPDeviceController method createBookmarkStep.

/**
 * This method creates a RP bookmark
 *
 * @param snapshotList
 *            List of snapshot
 * @param system
 *            Protection Sytem
 * @param snapshotName
 *            snapshot name
 * @param volumeWWNs
 *            WWNs of the volumes whose snap is requested
 * @param rpBookmarkOnly
 *            if true, an RP bookmark is taken or a local array snap is performed.
 * @param token
 *            step Id corresponding to this step.
 * @return true if successful, false otherwise.
 */
public boolean createBookmarkStep(List<URI> snapshotList, ProtectionSystem system, String snapshotName, Set<String> volumeWWNs, boolean rpBookmarkOnly, String token) {
    RecoverPointClient rp = RPHelper.getRecoverPointClient(system);
    CreateBookmarkRequestParams request = new CreateBookmarkRequestParams();
    request.setVolumeWWNSet(volumeWWNs);
    request.setBookmark(snapshotName);
    try {
        // Create the bookmark on the RP System
        CreateBookmarkResponse response = rp.createBookmarks(request);
        if (response == null) {
            throw DeviceControllerExceptions.recoverpoint.failedToCreateBookmark();
        }
        if (snapshotList != null && !snapshotList.isEmpty()) {
            // RP Bookmark-only flow.
            if (rpBookmarkOnly) {
                // This will update the blocksnapshot object based on the return of the EM call
                // The construct method will set the task completer on each snapshot
                constructSnapshotObjectFromBookmark(response, system, snapshotList, snapshotName, token);
            } else {
                // image access later on.
                for (URI snapshotURI : snapshotList) {
                    BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, snapshotURI);
                    snapshot.setEmName(snapshotName);
                    _dbClient.updateObject(snapshot);
                }
            }
        }
        WorkflowStepCompleter.stepSucceded(token);
    } catch (RecoverPointException e) {
        _log.error("create bookmark step failed with a RecoverPoint exception: ", e);
        WorkflowStepCompleter.stepFailed(token, e);
        return false;
    } catch (Exception e) {
        _log.error("create bookmark step failed with an unchecked exception: ", e);
        WorkflowStepCompleter.stepFailed(token, DeviceControllerException.errors.jobFailed(e));
        return false;
    }
    return true;
}
Also used : CreateBookmarkRequestParams(com.emc.storageos.recoverpoint.requests.CreateBookmarkRequestParams) RecoverPointClient(com.emc.storageos.recoverpoint.impl.RecoverPointClient) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) LockRetryException(com.emc.storageos.locking.LockRetryException) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) URISyntaxException(java.net.URISyntaxException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) CreateBookmarkResponse(com.emc.storageos.recoverpoint.responses.CreateBookmarkResponse)

Aggregations

CreateBookmarkRequestParams (com.emc.storageos.recoverpoint.requests.CreateBookmarkRequestParams)7 HashSet (java.util.HashSet)6 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)4 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)4 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)4 RPConsistencyGroup (com.emc.storageos.recoverpoint.objectmodel.RPConsistencyGroup)3 RPCopy (com.emc.storageos.recoverpoint.objectmodel.RPCopy)3 RecoverPointBookmarkManagementUtils (com.emc.storageos.recoverpoint.utils.RecoverPointBookmarkManagementUtils)3 RecoverPointImageManagementUtils (com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils)3 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)2 NamedURI (com.emc.storageos.db.client.model.NamedURI)2 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)2 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 LockRetryException (com.emc.storageos.locking.LockRetryException)2 RecoverPointClient (com.emc.storageos.recoverpoint.impl.RecoverPointClient)2 RecoverPointVolumeProtectionInfo (com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo)2 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)2 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)2 ControllerException (com.emc.storageos.volumecontroller.ControllerException)2 WorkflowException (com.emc.storageos.workflow.WorkflowException)2