use of com.emc.fapiclient.ws.ConsistencyGroupCopyUID in project coprhd-controller by CoprHD.
the class RecoverPointClient method deleteJournalFromCopy.
/**
* Delete a journal volume (WWN) from the consistency group copy specified by the input volume info.
*
* @param RecoverPointVolumeProtectionInfo copyToModify - Volume info for the CG to add a journal volume to
*
* @param String journalWWNToDelete - WWN of the journal volume to delete
*
* @return void
*
* @throws RecoverPointException
*/
public void deleteJournalFromCopy(RecoverPointVolumeProtectionInfo copyToModify, String journalWWNToDelete) throws RecoverPointException {
ConsistencyGroupCopyUID cgCopyUID = RecoverPointUtils.mapRPVolumeProtectionInfoToCGCopyUID(copyToModify);
String copyName = null;
String cgName = null;
try {
copyName = functionalAPI.getGroupCopyName(cgCopyUID);
cgName = functionalAPI.getGroupName(cgCopyUID.getGroupUID());
logger.info("Request to delete journal " + journalWWNToDelete + " from copy " + copyName + " for consistency group " + cgName);
Set<RPSite> allSites = getAssociatedRPSites();
DeviceUID journalDeviceUIDToDelete = RecoverPointUtils.getDeviceID(allSites, journalWWNToDelete);
if (journalDeviceUIDToDelete == null) {
throw RecoverPointException.exceptions.cannotFindJournal(journalWWNToDelete);
}
functionalAPI.removeJournalVolume(cgCopyUID, journalDeviceUIDToDelete);
} catch (FunctionalAPIActionFailedException_Exception e) {
throw RecoverPointException.exceptions.failedToDeleteJournal(journalWWNToDelete, copyName, cgName, e);
} catch (FunctionalAPIInternalError_Exception e) {
throw RecoverPointException.exceptions.failedToDeleteJournal(journalWWNToDelete, copyName, cgName, e);
}
}
use of com.emc.fapiclient.ws.ConsistencyGroupCopyUID in project coprhd-controller by CoprHD.
the class RecoverPointClient method deleteCopy.
/**
* Delete the consistency group copy specified by the input volume info.
*
* @param RecoverPointVolumeProtectionInfo volumeInfo - Volume info for the CG copy to delete (can't be production)
*
* @return void
*
* @throws RecoverPointException
*/
public void deleteCopy(RecoverPointVolumeProtectionInfo copyToDelete) throws RecoverPointException {
ConsistencyGroupCopyUID cgCopyUID = RecoverPointUtils.mapRPVolumeProtectionInfoToCGCopyUID(copyToDelete);
String copyName = null;
String cgName = null;
try {
copyName = functionalAPI.getGroupCopyName(cgCopyUID);
cgName = functionalAPI.getGroupName(cgCopyUID.getGroupUID());
List<ConsistencyGroupCopyUID> productionCopiesUIDs = functionalAPI.getGroupSettings(cgCopyUID.getGroupUID()).getProductionCopiesUIDs();
for (ConsistencyGroupCopyUID productionCopyUID : productionCopiesUIDs) {
if (RecoverPointUtils.copiesEqual(productionCopyUID, cgCopyUID)) {
// Can't call delete copy using the production CG copy
throw RecoverPointException.exceptions.cantCallDeleteCopyUsingProductionVolume(copyName, cgName);
}
functionalAPI.removeConsistencyGroupCopy(cgCopyUID);
logger.info("Deleted copy " + copyName + " for consistency group " + cgName);
}
} catch (FunctionalAPIActionFailedException_Exception e) {
throw RecoverPointException.exceptions.failedToDeleteCopy(copyName, cgName, e);
} catch (FunctionalAPIInternalError_Exception e) {
throw RecoverPointException.exceptions.failedToDeleteCopy(copyName, cgName, e);
}
}
use of com.emc.fapiclient.ws.ConsistencyGroupCopyUID in project coprhd-controller by CoprHD.
the class RecoverPointClient method createCgCopyUid.
/**
* Fetch ConsistencyGroupCopyUID
*
* @param cgUID the CG
* @param clusterUid
* @param copyType Production, Local or Remote
* @return ConsistencyGroupCopyUID
*/
private ConsistencyGroupCopyUID createCgCopyUid(ConsistencyGroupUID cgUID, ClusterUID clusterUid, RecoverPointCGCopyType copyType) {
ConsistencyGroupCopyUID standBycopyUID = new ConsistencyGroupCopyUID();
GlobalCopyUID globalCopyUID = new GlobalCopyUID();
globalCopyUID.setClusterUID(clusterUid);
globalCopyUID.setCopyUID(copyType.getCopyNumber());
standBycopyUID.setGroupUID(cgUID);
standBycopyUID.setGlobalCopyUID(globalCopyUID);
return standBycopyUID;
}
use of com.emc.fapiclient.ws.ConsistencyGroupCopyUID 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);
}
}
use of com.emc.fapiclient.ws.ConsistencyGroupCopyUID in project coprhd-controller by CoprHD.
the class RecoverPointClient method enableProtection.
/**
* Enable (start) the consistency group protection specified by the input volume info
* Requires a full sweep.
*
* @param RecoverPointVolumeProtectionInfo volumeInfo - Volume info for the CG to enable
*
* @return void
*
* @throws RecoverPointException
*/
public void enableProtection(RecoverPointVolumeProtectionInfo volumeInfo) throws RecoverPointException {
try {
ConsistencyGroupUID cgUID = new ConsistencyGroupUID();
cgUID.setId(volumeInfo.getRpVolumeGroupID());
ConsistencyGroupCopyUID cgCopyUID = null;
cgCopyUID = RecoverPointUtils.mapRPVolumeProtectionInfoToCGCopyUID(volumeInfo);
String cgCopyName = functionalAPI.getGroupCopyName(cgCopyUID);
String cgName = functionalAPI.getGroupName(cgUID);
if (volumeInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.PROTECTED_SOURCE) {
// Enable the whole CG.
logger.info("Enabling consistency group " + cgName);
functionalAPI.enableConsistencyGroup(cgUID, true);
// Make sure the CG is ready
RecoverPointImageManagementUtils imageManager = new RecoverPointImageManagementUtils();
imageManager.waitForCGLinkState(functionalAPI, cgUID, RecoverPointImageManagementUtils.getPipeActiveState(functionalAPI, cgUID));
logger.info("Protection enabled on CG " + cgName);
} else {
// Enable the CG copy associated with the target
logger.info("Enabling CG copy " + cgCopyName + " on CG " + cgName);
functionalAPI.enableConsistencyGroupCopy(cgCopyUID, true);
// Make sure the CG copy is stopped
RecoverPointImageManagementUtils imageManager = new RecoverPointImageManagementUtils();
imageManager.waitForCGCopyLinkState(functionalAPI, cgCopyUID, PipeState.ACTIVE);
logger.info("Protection enabled on CG copy " + cgCopyName + " on CG " + cgName);
}
} catch (FunctionalAPIActionFailedException_Exception e) {
throw RecoverPointException.exceptions.failedToEnableProtection(volumeInfo.getRpVolumeGroupID(), e);
} catch (FunctionalAPIInternalError_Exception e) {
throw RecoverPointException.exceptions.failedToEnableProtection(volumeInfo.getRpVolumeGroupID(), e);
}
}
Aggregations