Search in sources :

Example 6 with GlobalCopyUID

use of com.emc.fapiclient.ws.GlobalCopyUID 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 copies are equals, false otherwise.
 */
public static boolean copiesEqual(ConsistencyGroupCopyUID firstCopy, ConsistencyGroupCopyUID secondCopy) {
    if (firstCopy != null && secondCopy != null) {
        GlobalCopyUID firstCopyGlobalCopyUID = firstCopy.getGlobalCopyUID();
        GlobalCopyUID secondCopyGlobalCopyUID = secondCopy.getGlobalCopyUID();
        return copiesEqual(firstCopyGlobalCopyUID, secondCopyGlobalCopyUID);
    }
    return false;
}
Also used : GlobalCopyUID(com.emc.fapiclient.ws.GlobalCopyUID)

Example 7 with GlobalCopyUID

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

the class RecoverPointClient method getStandbyCopyLinkSettings.

/**
 * in a Metropoint environment, fetches link(s) between the primary copy(s) and the remote/DR copy
 *
 * @param activeProdCopy the CG copy uid of the active production copy
 * @param standbyProdCopy the CG copy uid of the standby production copy
 * @throws FunctionalAPIInternalError_Exception
 * @throws FunctionalAPIActionFailedException_Exception
 * @throws FunctionalAPIValidationException_Exception
 * @throws RecoverPointException
 */
private List<ConsistencyGroupLinkSettings> getStandbyCopyLinkSettings(ConsistencyGroupCopyUID activeProdCopy, ConsistencyGroupCopyUID standbyProdCopy) throws FunctionalAPIActionFailedException_Exception, FunctionalAPIInternalError_Exception, FunctionalAPIValidationException_Exception {
    logger.info("Preparing link settings between standby production copy and remote copy after Metropoint swap production copies.");
    ConsistencyGroupLinkSettings standByCopyLinkSettings = new ConsistencyGroupLinkSettings();
    List<ConsistencyGroupLinkSettings> cgLinkSettings = new ArrayList<ConsistencyGroupLinkSettings>();
    String activeCgCopyName = functionalAPI.getGroupCopyName(activeProdCopy);
    String standbyCgCopyName = functionalAPI.getGroupCopyName(standbyProdCopy);
    String cgName = functionalAPI.getGroupName(activeProdCopy.getGroupUID());
    ConsistencyGroupSettings groupSettings = functionalAPI.getGroupSettings(activeProdCopy.getGroupUID());
    // find the remote copy; with metropoint, you're only allowed one remote copy
    // so it must be the one with cluster id not equal to the active or standby cluster ids
    ClusterUID activeClusterId = activeProdCopy.getGlobalCopyUID().getClusterUID();
    ClusterUID standbyClusterId = standbyProdCopy.getGlobalCopyUID().getClusterUID();
    for (ConsistencyGroupCopySettings copySetting : groupSettings.getGroupCopiesSettings()) {
        // see if this is the remote copy; that is it's not the active and not the standby
        ClusterUID copyClusterId = copySetting.getCopyUID().getGlobalCopyUID().getClusterUID();
        if (copyClusterId.getId() != activeClusterId.getId() && copyClusterId.getId() != standbyClusterId.getId()) {
            String targetCopyName = functionalAPI.getGroupCopyName(copySetting.getCopyUID());
            // get the link settings for the active production copy and remote copy
            ConsistencyGroupLinkSettings linkSettings = findLinkSettings(groupSettings.getActiveLinksSettings(), activeProdCopy.getGlobalCopyUID(), copySetting.getCopyUID().getGlobalCopyUID(), activeCgCopyName, targetCopyName);
            if (linkSettings != null) {
                logger.info(String.format("Generate new link settings between %s and %s based on existing link settings between the current production copy %s and %s.", standbyCgCopyName, targetCopyName, activeCgCopyName, targetCopyName));
                cgLinkSettings.add(linkSettings);
                ConsistencyGroupLinkUID cgLinkUID = linkSettings.getGroupLinkUID();
                // Set the link copies appropriately
                GlobalCopyUID standbyCopyUid = standbyProdCopy.getGlobalCopyUID();
                GlobalCopyUID remoteTargetCopyUid = copySetting.getCopyUID().getGlobalCopyUID();
                cgLinkUID.setFirstCopy(standbyCopyUid);
                cgLinkUID.setSecondCopy(remoteTargetCopyUid);
                ConsistencyGroupLinkPolicy linkPolicy = linkSettings.getLinkPolicy();
                // Build the link between the standby production copy and the remote copy
                // this has to be a remote copy
                logger.info(String.format("Build new remote copy link settings between %s and %s, for consistency group %s.", standbyCgCopyName, targetCopyName, cgName));
                linkPolicy.getProtectionPolicy().setReplicatingOverWAN(true);
                standByCopyLinkSettings.setGroupLinkUID(cgLinkUID);
                standByCopyLinkSettings.setLinkPolicy(linkPolicy);
                standByCopyLinkSettings.setLocalLink(false);
                standByCopyLinkSettings.setTransferEnabled(true);
                cgLinkSettings.add(standByCopyLinkSettings);
                break;
            }
        }
    }
    return cgLinkSettings;
}
Also used : ClusterUID(com.emc.fapiclient.ws.ClusterUID) GlobalCopyUID(com.emc.fapiclient.ws.GlobalCopyUID) ConsistencyGroupLinkSettings(com.emc.fapiclient.ws.ConsistencyGroupLinkSettings) ArrayList(java.util.ArrayList) ConsistencyGroupSettings(com.emc.fapiclient.ws.ConsistencyGroupSettings) ConsistencyGroupLinkUID(com.emc.fapiclient.ws.ConsistencyGroupLinkUID) FullConsistencyGroupLinkPolicy(com.emc.fapiclient.ws.FullConsistencyGroupLinkPolicy) ConsistencyGroupLinkPolicy(com.emc.fapiclient.ws.ConsistencyGroupLinkPolicy) ConsistencyGroupCopySettings(com.emc.fapiclient.ws.ConsistencyGroupCopySettings)

Example 8 with GlobalCopyUID

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

the class RecoverPointClient method getCGCopyUid.

/**
 * construct a CG copy UID
 *
 * @param clusterUID
 * @param copyType
 * @param cgUID
 * @return
 */
private ConsistencyGroupCopyUID getCGCopyUid(ClusterUID clusterUID, RecoverPointCGCopyType copyType, ConsistencyGroupUID cgUID) {
    ConsistencyGroupCopyUID cgCopyUID = new ConsistencyGroupCopyUID();
    GlobalCopyUID globalCopyUID = new GlobalCopyUID();
    globalCopyUID.setClusterUID(clusterUID);
    globalCopyUID.setCopyUID(copyType.getCopyNumber());
    cgCopyUID.setGlobalCopyUID(globalCopyUID);
    cgCopyUID.setGroupUID(cgUID);
    return cgCopyUID;
}
Also used : GlobalCopyUID(com.emc.fapiclient.ws.GlobalCopyUID) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID)

Example 9 with GlobalCopyUID

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

the class RecoverPointClient method isMatchingLinkSettings.

/**
 * Convenience method used to determine if the provided production copy and target copy
 * are points on the given link settings.
 *
 * @param linkSetting the link settings to examine.
 * @param prodCopyUID the production copy end of the link settings.
 * @param targetCopyUID the target copy end of the link settings.
 * @return
 */
private boolean isMatchingLinkSettings(ConsistencyGroupLinkSettings linkSettings, GlobalCopyUID prodCopyUID, GlobalCopyUID targetCopyUID) {
    GlobalCopyUID firstCopy = null;
    GlobalCopyUID secondCopy = null;
    if (linkSettings.getGroupLinkUID() != null) {
        firstCopy = linkSettings.getGroupLinkUID().getFirstCopy();
        secondCopy = linkSettings.getGroupLinkUID().getSecondCopy();
        // end of the link they belong.
        if ((RecoverPointUtils.copiesEqual(firstCopy, prodCopyUID) && RecoverPointUtils.copiesEqual(secondCopy, targetCopyUID)) || (RecoverPointUtils.copiesEqual(firstCopy, targetCopyUID) && RecoverPointUtils.copiesEqual(secondCopy, prodCopyUID))) {
            return true;
        }
    }
    return false;
}
Also used : GlobalCopyUID(com.emc.fapiclient.ws.GlobalCopyUID)

Aggregations

GlobalCopyUID (com.emc.fapiclient.ws.GlobalCopyUID)9 ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)5 ClusterUID (com.emc.fapiclient.ws.ClusterUID)4 ConsistencyGroupCopySettings (com.emc.fapiclient.ws.ConsistencyGroupCopySettings)4 ConsistencyGroupSettings (com.emc.fapiclient.ws.ConsistencyGroupSettings)4 ConsistencyGroupLinkPolicy (com.emc.fapiclient.ws.ConsistencyGroupLinkPolicy)3 ConsistencyGroupLinkSettings (com.emc.fapiclient.ws.ConsistencyGroupLinkSettings)3 ConsistencyGroupLinkUID (com.emc.fapiclient.ws.ConsistencyGroupLinkUID)3 FullConsistencyGroupLinkPolicy (com.emc.fapiclient.ws.FullConsistencyGroupLinkPolicy)3 ArrayList (java.util.ArrayList)3 ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)2 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)2 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)2 ConsistencyGroupSettingsChangesParam (com.emc.fapiclient.ws.ConsistencyGroupSettingsChangesParam)1 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)1 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)1 RecoverPointCGResponse (com.emc.storageos.recoverpoint.responses.RecoverPointCGResponse)1 RecoverPointImageManagementUtils (com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils)1 HashMap (java.util.HashMap)1