use of com.emc.fapiclient.ws.ConsistencyGroupUID in project coprhd-controller by CoprHD.
the class RecoverPointClient method doesStandbyProdCopyExist.
/**
* Determines if the consistency group associated with the volume protection info contains
* a standby production copy.
*
* @param volume the volume protection information
* @return true if the standby production copy exists, false otherwise
*/
public boolean doesStandbyProdCopyExist(RecoverPointVolumeProtectionInfo volume) {
try {
ConsistencyGroupUID cgID = new ConsistencyGroupUID();
cgID.setId(volume.getRpVolumeGroupID());
ConsistencyGroupState state = functionalAPI.getGroupState(cgID);
ConsistencyGroupSettings cgSettings = functionalAPI.getGroupSettings(cgID);
ConsistencyGroupCopyUID standbyProdCopy = RecoverPointUtils.getStandbyProductionCopy(cgSettings, state);
if (standbyProdCopy != null) {
String standbyProdCopyName = functionalAPI.getGroupCopyName(standbyProdCopy);
logger.info(String.format("Determined that standby production copy %s exists in CG %s.", standbyProdCopyName, volume.getRpProtectionName()));
return true;
}
logger.info(String.format("Determined that no standby production copy exists in CG %s.", volume.getRpProtectionName()));
return false;
} catch (FunctionalAPIActionFailedException_Exception e) {
throw RecoverPointException.exceptions.failedStandbyProdCopyLookup(volume.getRpProtectionName(), e);
} catch (FunctionalAPIInternalError_Exception e) {
throw RecoverPointException.exceptions.failedStandbyProdCopyLookup(volume.getRpProtectionName(), e);
}
}
use of com.emc.fapiclient.ws.ConsistencyGroupUID in project coprhd-controller by CoprHD.
the class RecoverPointClient method getCGState.
/**
* Return the state of a consistency group.
*
* @param RecoverPointVolumeProtectionInfo volumeInfo - Volume info for the CG to get CG state for
*
* @return the state of the CG
*
* @throws RecoverPointException
*/
public RecoverPointCGState getCGState(RecoverPointVolumeProtectionInfo volumeInfo) throws RecoverPointException {
ConsistencyGroupUID cgUID = new ConsistencyGroupUID();
cgUID.setId(volumeInfo.getRpVolumeGroupID());
return getCGState(cgUID);
}
use of com.emc.fapiclient.ws.ConsistencyGroupUID in project coprhd-controller by CoprHD.
the class RecoverPointClient method getRPBookmarks.
/**
* Get all RP bookmarks for all CGs specified
*
* @param request - set of CG integer IDs
* @return GetBookmarkResponse - a map of CGs to bookmarks for that CG
* @throws RecoverPointException
*/
public GetBookmarksResponse getRPBookmarks(Set<Integer> request) throws RecoverPointException {
String mgmtIPAddress = _endpoint.toASCIIString();
if (null == mgmtIPAddress) {
throw RecoverPointException.exceptions.noRecoverPointEndpoint();
}
RecoverPointBookmarkManagementUtils bookmarkManager = new RecoverPointBookmarkManagementUtils();
GetBookmarksResponse response = new GetBookmarksResponse();
response.setCgBookmarkMap(new HashMap<Integer, List<RPBookmark>>());
for (Integer cgID : request) {
ConsistencyGroupUID cgUID = new ConsistencyGroupUID();
cgUID.setId(cgID);
response.getCgBookmarkMap().put(cgID, bookmarkManager.getRPBookmarksForCG(functionalAPI, cgUID));
}
response.setReturnCode(RecoverPointReturnCode.SUCCESS);
return response;
}
use of com.emc.fapiclient.ws.ConsistencyGroupUID in project coprhd-controller by CoprHD.
the class RecoverPointClient method addJournalVolumesToCG.
/**
* Operation to add journal volumes to an existing recoverpoint consistency group
*
* @param request - contains both the consistency group
* and the journals to add to the consistency group
* @param copyType - indicates whether the copy is production, local or remote
* @return boolean indicating the result of the operation
*/
public boolean addJournalVolumesToCG(CGRequestParams request, int copyType) {
// Make sure the CG name is unique.
ConsistencyGroupUID cgUID = null;
List<ConsistencyGroupUID> allCgs;
String copyName = "not determined";
Map<ConsistencyGroupCopyUID, DeviceUID> addedJournalVolumes = new HashMap<ConsistencyGroupCopyUID, DeviceUID>();
try {
allCgs = functionalAPI.getAllConsistencyGroups();
for (ConsistencyGroupUID cg : allCgs) {
ConsistencyGroupSettings settings = functionalAPI.getGroupSettings(cg);
if (settings.getName().toString().equalsIgnoreCase(request.getCgName())) {
cgUID = settings.getGroupUID();
break;
}
}
if (cgUID == null) {
// The CG does not exist so we cannot add replication sets
throw RecoverPointException.exceptions.failedToAddReplicationSetCgDoesNotExist(request.getCgName());
}
List<CreateCopyParams> copyParams = request.getCopies();
// determine if the volumes are visible to the recoverpoint appliance
Set<RPSite> allSites = scan(copyParams, null);
for (CreateCopyParams copyParam : copyParams) {
for (CreateVolumeParams journalVolume : copyParam.getJournals()) {
copyName = journalVolume.getRpCopyName();
ClusterUID clusterId = RecoverPointUtils.getRPSiteID(functionalAPI, journalVolume.getInternalSiteName());
ConsistencyGroupCopyUID copyUID = getCGCopyUid(clusterId, getCopyType(copyType), cgUID);
DeviceUID journalDevice = RecoverPointUtils.getDeviceID(allSites, journalVolume.getInternalSiteName(), journalVolume.getWwn());
addedJournalVolumes.put(copyUID, journalDevice);
functionalAPI.addJournalVolume(copyUID, journalDevice);
}
}
} catch (FunctionalAPIActionFailedException_Exception e) {
if (!addedJournalVolumes.isEmpty()) {
try {
for (Map.Entry<ConsistencyGroupCopyUID, DeviceUID> journalVolume : addedJournalVolumes.entrySet()) {
functionalAPI.removeJournalVolume(journalVolume.getKey(), journalVolume.getValue());
}
} catch (Exception e1) {
logger.error("Error removing journal volume from consistency group");
logger.error(e1.getMessage(), e1);
}
}
logger.error("Error in attempting to add a journal volume to the recoverpoint consistency group");
logger.error(e.getMessage(), e);
throw RecoverPointException.exceptions.failedToAddJournalVolumeToConsistencyGroup(copyName, getCause(e));
} catch (FunctionalAPIInternalError_Exception e) {
if (!addedJournalVolumes.isEmpty()) {
try {
for (Map.Entry<ConsistencyGroupCopyUID, DeviceUID> journalVolume : addedJournalVolumes.entrySet()) {
functionalAPI.removeJournalVolume(journalVolume.getKey(), journalVolume.getValue());
}
} catch (Exception e1) {
logger.error("Error removing journal volume from consistency group");
logger.error(e1.getMessage(), e1);
}
}
logger.error("Error in attempting to add a journal volume to the recoverpoint consistency group");
logger.error(e.getMessage(), e);
throw RecoverPointException.exceptions.failedToCreateConsistencyGroup(copyName, getCause(e));
}
return true;
}
use of com.emc.fapiclient.ws.ConsistencyGroupUID in project coprhd-controller by CoprHD.
the class RecoverPointClient method resumeTransfer.
/**
* Resume the consistency group protection specified by the input volume info.
*
* @param RecoverPointVolumeProtectionInfo volumeInfo - Volume info for the CG to resume
*
* @return void
*
* @throws RecoverPointException
*/
public void resumeTransfer(RecoverPointVolumeProtectionInfo volumeInfo) throws RecoverPointException {
try {
ConsistencyGroupUID cgUID = new ConsistencyGroupUID();
cgUID.setId(volumeInfo.getRpVolumeGroupID());
if (volumeInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.PROTECTED_SOURCE) {
// Resume the whole CG
String cgName = functionalAPI.getGroupName(cgUID);
logger.info("Protection resumed on CG " + cgName);
functionalAPI.startGroupTransfer(cgUID);
} else {
// Resume the CG copy associated with the target
ConsistencyGroupCopyUID cgCopyUID = RecoverPointUtils.mapRPVolumeProtectionInfoToCGCopyUID(volumeInfo);
functionalAPI.startGroupCopyTransfer(cgCopyUID);
String cgCopyName = functionalAPI.getGroupCopyName(cgCopyUID);
String cgName = functionalAPI.getGroupName(cgCopyUID.getGroupUID());
logger.info("Protection resumed on CG copy " + cgCopyName + " on CG " + cgName);
}
} catch (FunctionalAPIActionFailedException_Exception e) {
throw RecoverPointException.exceptions.failedToResumeProtection(volumeInfo.getRpVolumeGroupID(), e);
} catch (FunctionalAPIInternalError_Exception e) {
throw RecoverPointException.exceptions.failedToResumeProtection(volumeInfo.getRpVolumeGroupID(), e);
}
}
Aggregations