Search in sources :

Example 1 with LinkProtectionPolicy

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

the class RecoverPointClient method updateConsistencyGroupPolicy.

/**
 * Updates the entire consistency group policy. Meaning the link policy for each link
 * will be changed to the same policy.
 *
 * @param policyParam the update policy param
 */
public void updateConsistencyGroupPolicy(UpdateCGPolicyParams policyParam) {
    if (policyParam == null) {
        logger.warn("Unable to update policy for CG. The update paramaters are invalid.");
        return;
    }
    if (policyParam.getPolicyParams() == null) {
        logger.warn("Unable to update policy for CG. The update paramaters are missing.");
        return;
    }
    if (policyParam.getPolicyParams().getCopyMode() == null) {
        logger.warn("Unable to update CG policy copy mode. The copy mode paramaters is missing.");
        return;
    }
    try {
        String copyMode = policyParam.getPolicyParams().getCopyMode();
        ConsistencyGroupUID cgUID = getConsistencyGroupUID(policyParam.getCgName());
        FullConsistencyGroupPolicy cgPolicy = functionalAPI.getFullConsistencyGroupPolicy(cgUID);
        List<FullConsistencyGroupLinkPolicy> linkPolicies = cgPolicy.getLinksPolicies();
        for (FullConsistencyGroupLinkPolicy linkPolicy : linkPolicies) {
            ConsistencyGroupLinkPolicy cgLinkPolicy = linkPolicy.getLinkPolicy();
            LinkProtectionPolicy linkProtectionPolicy = cgLinkPolicy.getProtectionPolicy();
            if (copyMode != null) {
                ProtectionMode protectionMode = ProtectionMode.valueOf(copyMode);
                if (protectionMode != null) {
                    linkProtectionPolicy.setProtectionType(protectionMode);
                    cgLinkPolicy.setProtectionPolicy(linkProtectionPolicy);
                }
            }
        }
        logger.info(String.format("Setting protection mode for CG links to %s, for CG %s", copyMode, policyParam.getCgName()));
        functionalAPI.setFullConsistencyGroupPolicy(cgPolicy);
    } catch (FunctionalAPIActionFailedException_Exception e) {
        throw RecoverPointException.exceptions.failedToUpdateCgLinkPolicy(policyParam.getCgName(), e);
    } catch (FunctionalAPIInternalError_Exception e) {
        throw RecoverPointException.exceptions.failedToUpdateCgLinkPolicy(policyParam.getCgName(), e);
    } catch (Exception e) {
        throw RecoverPointException.exceptions.failedToUpdateCgLinkPolicy(policyParam.getCgName(), e);
    }
}
Also used : FullConsistencyGroupPolicy(com.emc.fapiclient.ws.FullConsistencyGroupPolicy) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) LinkProtectionPolicy(com.emc.fapiclient.ws.LinkProtectionPolicy) ConsistencyGroupUID(com.emc.fapiclient.ws.ConsistencyGroupUID) FullConsistencyGroupLinkPolicy(com.emc.fapiclient.ws.FullConsistencyGroupLinkPolicy) FullConsistencyGroupLinkPolicy(com.emc.fapiclient.ws.FullConsistencyGroupLinkPolicy) ConsistencyGroupLinkPolicy(com.emc.fapiclient.ws.ConsistencyGroupLinkPolicy) FunctionalAPIValidationException_Exception(com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) ProtectionMode(com.emc.fapiclient.ws.ProtectionMode)

Example 2 with LinkProtectionPolicy

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

the class RecoverPointClient method createLinkPolicy.

/**
 * Convenience method for creating a link policy object
 *
 * @param remote whether to set the "protect over wan" to true
 */
private ConsistencyGroupLinkPolicy createLinkPolicy(RecoverPointCGCopyType copyType, String copyMode, String rpoType, Long rpoValue) {
    ConsistencyGroupLinkPolicy linkPolicy = new ConsistencyGroupLinkPolicy();
    linkPolicy.setAdvancedPolicy(new LinkAdvancedPolicy());
    linkPolicy.getAdvancedPolicy().setPerformLongInitialization(true);
    linkPolicy.getAdvancedPolicy().setSnapshotGranularity(SnapshotGranularity.FIXED_PER_SECOND);
    linkPolicy.setProtectionPolicy(new LinkProtectionPolicy());
    linkPolicy.getProtectionPolicy().setBandwidthLimit(0.0);
    linkPolicy.getProtectionPolicy().setCompression(WanCompression.NONE);
    linkPolicy.getProtectionPolicy().setDeduplication(false);
    linkPolicy.getProtectionPolicy().setMeasureLagToTargetRPA(true);
    linkPolicy.getProtectionPolicy().setProtectionType(ProtectionMode.ASYNCHRONOUS);
    linkPolicy.getProtectionPolicy().setReplicatingOverWAN(copyType.isRemote());
    linkPolicy.getProtectionPolicy().setRpoPolicy(new RpoPolicy());
    linkPolicy.getProtectionPolicy().getRpoPolicy().setAllowRegulation(false);
    linkPolicy.getProtectionPolicy().getRpoPolicy().setMaximumAllowedLag(getQuantity(QuantityType.MICROSECONDS, 25000000));
    linkPolicy.getProtectionPolicy().getRpoPolicy().setMinimizationType(RpoMinimizationType.IRRELEVANT);
    linkPolicy.getProtectionPolicy().setSyncReplicationLatencyThresholds(new SyncReplicationThreshold());
    linkPolicy.getProtectionPolicy().getSyncReplicationLatencyThresholds().setResumeSyncReplicationBelow(getQuantity(QuantityType.MICROSECONDS, 3000));
    linkPolicy.getProtectionPolicy().getSyncReplicationLatencyThresholds().setStartAsyncReplicationAbove(getQuantity(QuantityType.MICROSECONDS, 5000));
    linkPolicy.getProtectionPolicy().getSyncReplicationLatencyThresholds().setThresholdEnabled(false);
    linkPolicy.getProtectionPolicy().setSyncReplicationThroughputThresholds(new SyncReplicationThreshold());
    linkPolicy.getProtectionPolicy().getSyncReplicationThroughputThresholds().setResumeSyncReplicationBelow(getQuantity(QuantityType.KB, 35000));
    linkPolicy.getProtectionPolicy().getSyncReplicationThroughputThresholds().setStartAsyncReplicationAbove(getQuantity(QuantityType.KB, 45000));
    linkPolicy.getProtectionPolicy().getSyncReplicationThroughputThresholds().setThresholdEnabled(false);
    linkPolicy.getProtectionPolicy().setWeight(1);
    LinkProtectionPolicy linkProtectionPolicy = linkPolicy.getProtectionPolicy();
    if (copyMode != null) {
        logger.info("Setting CG policy of: " + copyMode);
        ProtectionMode protectionMode = ProtectionMode.valueOf(copyMode);
        if (protectionMode == null) {
            // Default to ASYNCHRONOUS
            protectionMode = ProtectionMode.ASYNCHRONOUS;
        }
        linkProtectionPolicy.setProtectionType(protectionMode);
    }
    RpoPolicy rpoPolicy = linkProtectionPolicy.getRpoPolicy();
    if (rpoValue != null && rpoType != null) {
        logger.info("Setting CG RPO policy of: " + rpoValue.toString() + " " + rpoType);
        Quantity rpoQuantity = new Quantity();
        QuantityType quantityType = QuantityType.valueOf(rpoType);
        rpoQuantity.setType(quantityType);
        rpoQuantity.setValue(rpoValue);
        rpoPolicy.setMaximumAllowedLag(rpoQuantity);
    } else if ((rpoValue == null && rpoType != null) || (rpoValue != null && rpoType == null)) {
        logger.warn("RPO Policy specified only one of value and type, both need to be specified for RPO policy to be applied.  Ignoring RPO policy.");
    }
    linkProtectionPolicy.setRpoPolicy(rpoPolicy);
    linkPolicy.setProtectionPolicy(linkProtectionPolicy);
    return linkPolicy;
}
Also used : SyncReplicationThreshold(com.emc.fapiclient.ws.SyncReplicationThreshold) QuantityType(com.emc.fapiclient.ws.QuantityType) LinkProtectionPolicy(com.emc.fapiclient.ws.LinkProtectionPolicy) RpoPolicy(com.emc.fapiclient.ws.RpoPolicy) Quantity(com.emc.fapiclient.ws.Quantity) LinkAdvancedPolicy(com.emc.fapiclient.ws.LinkAdvancedPolicy) FullConsistencyGroupLinkPolicy(com.emc.fapiclient.ws.FullConsistencyGroupLinkPolicy) ConsistencyGroupLinkPolicy(com.emc.fapiclient.ws.ConsistencyGroupLinkPolicy) ProtectionMode(com.emc.fapiclient.ws.ProtectionMode)

Example 3 with LinkProtectionPolicy

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

the class RecoverPointClient method setLinkPolicy.

/**
 * Convenience method to set the link policy.
 *
 * @param remote whether to set the "protect over wan" to true
 * @param prodCopyUID production copy id
 * @param targetCopyUID target copy id
 * @param cgUID cg id
 * @throws FunctionalAPIActionFailedException_Exception
 * @throws FunctionalAPIInternalError_Exception
 */
private void setLinkPolicy(boolean remote, ConsistencyGroupCopyUID prodCopyUID, ConsistencyGroupCopyUID targetCopyUID, ConsistencyGroupUID cgUID) throws FunctionalAPIActionFailedException_Exception, FunctionalAPIInternalError_Exception {
    ConsistencyGroupLinkUID groupLink = new ConsistencyGroupLinkUID();
    ConsistencyGroupLinkPolicy linkPolicy = new ConsistencyGroupLinkPolicy();
    linkPolicy.setAdvancedPolicy(new LinkAdvancedPolicy());
    linkPolicy.getAdvancedPolicy().setPerformLongInitialization(true);
    linkPolicy.getAdvancedPolicy().setSnapshotGranularity(SnapshotGranularity.FIXED_PER_SECOND);
    linkPolicy.setProtectionPolicy(new LinkProtectionPolicy());
    linkPolicy.getProtectionPolicy().setBandwidthLimit(0.0);
    linkPolicy.getProtectionPolicy().setCompression(WanCompression.NONE);
    linkPolicy.getProtectionPolicy().setDeduplication(false);
    linkPolicy.getProtectionPolicy().setMeasureLagToTargetRPA(true);
    linkPolicy.getProtectionPolicy().setProtectionType(ProtectionMode.ASYNCHRONOUS);
    linkPolicy.getProtectionPolicy().setReplicatingOverWAN(remote);
    linkPolicy.getProtectionPolicy().setRpoPolicy(new RpoPolicy());
    linkPolicy.getProtectionPolicy().getRpoPolicy().setAllowRegulation(false);
    linkPolicy.getProtectionPolicy().getRpoPolicy().setMaximumAllowedLag(getQuantity(QuantityType.MICROSECONDS, 25000000));
    linkPolicy.getProtectionPolicy().getRpoPolicy().setMinimizationType(RpoMinimizationType.IRRELEVANT);
    linkPolicy.getProtectionPolicy().setSyncReplicationLatencyThresholds(new SyncReplicationThreshold());
    linkPolicy.getProtectionPolicy().getSyncReplicationLatencyThresholds().setResumeSyncReplicationBelow(getQuantity(QuantityType.MICROSECONDS, 3000));
    linkPolicy.getProtectionPolicy().getSyncReplicationLatencyThresholds().setStartAsyncReplicationAbove(getQuantity(QuantityType.MICROSECONDS, 5000));
    linkPolicy.getProtectionPolicy().getSyncReplicationLatencyThresholds().setThresholdEnabled(false);
    linkPolicy.getProtectionPolicy().setSyncReplicationThroughputThresholds(new SyncReplicationThreshold());
    linkPolicy.getProtectionPolicy().getSyncReplicationThroughputThresholds().setResumeSyncReplicationBelow(getQuantity(QuantityType.KB, 35000));
    linkPolicy.getProtectionPolicy().getSyncReplicationThroughputThresholds().setStartAsyncReplicationAbove(getQuantity(QuantityType.KB, 45000));
    linkPolicy.getProtectionPolicy().getSyncReplicationThroughputThresholds().setThresholdEnabled(false);
    linkPolicy.getProtectionPolicy().setWeight(1);
    groupLink.setFirstCopy(prodCopyUID.getGlobalCopyUID());
    groupLink.setSecondCopy(targetCopyUID.getGlobalCopyUID());
    groupLink.setGroupUID(cgUID);
    functionalAPI.addConsistencyGroupLink(groupLink, linkPolicy);
    waitForRpOperation();
}
Also used : SyncReplicationThreshold(com.emc.fapiclient.ws.SyncReplicationThreshold) LinkProtectionPolicy(com.emc.fapiclient.ws.LinkProtectionPolicy) RpoPolicy(com.emc.fapiclient.ws.RpoPolicy) LinkAdvancedPolicy(com.emc.fapiclient.ws.LinkAdvancedPolicy) ConsistencyGroupLinkUID(com.emc.fapiclient.ws.ConsistencyGroupLinkUID) FullConsistencyGroupLinkPolicy(com.emc.fapiclient.ws.FullConsistencyGroupLinkPolicy) ConsistencyGroupLinkPolicy(com.emc.fapiclient.ws.ConsistencyGroupLinkPolicy)

Aggregations

ConsistencyGroupLinkPolicy (com.emc.fapiclient.ws.ConsistencyGroupLinkPolicy)3 FullConsistencyGroupLinkPolicy (com.emc.fapiclient.ws.FullConsistencyGroupLinkPolicy)3 LinkProtectionPolicy (com.emc.fapiclient.ws.LinkProtectionPolicy)3 LinkAdvancedPolicy (com.emc.fapiclient.ws.LinkAdvancedPolicy)2 ProtectionMode (com.emc.fapiclient.ws.ProtectionMode)2 RpoPolicy (com.emc.fapiclient.ws.RpoPolicy)2 SyncReplicationThreshold (com.emc.fapiclient.ws.SyncReplicationThreshold)2 ConsistencyGroupLinkUID (com.emc.fapiclient.ws.ConsistencyGroupLinkUID)1 ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)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 Quantity (com.emc.fapiclient.ws.Quantity)1 QuantityType (com.emc.fapiclient.ws.QuantityType)1 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)1