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