Search in sources :

Example 26 with RecoverPointException

use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.

the class RecoverPointClientIntegrationTest method recreateCGCDPOnly.

public void recreateCGCDPOnly() throws RecoverPointException {
    RecoverPointVolumeProtectionInfo protectionInfo = null;
    try {
        protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestProdLUN1WWN);
    } catch (RecoverPointException e) {
        logger.info("Ignore getProtectionInfoForVolume error");
    }
    if (protectionInfo != null) {
        logger.info("Delete previous CG (if it exists)");
        rpClient.deleteCG(protectionInfo);
    }
    logger.info("Create the CG with one replication set");
    // CreateCGRequestParams createCGParams = CreateCGParamsHelper(true, false, 2);
    CGRequestParams createCGParams = createCGParamsHelper(true, false, 1);
    rpClient.createCG(createCGParams, false, false);
}
Also used : RecoverPointVolumeProtectionInfo(com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) CGRequestParams(com.emc.storageos.recoverpoint.requests.CGRequestParams)

Example 27 with RecoverPointException

use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.

the class RecoverPointClientIntegrationTest method testFailover.

// @Test
public void testFailover() {
    logger.info("Testing RecoverPoint Failover For Volume");
    RecoverPointVolumeProtectionInfo protectionInfo = null;
    RecoverPointVolumeProtectionInfo failbackProtectionInfo = null;
    boolean foundError = false;
    try {
        recreateCGAndBookmark();
        protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCRRLUN1WWN);
        failbackProtectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestProdLUN1WWN);
    } catch (RecoverPointException e) {
        foundError = true;
        fail(e.getMessage());
    }
    if (protectionInfo == null) {
        foundError = true;
        fail("Failed to find protection info for WWN: " + BourneRPTestCRRLUN1WWN);
    }
    if (failbackProtectionInfo == null) {
        foundError = true;
        fail("Failed to find protection info for WWN: " + BourneRPTestProdLUN1WWN);
    }
    if (!foundError) {
        // Verify this is a source
        if (protectionInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.PROTECTED_TARGET) {
            logger.info("RecoverPoint Get Protection Info For Volume PASSED");
            logger.info("Protected target volume " + BourneRPTestCRRLUN1WWN + " is on CG Name: " + protectionInfo.getRpProtectionName());
        } else {
            foundError = true;
            fail("Volume " + BourneRPTestCRRLUN1WWN + " did not map to a protected source target");
        }
    }
    RPCopyRequestParams failoverRequest = new RPCopyRequestParams();
    RPCopyRequestParams failbackRequest = new RPCopyRequestParams();
    failoverRequest.setCopyVolumeInfo(protectionInfo);
    failbackRequest.setCopyVolumeInfo(failbackProtectionInfo);
    try {
        // try {
        // logger.info("Delete the CDP copy");
        // RecoverPointVolumeProtectionInfo deleteCopyInfo = null;
        // deleteCopyInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCDPLUN1WWN);
        // rpClient.deleteCopy(deleteCopyInfo);
        // } catch (Exception e) {
        // logger.info("Ignore error deleting CDP copy");
        // }
        logger.info("Failover start");
        rpClient.failoverCopy(failoverRequest);
        logger.info("Sleep 15 seconds before failback");
        Thread.sleep(15000);
        logger.info("Failback start");
        rpClient.failoverCopy(failbackRequest);
    } catch (RecoverPointException e) {
        foundError = true;
        fail(e.getMessage());
    } catch (InterruptedException e) {
        foundError = true;
        fail(e.getMessage());
    }
    if (!foundError) {
        logger.info("TestFailover PASSED");
    }
}
Also used : RecoverPointVolumeProtectionInfo(com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) RPCopyRequestParams(com.emc.storageos.recoverpoint.requests.RPCopyRequestParams)

Example 28 with RecoverPointException

use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.

the class RecoverPointClientIntegrationTest method testGetAllCGs.

@Test
public void testGetAllCGs() {
    logger.info("Testing RecoverPoint CG Retrieval");
    Set<GetCGsResponse> cgs;
    try {
        cgs = rpClient.getAllCGs();
        Set<String> wwns = new HashSet<String>();
        for (GetCGsResponse cg : cgs) {
            logger.info("CG: " + cg);
            assertNotNull(cg.getCgName());
            assertNotNull(cg.getCgId());
            // Make sure certain fields are filled-in
            if (cg.getCopies() != null) {
                for (GetCopyResponse copy : cg.getCopies()) {
                    assertNotNull(copy.getJournals());
                    assertNotNull(copy.getName());
                    for (GetVolumeResponse volume : copy.getJournals()) {
                        assertNotNull(volume.getInternalSiteName());
                        assertNotNull(volume.getRpCopyName());
                        assertNotNull(volume.getWwn());
                        // Make sure the same volume isn't in more than one place in the list.
                        assertFalse(wwns.contains(volume.getWwn()));
                        wwns.add(volume.getWwn());
                    }
                }
            }
            if (cg.getRsets() != null) {
                for (GetRSetResponse rset : cg.getRsets()) {
                    assertNotNull(rset.getName());
                    assertNotNull(rset.getVolumes());
                    for (GetVolumeResponse volume : rset.getVolumes()) {
                        assertNotNull(volume.getInternalSiteName());
                        assertNotNull(volume.getRpCopyName());
                        assertNotNull(volume.getWwn());
                        // Make sure the same volume isn't in more than one place in the list.
                        assertFalse(wwns.contains(volume.getWwn()));
                        wwns.add(volume.getWwn());
                    }
                }
            }
        // Make sure you have journals, sources, and targets
        }
    } catch (RecoverPointException e) {
        fail(e.getMessage());
    }
}
Also used : GetCGsResponse(com.emc.storageos.recoverpoint.responses.GetCGsResponse) GetCopyResponse(com.emc.storageos.recoverpoint.responses.GetCopyResponse) GetRSetResponse(com.emc.storageos.recoverpoint.responses.GetRSetResponse) GetVolumeResponse(com.emc.storageos.recoverpoint.responses.GetVolumeResponse) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 29 with RecoverPointException

use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.

the class RPCommunicationInterface method discover.

@Override
public void discover(AccessProfile accessProfile) throws BaseCollectionException {
    URI storageSystemId = null;
    ProtectionSystem protectionSystem = null;
    boolean discoverySuccess = true;
    StringBuffer errMsgBuilder = new StringBuffer();
    String detailedStatusMessage = "Unknown Status";
    boolean isNewlyCreated = false;
    try {
        _log.info("Access Profile Details :  IpAddress : {}, PortNumber : {}", accessProfile.getIpAddress(), accessProfile.getPortNumber());
        storageSystemId = accessProfile.getSystemId();
        protectionSystem = _dbClient.queryObject(ProtectionSystem.class, storageSystemId);
        if (protectionSystem.getDiscoveryStatus().equals(DiscoveredDataObject.DataCollectionJobStatus.CREATED.toString())) {
            isNewlyCreated = true;
        }
        if (StorageSystem.Discovery_Namespaces.UNMANAGED_CGS.toString().equalsIgnoreCase(accessProfile.getnamespace())) {
            try {
                unManagedCGDiscoverer.discoverUnManagedObjects(accessProfile, _dbClient, _partitionManager);
            } catch (RecoverPointException rpe) {
                discoverySuccess = false;
                String msg = "Discover RecoverPoint Unmanaged CGs failed. Protection system: " + storageSystemId;
                buildErrMsg(errMsgBuilder, rpe, msg);
            }
        } else {
            try {
                discoverCluster(protectionSystem);
            } catch (RecoverPointException rpe) {
                discoverySuccess = false;
                String msg = "Discover RecoverPoint cluster failed. Protection system: " + storageSystemId;
                buildErrMsg(errMsgBuilder, rpe, msg);
            }
            // get RP array mappings
            try {
                if (discoverySuccess) {
                    discoverRPSiteArrays(protectionSystem);
                    _dbClient.persistObject(protectionSystem);
                }
            } catch (Exception rpe) {
                discoverySuccess = false;
                String msg = "Discover RecoverPoint site/cluster failed. Protection system: " + storageSystemId;
                buildErrMsg(errMsgBuilder, rpe, msg);
            }
            try {
                if (discoverySuccess) {
                    discoverConnectivity(protectionSystem);
                }
            } catch (Exception rpe) {
                discoverySuccess = false;
                String msg = "Discover RecoverPoint connectivity failed. Protection system: " + storageSystemId;
                buildErrMsg(errMsgBuilder, rpe, msg);
            }
            // Perform maintenance on the RP bookmarks; some may no longer be valid
            try {
                if (discoverySuccess) {
                    RPHelper.cleanupSnapshots(_dbClient, protectionSystem);
                }
            } catch (Exception rpe) {
                discoverySuccess = false;
                String msg = "Snapshot maintenance failed. Protection system: " + storageSystemId;
                buildErrMsg(errMsgBuilder, rpe, msg);
            }
            // Rematch storage pools for RP virtual pools
            try {
                if (discoverySuccess && isNewlyCreated) {
                    matchVPools(protectionSystem.getId());
                }
            } catch (Exception rpe) {
                discoverySuccess = false;
                String msg = "Virtual Pool matching failed. Protection system: " + storageSystemId;
                buildErrMsg(errMsgBuilder, rpe, msg);
            }
            // Discover the Connected-via-RP-itself Storage Systems
            try {
                if (discoverySuccess) {
                    discoverVisibleStorageSystems(protectionSystem);
                }
            } catch (Exception rpe) {
                discoverySuccess = false;
                String msg = "RP-visible storage system discovery failed. Protection system: " + storageSystemId;
                buildErrMsg(errMsgBuilder, rpe, msg);
            }
            // Discover the Connected-via-NetworkStorage Systems
            try {
                if (discoverySuccess) {
                    discoverAssociatedStorageSystems(protectionSystem);
                }
            } catch (Exception rpe) {
                discoverySuccess = false;
                String msg = "Storage system discovery failed. Protection system: " + storageSystemId;
                buildErrMsg(errMsgBuilder, rpe, msg);
            }
            // Discover the protection sets
            try {
                if (discoverySuccess) {
                    discoverProtectionSets(protectionSystem);
                }
            } catch (Exception rpe) {
                discoverySuccess = false;
                String msg = "Discovery of protection sets failed. Protection system: " + storageSystemId;
                buildErrMsg(errMsgBuilder, rpe, msg);
            }
            // Discover the protection system cluster connectivity topology information
            try {
                if (discoverySuccess) {
                    discoverTopology(protectionSystem);
                }
            } catch (Exception rpe) {
                discoverySuccess = false;
                String msg = "Discovery of topology failed. Protection system: " + storageSystemId;
                buildErrMsg(errMsgBuilder, rpe, msg);
            }
        }
        if (!discoverySuccess) {
            throw DeviceControllerExceptions.recoverpoint.discoveryFailure(errMsgBuilder.toString());
        } else {
            detailedStatusMessage = String.format("Discovery completed successfully for Protection System: %s", storageSystemId.toString());
        }
    } catch (Exception e) {
        detailedStatusMessage = String.format("Discovery failed for Protection System %s because %s", storageSystemId.toString(), e.getLocalizedMessage());
        _log.error(detailedStatusMessage, e);
        throw DeviceControllerExceptions.recoverpoint.discoveryFailure(detailedStatusMessage);
    } finally {
        releaseResources();
        if (null != protectionSystem) {
            try {
                // set detailed message
                protectionSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
                _dbClient.persistObject(protectionSystem);
            } catch (DatabaseException ex) {
                _log.error("Error while persisting object to DB", ex);
            }
        }
    }
}
Also used : RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) URI(java.net.URI) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) URISyntaxException(java.net.URISyntaxException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) RecoverPointCollectionException(com.emc.storageos.plugins.metering.recoverpoint.RecoverPointCollectionException)

Example 30 with RecoverPointException

use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException 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

RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)30 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)12 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)12 RecoverPointVolumeProtectionInfo (com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo)12 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)10 HashSet (java.util.HashSet)9 ClusterUID (com.emc.fapiclient.ws.ClusterUID)6 HashMap (java.util.HashMap)6 ConsistencyGroupSettings (com.emc.fapiclient.ws.ConsistencyGroupSettings)5 ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)5 URISyntaxException (java.net.URISyntaxException)5 ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)4 URI (java.net.URI)4 Test (org.junit.Test)4 ClusterConfiguration (com.emc.fapiclient.ws.ClusterConfiguration)3 ConsistencyGroupSettingsChangesParam (com.emc.fapiclient.ws.ConsistencyGroupSettingsChangesParam)3 ReplicationSetSettings (com.emc.fapiclient.ws.ReplicationSetSettings)3 CreateBookmarkRequestParams (com.emc.storageos.recoverpoint.requests.CreateBookmarkRequestParams)3 RecoverPointImageManagementUtils (com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils)3 ArrayList (java.util.ArrayList)3