Search in sources :

Example 1 with RpaUID

use of com.emc.fapiclient.ws.RpaUID 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 2 with RpaUID

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

the class RecoverPointUtils method getPreferredRPAForNewCG.

/**
 * Returns the preferred RPA number to use as the primary RPA for a new
 * consistency group. The preferred RPA is determined by examining the
 * current throughput for all of the passed in cluster's RPAs and selecting
 * the RPA that is currently handling the least amount of throughput.
 *
 * @param impl - the established connection to an appliance
 * @param clusterUID - corresponding to the site that we are trying to determine the preferred RPA for.
 * @return RpaUID - object with the preferred RPA number
 * @throws FunctionalAPIActionFailedException_Exception
 * @throws FunctionalAPIInternalError_Exception
 */
public static RpaUID getPreferredRPAForNewCG(FunctionalAPIImpl impl, ClusterUID clusterUID) throws FunctionalAPIActionFailedException_Exception, FunctionalAPIInternalError_Exception {
    RpaUID preferredRPA = new RpaUID();
    // set the cluster UID to the value being passed
    preferredRPA.setClusterUID(clusterUID);
    // default the rpa to 1
    preferredRPA.setRpaNumber(1);
    try {
        SystemStatistics systemStatistics = impl.getSystemStatistics();
        List<RpaStatistics> rpaStatisticsList = systemStatistics.getRpaStatistics();
        Long smallestThroughput = Long.valueOf(0);
        Long currenThroughput = Long.valueOf(0);
        for (RpaStatistics rpaStatistics : rpaStatisticsList) {
            if (rpaStatistics.getRpaUID().getClusterUID().getId() == clusterUID.getId()) {
                currenThroughput = Long.valueOf(0);
                logger.info("Looking at current throughput for RPA " + rpaStatistics.getRpaUID().getRpaNumber() + " on cluster " + rpaStatistics.getRpaUID().getClusterUID().getId());
                TrafficStatistics trafficStatistics = rpaStatistics.getTraffic();
                InOutThroughputStatistics throughput = trafficStatistics.getApplicationThroughputStatistics();
                List<ConnectionOutThroughput> out = throughput.getConnectionsOutThroughputs();
                for (ConnectionOutThroughput a : out) {
                    logger.info("RPA " + rpaStatistics.getRpaUID().getRpaNumber() + " throughput to cluster " + a.getCluster().getId() + ": " + a.getOutThroughput() + " bytes/sec");
                    currenThroughput += a.getOutThroughput();
                }
                if (smallestThroughput.longValue() == 0) {
                    smallestThroughput = currenThroughput;
                }
                logger.info("Total throughput for RPA " + rpaStatistics.getRpaUID().getRpaNumber() + ": " + currenThroughput.toString() + " bytes/sec");
                if (currenThroughput.compareTo(smallestThroughput) <= 0) {
                    smallestThroughput = currenThroughput;
                    preferredRPA.setRpaNumber(rpaStatistics.getRpaUID().getRpaNumber());
                }
            }
        }
    } catch (Exception e) {
        logger.error(e.getMessage());
        logger.info("Encountered error determining the preferred RPA, defaulting to RPA 1");
        preferredRPA.setRpaNumber(1);
        return preferredRPA;
    }
    logger.info("Selected RPA " + preferredRPA.getRpaNumber() + " of cluster " + preferredRPA.getClusterUID().getId() + " for the new consistency group");
    return preferredRPA;
}
Also used : RpaStatistics(com.emc.fapiclient.ws.RpaStatistics) TrafficStatistics(com.emc.fapiclient.ws.TrafficStatistics) SystemStatistics(com.emc.fapiclient.ws.SystemStatistics) ConnectionOutThroughput(com.emc.fapiclient.ws.ConnectionOutThroughput) RpaUID(com.emc.fapiclient.ws.RpaUID) InOutThroughputStatistics(com.emc.fapiclient.ws.InOutThroughputStatistics) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) FunctionalAPIValidationException_Exception(com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException)

Aggregations

RpaUID (com.emc.fapiclient.ws.RpaUID)2 ClusterUID (com.emc.fapiclient.ws.ClusterUID)1 ConnectionOutThroughput (com.emc.fapiclient.ws.ConnectionOutThroughput)1 ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)1 FullConsistencyGroupCopyPolicy (com.emc.fapiclient.ws.FullConsistencyGroupCopyPolicy)1 FullConsistencyGroupPolicy (com.emc.fapiclient.ws.FullConsistencyGroupPolicy)1 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)1 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)1 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)1 InOutThroughputStatistics (com.emc.fapiclient.ws.InOutThroughputStatistics)1 RpaStatistics (com.emc.fapiclient.ws.RpaStatistics)1 SystemStatistics (com.emc.fapiclient.ws.SystemStatistics)1 TrafficStatistics (com.emc.fapiclient.ws.TrafficStatistics)1 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)1 CreateCopyParams (com.emc.storageos.recoverpoint.requests.CreateCopyParams)1