Search in sources :

Example 6 with ClusterUID

use of com.emc.fapiclient.ws.ClusterUID in project coprhd-controller by CoprHD.

the class RecoverPointClient method configureCGPolicy.

/**
 * Configure the entire consistency group policy.
 *
 * @param request the CG create request information
 * @param prodSites the list of production clusters
 * @param clusterIdCache the cached map of internal site names to clusters
 * @param productionCopiesUID mapping of production clusters IDs to consistency group copy IDs
 * @param nonProductionCopiesUID mapping of non-production clusters IDs to consistency group copy IDs
 * @param cgCopyNames mapping of consistency group copy IDs to consistency group copy names
 * @return the full consistency group policy
 * @throws FunctionalAPIActionFailedException_Exception
 * @throws FunctionalAPIInternalError_Exception
 */
private FullConsistencyGroupPolicy configureCGPolicy(CGRequestParams request, List<ClusterUID> prodSites, Map<String, ClusterUID> clusterIdCache, Map<Long, ConsistencyGroupCopyUID> productionCopiesUID, Map<Long, ConsistencyGroupCopyUID> nonProductionCopiesUID, Map<ConsistencyGroupCopyUID, String> cgCopyNames) throws FunctionalAPIActionFailedException_Exception, FunctionalAPIInternalError_Exception {
    logger.info("Requesting preferred RPA for cluster " + prodSites.get(0).getId());
    RpaUID preferredRPA = RecoverPointUtils.getPreferredRPAForNewCG(functionalAPI, prodSites.get(0));
    logger.info("Preferred RPA for cluster " + preferredRPA.getClusterUID().getId() + " is RPA " + preferredRPA.getRpaNumber());
    // used to create the CG; contains CG settings, copies and links
    FullConsistencyGroupPolicy fullConsistencyGroupPolicy = new FullConsistencyGroupPolicy();
    fullConsistencyGroupPolicy.setGroupName(request.getCgName());
    fullConsistencyGroupPolicy.setGroupPolicy(functionalAPI.getDefaultConsistencyGroupPolicy());
    fullConsistencyGroupPolicy.getGroupPolicy().setPrimaryRPANumber(preferredRPA.getRpaNumber());
    for (CreateCopyParams copyParam : request.getCopies()) {
        ClusterUID clusterUID = getClusterUid(copyParam, clusterIdCache);
        if (clusterUID != null) {
            RecoverPointCGCopyType copyType = getCopyType(copyParam, prodSites, clusterUID);
            if (copyType != null) {
                logger.info(String.format("Configuring %s copy %s for CG %s", copyType.toString(), copyParam.getName(), request.getCgName()));
                ConsistencyGroupCopyUID cgCopyUID = getCGCopyUid(clusterUID, copyType, null);
                FullConsistencyGroupCopyPolicy copyPolicy = new FullConsistencyGroupCopyPolicy();
                copyPolicy.setCopyName(copyParam.getName());
                copyPolicy.setCopyPolicy(functionalAPI.getDefaultConsistencyGroupCopyPolicy());
                copyPolicy.setCopyUID(cgCopyUID);
                cgCopyNames.put(cgCopyUID, copyParam.getName());
                if (getMaxNumberOfSnapShots(copyParam) > 0) {
                    copyPolicy.getCopyPolicy().getSnapshotsPolicy().setNumOfDesiredSnapshots(getMaxNumberOfSnapShots(copyParam));
                }
                fullConsistencyGroupPolicy.getCopiesPolicies().add(copyPolicy);
                if (copyType.isProduction()) {
                    fullConsistencyGroupPolicy.getProductionCopies().add(copyPolicy.getCopyUID());
                    productionCopiesUID.put(Long.valueOf(clusterUID.getId()), copyPolicy.getCopyUID());
                } else {
                    nonProductionCopiesUID.put(Long.valueOf(clusterUID.getId()), copyPolicy.getCopyUID());
                }
            } else {
                logger.error("No journal volumes specified for create CG: " + copyParam.getName());
            }
        } else {
            logger.error("No journal volumes specified for create CG: " + copyParam.getName());
        }
    }
    // set links between production and remote/local copies
    configureLinkPolicies(fullConsistencyGroupPolicy, request, productionCopiesUID, nonProductionCopiesUID, cgCopyNames);
    return fullConsistencyGroupPolicy;
}
Also used : ClusterUID(com.emc.fapiclient.ws.ClusterUID) FullConsistencyGroupPolicy(com.emc.fapiclient.ws.FullConsistencyGroupPolicy) FullConsistencyGroupCopyPolicy(com.emc.fapiclient.ws.FullConsistencyGroupCopyPolicy) RpaUID(com.emc.fapiclient.ws.RpaUID) CreateCopyParams(com.emc.storageos.recoverpoint.requests.CreateCopyParams) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID)

Example 7 with ClusterUID

use of com.emc.fapiclient.ws.ClusterUID in project coprhd-controller by CoprHD.

the class RecoverPointUtils method copiesEqual.

/**
 * Convenience method that determines if 2 CG copies are equal. The cluster and copy UIDs
 * for each copy must be equal in order for the copies to be equal.
 *
 * @param firstCopy the first copy in the comparison
 * @param secondCopy the second copy in the comparison.
 * @return true if the copy UIDs are the same
 */
public static boolean copiesEqual(GlobalCopyUID firstCopy, GlobalCopyUID secondCopy) {
    if (firstCopy != null && secondCopy != null) {
        ClusterUID firstCopyClusterUID = firstCopy.getClusterUID();
        ClusterUID secondCopyClusterUID = secondCopy.getClusterUID();
        if (firstCopyClusterUID != null && secondCopyClusterUID != null && firstCopyClusterUID.getId() == secondCopyClusterUID.getId() && firstCopy.getCopyUID() == secondCopy.getCopyUID()) {
            return true;
        }
    }
    return false;
}
Also used : ClusterUID(com.emc.fapiclient.ws.ClusterUID)

Example 8 with ClusterUID

use of com.emc.fapiclient.ws.ClusterUID in project coprhd-controller by CoprHD.

the class RecoverPointUtils method mapRPVolumeProtectionInfoToCGCopyUID.

/**
 * @param rpProtectionInfo
 * @return
 */
public static ConsistencyGroupCopyUID mapRPVolumeProtectionInfoToCGCopyUID(RecoverPointVolumeProtectionInfo rpProtectionInfo) {
    ConsistencyGroupUID cgUID = new ConsistencyGroupUID();
    ConsistencyGroupCopyUID cgCopyUID = new ConsistencyGroupCopyUID();
    if (rpProtectionInfo != null) {
        cgUID.setId(rpProtectionInfo.getRpVolumeGroupID());
        cgCopyUID.setGlobalCopyUID(new GlobalCopyUID());
        cgCopyUID.getGlobalCopyUID().setCopyUID(rpProtectionInfo.getRpVolumeGroupCopyID());
        cgCopyUID.setGroupUID(cgUID);
        ClusterUID ClusterUID = new ClusterUID();
        ClusterUID.setId(rpProtectionInfo.getRpVolumeSiteID());
        cgCopyUID.getGlobalCopyUID().setClusterUID(ClusterUID);
    }
    return cgCopyUID;
}
Also used : GlobalCopyUID(com.emc.fapiclient.ws.GlobalCopyUID) ClusterUID(com.emc.fapiclient.ws.ClusterUID) ConsistencyGroupUID(com.emc.fapiclient.ws.ConsistencyGroupUID) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID)

Example 9 with ClusterUID

use of com.emc.fapiclient.ws.ClusterUID in project coprhd-controller by CoprHD.

the class RecoverPointClientTest method testPing.

@Test
public void testPing() throws FunctionalAPIActionFailedException_Exception, FunctionalAPIInternalError_Exception {
    logger.info("Testing RecoverPoint Service ping");
    int retVal = 0;
    logger.info("Testing good credentials");
    // ----- EasyMock Setup -----//
    ClusterUID localClusterUID = buildLocalClusterUID();
    expect(mockFunctionalAPIImpl.getLocalCluster()).andReturn(localClusterUID);
    // ----- EasyMock Start -----//
    replay(mockFunctionalAPIImpl);
    try {
        // ----- Main Test Method -----//
        retVal = rpClient.ping();
    } catch (RecoverPointException e) {
        fail(e.getMessage());
    }
    // ----- EasyMock Verify -----//
    verify(mockFunctionalAPIImpl);
    assertEquals(0, retVal);
}
Also used : ClusterUID(com.emc.fapiclient.ws.ClusterUID) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) Test(org.junit.Test)

Example 10 with ClusterUID

use of com.emc.fapiclient.ws.ClusterUID in project coprhd-controller by CoprHD.

the class RecoverPointClientTest method buildLocalClusterUID.

/**
 * Builds a test local ClusterUID object.
 *
 * @return
 */
private ClusterUID buildLocalClusterUID() {
    ClusterUID localClusterUID = new ClusterUID();
    localClusterUID.setId(LOCAL_SITE_ID);
    return localClusterUID;
}
Also used : ClusterUID(com.emc.fapiclient.ws.ClusterUID)

Aggregations

ClusterUID (com.emc.fapiclient.ws.ClusterUID)16 ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)8 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)8 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)7 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)7 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)6 ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)5 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5 RPSite (com.emc.storageos.recoverpoint.objectmodel.RPSite)4 CreateCopyParams (com.emc.storageos.recoverpoint.requests.CreateCopyParams)4 CreateVolumeParams (com.emc.storageos.recoverpoint.requests.CreateVolumeParams)4 RecoverPointImageManagementUtils (com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils)4 ArrayList (java.util.ArrayList)4 ConsistencyGroupSettings (com.emc.fapiclient.ws.ConsistencyGroupSettings)3 ConsistencyGroupSettingsChangesParam (com.emc.fapiclient.ws.ConsistencyGroupSettingsChangesParam)3 GlobalCopyUID (com.emc.fapiclient.ws.GlobalCopyUID)3 ConsistencyGroupCopySettings (com.emc.fapiclient.ws.ConsistencyGroupCopySettings)2 ConsistencyGroupLinkSettings (com.emc.fapiclient.ws.ConsistencyGroupLinkSettings)2 FullConsistencyGroupPolicy (com.emc.fapiclient.ws.FullConsistencyGroupPolicy)2