use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.
the class RecoverPointClientIntegrationTest method recreateCGCDPOnly.
public void recreateCGCDPOnly() throws RecoverPointException {
RecoverPointVolumeProtectionInfo protectionInfo = null;
try {
protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestProdLUN1WWN);
} catch (RecoverPointException e) {
logger.info("Ignore getProtectionInfoForVolume error");
}
if (protectionInfo != null) {
logger.info("Delete previous CG (if it exists)");
rpClient.deleteCG(protectionInfo);
}
logger.info("Create the CG with one replication set");
// CreateCGRequestParams createCGParams = CreateCGParamsHelper(true, false, 2);
CGRequestParams createCGParams = createCGParamsHelper(true, false, 1);
rpClient.createCG(createCGParams, false, false);
}
use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.
the class RecoverPointClientIntegrationTest method testFailover.
// @Test
public void testFailover() {
logger.info("Testing RecoverPoint Failover For Volume");
RecoverPointVolumeProtectionInfo protectionInfo = null;
RecoverPointVolumeProtectionInfo failbackProtectionInfo = null;
boolean foundError = false;
try {
recreateCGAndBookmark();
protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCRRLUN1WWN);
failbackProtectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestProdLUN1WWN);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
}
if (protectionInfo == null) {
foundError = true;
fail("Failed to find protection info for WWN: " + BourneRPTestCRRLUN1WWN);
}
if (failbackProtectionInfo == null) {
foundError = true;
fail("Failed to find protection info for WWN: " + BourneRPTestProdLUN1WWN);
}
if (!foundError) {
// Verify this is a source
if (protectionInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.PROTECTED_TARGET) {
logger.info("RecoverPoint Get Protection Info For Volume PASSED");
logger.info("Protected target volume " + BourneRPTestCRRLUN1WWN + " is on CG Name: " + protectionInfo.getRpProtectionName());
} else {
foundError = true;
fail("Volume " + BourneRPTestCRRLUN1WWN + " did not map to a protected source target");
}
}
RPCopyRequestParams failoverRequest = new RPCopyRequestParams();
RPCopyRequestParams failbackRequest = new RPCopyRequestParams();
failoverRequest.setCopyVolumeInfo(protectionInfo);
failbackRequest.setCopyVolumeInfo(failbackProtectionInfo);
try {
// try {
// logger.info("Delete the CDP copy");
// RecoverPointVolumeProtectionInfo deleteCopyInfo = null;
// deleteCopyInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCDPLUN1WWN);
// rpClient.deleteCopy(deleteCopyInfo);
// } catch (Exception e) {
// logger.info("Ignore error deleting CDP copy");
// }
logger.info("Failover start");
rpClient.failoverCopy(failoverRequest);
logger.info("Sleep 15 seconds before failback");
Thread.sleep(15000);
logger.info("Failback start");
rpClient.failoverCopy(failbackRequest);
} catch (RecoverPointException e) {
foundError = true;
fail(e.getMessage());
} catch (InterruptedException e) {
foundError = true;
fail(e.getMessage());
}
if (!foundError) {
logger.info("TestFailover PASSED");
}
}
use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.
the class RecoverPointClientIntegrationTest method testGetAllCGs.
@Test
public void testGetAllCGs() {
logger.info("Testing RecoverPoint CG Retrieval");
Set<GetCGsResponse> cgs;
try {
cgs = rpClient.getAllCGs();
Set<String> wwns = new HashSet<String>();
for (GetCGsResponse cg : cgs) {
logger.info("CG: " + cg);
assertNotNull(cg.getCgName());
assertNotNull(cg.getCgId());
// Make sure certain fields are filled-in
if (cg.getCopies() != null) {
for (GetCopyResponse copy : cg.getCopies()) {
assertNotNull(copy.getJournals());
assertNotNull(copy.getName());
for (GetVolumeResponse volume : copy.getJournals()) {
assertNotNull(volume.getInternalSiteName());
assertNotNull(volume.getRpCopyName());
assertNotNull(volume.getWwn());
// Make sure the same volume isn't in more than one place in the list.
assertFalse(wwns.contains(volume.getWwn()));
wwns.add(volume.getWwn());
}
}
}
if (cg.getRsets() != null) {
for (GetRSetResponse rset : cg.getRsets()) {
assertNotNull(rset.getName());
assertNotNull(rset.getVolumes());
for (GetVolumeResponse volume : rset.getVolumes()) {
assertNotNull(volume.getInternalSiteName());
assertNotNull(volume.getRpCopyName());
assertNotNull(volume.getWwn());
// Make sure the same volume isn't in more than one place in the list.
assertFalse(wwns.contains(volume.getWwn()));
wwns.add(volume.getWwn());
}
}
}
// Make sure you have journals, sources, and targets
}
} catch (RecoverPointException e) {
fail(e.getMessage());
}
}
use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.
the class RPCommunicationInterface method discover.
@Override
public void discover(AccessProfile accessProfile) throws BaseCollectionException {
URI storageSystemId = null;
ProtectionSystem protectionSystem = null;
boolean discoverySuccess = true;
StringBuffer errMsgBuilder = new StringBuffer();
String detailedStatusMessage = "Unknown Status";
boolean isNewlyCreated = false;
try {
_log.info("Access Profile Details : IpAddress : {}, PortNumber : {}", accessProfile.getIpAddress(), accessProfile.getPortNumber());
storageSystemId = accessProfile.getSystemId();
protectionSystem = _dbClient.queryObject(ProtectionSystem.class, storageSystemId);
if (protectionSystem.getDiscoveryStatus().equals(DiscoveredDataObject.DataCollectionJobStatus.CREATED.toString())) {
isNewlyCreated = true;
}
if (StorageSystem.Discovery_Namespaces.UNMANAGED_CGS.toString().equalsIgnoreCase(accessProfile.getnamespace())) {
try {
unManagedCGDiscoverer.discoverUnManagedObjects(accessProfile, _dbClient, _partitionManager);
} catch (RecoverPointException rpe) {
discoverySuccess = false;
String msg = "Discover RecoverPoint Unmanaged CGs failed. Protection system: " + storageSystemId;
buildErrMsg(errMsgBuilder, rpe, msg);
}
} else {
try {
discoverCluster(protectionSystem);
} catch (RecoverPointException rpe) {
discoverySuccess = false;
String msg = "Discover RecoverPoint cluster failed. Protection system: " + storageSystemId;
buildErrMsg(errMsgBuilder, rpe, msg);
}
// get RP array mappings
try {
if (discoverySuccess) {
discoverRPSiteArrays(protectionSystem);
_dbClient.persistObject(protectionSystem);
}
} catch (Exception rpe) {
discoverySuccess = false;
String msg = "Discover RecoverPoint site/cluster failed. Protection system: " + storageSystemId;
buildErrMsg(errMsgBuilder, rpe, msg);
}
try {
if (discoverySuccess) {
discoverConnectivity(protectionSystem);
}
} catch (Exception rpe) {
discoverySuccess = false;
String msg = "Discover RecoverPoint connectivity failed. Protection system: " + storageSystemId;
buildErrMsg(errMsgBuilder, rpe, msg);
}
// Perform maintenance on the RP bookmarks; some may no longer be valid
try {
if (discoverySuccess) {
RPHelper.cleanupSnapshots(_dbClient, protectionSystem);
}
} catch (Exception rpe) {
discoverySuccess = false;
String msg = "Snapshot maintenance failed. Protection system: " + storageSystemId;
buildErrMsg(errMsgBuilder, rpe, msg);
}
// Rematch storage pools for RP virtual pools
try {
if (discoverySuccess && isNewlyCreated) {
matchVPools(protectionSystem.getId());
}
} catch (Exception rpe) {
discoverySuccess = false;
String msg = "Virtual Pool matching failed. Protection system: " + storageSystemId;
buildErrMsg(errMsgBuilder, rpe, msg);
}
// Discover the Connected-via-RP-itself Storage Systems
try {
if (discoverySuccess) {
discoverVisibleStorageSystems(protectionSystem);
}
} catch (Exception rpe) {
discoverySuccess = false;
String msg = "RP-visible storage system discovery failed. Protection system: " + storageSystemId;
buildErrMsg(errMsgBuilder, rpe, msg);
}
// Discover the Connected-via-NetworkStorage Systems
try {
if (discoverySuccess) {
discoverAssociatedStorageSystems(protectionSystem);
}
} catch (Exception rpe) {
discoverySuccess = false;
String msg = "Storage system discovery failed. Protection system: " + storageSystemId;
buildErrMsg(errMsgBuilder, rpe, msg);
}
// Discover the protection sets
try {
if (discoverySuccess) {
discoverProtectionSets(protectionSystem);
}
} catch (Exception rpe) {
discoverySuccess = false;
String msg = "Discovery of protection sets failed. Protection system: " + storageSystemId;
buildErrMsg(errMsgBuilder, rpe, msg);
}
// Discover the protection system cluster connectivity topology information
try {
if (discoverySuccess) {
discoverTopology(protectionSystem);
}
} catch (Exception rpe) {
discoverySuccess = false;
String msg = "Discovery of topology failed. Protection system: " + storageSystemId;
buildErrMsg(errMsgBuilder, rpe, msg);
}
}
if (!discoverySuccess) {
throw DeviceControllerExceptions.recoverpoint.discoveryFailure(errMsgBuilder.toString());
} else {
detailedStatusMessage = String.format("Discovery completed successfully for Protection System: %s", storageSystemId.toString());
}
} catch (Exception e) {
detailedStatusMessage = String.format("Discovery failed for Protection System %s because %s", storageSystemId.toString(), e.getLocalizedMessage());
_log.error(detailedStatusMessage, e);
throw DeviceControllerExceptions.recoverpoint.discoveryFailure(detailedStatusMessage);
} finally {
releaseResources();
if (null != protectionSystem) {
try {
// set detailed message
protectionSystem.setLastDiscoveryStatusMessage(detailedStatusMessage);
_dbClient.persistObject(protectionSystem);
} catch (DatabaseException ex) {
_log.error("Error while persisting object to DB", ex);
}
}
}
}
use of com.emc.storageos.recoverpoint.exceptions.RecoverPointException in project coprhd-controller by CoprHD.
the class RPDeviceController method createBookmarkStep.
/**
* This method creates a RP bookmark
*
* @param snapshotList
* List of snapshot
* @param system
* Protection Sytem
* @param snapshotName
* snapshot name
* @param volumeWWNs
* WWNs of the volumes whose snap is requested
* @param rpBookmarkOnly
* if true, an RP bookmark is taken or a local array snap is performed.
* @param token
* step Id corresponding to this step.
* @return true if successful, false otherwise.
*/
public boolean createBookmarkStep(List<URI> snapshotList, ProtectionSystem system, String snapshotName, Set<String> volumeWWNs, boolean rpBookmarkOnly, String token) {
RecoverPointClient rp = RPHelper.getRecoverPointClient(system);
CreateBookmarkRequestParams request = new CreateBookmarkRequestParams();
request.setVolumeWWNSet(volumeWWNs);
request.setBookmark(snapshotName);
try {
// Create the bookmark on the RP System
CreateBookmarkResponse response = rp.createBookmarks(request);
if (response == null) {
throw DeviceControllerExceptions.recoverpoint.failedToCreateBookmark();
}
if (snapshotList != null && !snapshotList.isEmpty()) {
// RP Bookmark-only flow.
if (rpBookmarkOnly) {
// This will update the blocksnapshot object based on the return of the EM call
// The construct method will set the task completer on each snapshot
constructSnapshotObjectFromBookmark(response, system, snapshotList, snapshotName, token);
} else {
// image access later on.
for (URI snapshotURI : snapshotList) {
BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, snapshotURI);
snapshot.setEmName(snapshotName);
_dbClient.updateObject(snapshot);
}
}
}
WorkflowStepCompleter.stepSucceded(token);
} catch (RecoverPointException e) {
_log.error("create bookmark step failed with a RecoverPoint exception: ", e);
WorkflowStepCompleter.stepFailed(token, e);
return false;
} catch (Exception e) {
_log.error("create bookmark step failed with an unchecked exception: ", e);
WorkflowStepCompleter.stepFailed(token, DeviceControllerException.errors.jobFailed(e));
return false;
}
return true;
}
Aggregations