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;
}
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;
}
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;
}
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;
}
Aggregations