Search in sources :

Example 6 with RecoverPointVolumeProtectionInfo

use of com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo in project coprhd-controller by CoprHD.

the class RecoverPointClient method failoverCopyTest.

/**
 * Perform a failover test to the consistency group copy specified by the input request params.
 *
 * @param RPCopyRequestParams copyToFailoverTo - Volume info for the CG to perform a failover test to. Also contains bookmark and APIT
 *            info. If no bookmark or APIT specified, failover test to most recent image.
 *
 * @return void
 *
 * @throws RecoverPointException
 */
public void failoverCopyTest(RPCopyRequestParams copyToFailoverTo) throws RecoverPointException {
    // Check the params
    // If bookmark != null, enable the bookmark on the copy, and failover to that copy
    // If APITTime != null, enable the specified APIT on the copy, and failover to that copy
    // If both are null, enable the most recent imagem, and failover to that copy
    String bookmarkName = copyToFailoverTo.getBookmarkName();
    Date apitTime = copyToFailoverTo.getApitTime();
    if (bookmarkName != null) {
        logger.info("Failver copy to bookmark : " + bookmarkName);
    } else if (apitTime != null) {
        logger.info("Failover copy to APIT : " + apitTime.toString());
    } else {
        logger.info("Failover copy to most recent image");
    }
    RecoverPointImageManagementUtils imageManager = new RecoverPointImageManagementUtils();
    imageManager.enableCopyImage(functionalAPI, copyToFailoverTo, false);
    // RecoverPointUtils.mapRPVolumeProtectionInfoToCGCopyUID(copyToFailoverTo.getCopyVolumeInfo());
    RecoverPointVolumeProtectionInfo failoverCopyInfo = copyToFailoverTo.getCopyVolumeInfo();
    pauseTransfer(failoverCopyInfo);
}
Also used : RecoverPointVolumeProtectionInfo(com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo) Date(java.util.Date) RecoverPointImageManagementUtils(com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils)

Example 7 with RecoverPointVolumeProtectionInfo

use of com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo in project coprhd-controller by CoprHD.

the class RecoverPointClientIntegrationTest method testFailoverTestAndFailoverAndFailback.

// @Test
public void testFailoverTestAndFailoverAndFailback() {
    logger.info("Testing RecoverPoint Failover Cancel 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 target
        if (protectionInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.PROTECTED_TARGET) {
            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 failoverTestRequest = new RPCopyRequestParams();
    RPCopyRequestParams failbackRequest = new RPCopyRequestParams();
    failoverTestRequest.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 test start");
        rpClient.failoverCopyTest(failoverTestRequest);
        logger.info("Sleep 15 seconds before complete of failover");
        Thread.sleep(15000);
        rpClient.failoverCopy(failoverTestRequest);
        logger.info("Sleep 15 seconds before failback");
        Thread.sleep(15000);
        rpClient.failoverCopy(failbackRequest);
    } catch (RecoverPointException e) {
        foundError = true;
        fail(e.getMessage());
    } catch (InterruptedException e) {
        foundError = true;
        fail(e.getMessage());
    }
    if (!foundError) {
        logger.info("TestFailoverTestAndFailoverAndFailback PASSED");
    }
}
Also used : RecoverPointVolumeProtectionInfo(com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) RPCopyRequestParams(com.emc.storageos.recoverpoint.requests.RPCopyRequestParams) URISyntaxException(java.net.URISyntaxException) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException)

Example 8 with RecoverPointVolumeProtectionInfo

use of com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo in project coprhd-controller by CoprHD.

the class RecoverPointClientIntegrationTest method testStopStartPauseResume.

// @Test
public void testStopStartPauseResume() {
    logger.info("Testing RecoverPoint Stop, Start, Pause, Resume");
    RecoverPointVolumeProtectionInfo protectionInfo = null;
    RecoverPointVolumeProtectionInfo crrCopyProtectionInfo = null;
    RecoverPointVolumeProtectionInfo cdpCopyProtectionInfo = null;
    boolean foundError = false;
    try {
        recreateCG();
        protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestProdLUN1WWN);
        crrCopyProtectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCRRLUN1WWN);
        cdpCopyProtectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCDPLUN1WWN);
    } catch (RecoverPointException e) {
        foundError = true;
        fail(e.getMessage());
    }
    if (protectionInfo == null) {
        foundError = true;
        fail("Failed to find protection info for WWN: " + BourneRPTestProdLUN1WWN);
    }
    if (!foundError) {
        logger.info("Testing RecoverPoint Disable/Enable using source");
        try {
            logger.info("Disable CG: " + protectionInfo.getRpProtectionName());
            rpClient.disableProtection(protectionInfo);
            rpClient.getCGState(protectionInfo);
            logger.info("Enable CG: " + protectionInfo.getRpProtectionName());
            rpClient.enableProtection(protectionInfo);
            rpClient.getCGState(protectionInfo);
        } catch (RecoverPointException e) {
            foundError = true;
            fail(e.getMessage());
        }
    }
    if (!foundError) {
        logger.info("Testing RecoverPoint Pause/Resume using source");
        try {
            logger.info("Pause CG: " + protectionInfo.getRpProtectionName());
            rpClient.pauseTransfer(protectionInfo);
            rpClient.getCGState(protectionInfo);
            logger.info("Resume CG: " + protectionInfo.getRpProtectionName());
            rpClient.resumeTransfer(protectionInfo);
            rpClient.getCGState(protectionInfo);
            ;
        } catch (RecoverPointException e) {
            foundError = true;
            fail(e.getMessage());
        }
    }
    if (!foundError) {
        logger.info("Testing RecoverPoint Disable/Enable using CRR");
        try {
            logger.info("Disable CG copy: " + crrCopyProtectionInfo.getRpProtectionName());
            rpClient.disableProtection(crrCopyProtectionInfo);
            rpClient.getCGState(crrCopyProtectionInfo);
            logger.info("Enable CG copy: " + crrCopyProtectionInfo.getRpProtectionName());
            rpClient.enableProtection(crrCopyProtectionInfo);
            rpClient.getCGState(crrCopyProtectionInfo);
        } catch (RecoverPointException e) {
            foundError = true;
            fail(e.getMessage());
        }
    }
    if (!foundError) {
        logger.info("Testing RecoverPoint Pause/Resume using CRR");
        try {
            logger.info("Pause CG copy: " + crrCopyProtectionInfo.getRpProtectionName());
            rpClient.pauseTransfer(crrCopyProtectionInfo);
            rpClient.getCGState(crrCopyProtectionInfo);
            logger.info("Resume CG copy: " + crrCopyProtectionInfo.getRpProtectionName());
            rpClient.resumeTransfer(crrCopyProtectionInfo);
            rpClient.getCGState(crrCopyProtectionInfo);
        } catch (RecoverPointException e) {
            foundError = true;
            fail(e.getMessage());
        }
    }
    if (!foundError) {
        logger.info("Testing RecoverPoint Disable/Enable using CDP");
        try {
            logger.info("Disable CG copy: " + cdpCopyProtectionInfo.getRpProtectionName());
            rpClient.disableProtection(cdpCopyProtectionInfo);
            rpClient.getCGState(cdpCopyProtectionInfo);
            logger.info("Enable CG copy: " + cdpCopyProtectionInfo.getRpProtectionName());
            rpClient.enableProtection(cdpCopyProtectionInfo);
            rpClient.getCGState(cdpCopyProtectionInfo);
        } catch (RecoverPointException e) {
            foundError = true;
            fail(e.getMessage());
        }
    }
    if (!foundError) {
        logger.info("Testing RecoverPoint Pause/Resume using CDP");
        try {
            logger.info("Pause CG copy: " + cdpCopyProtectionInfo.getRpProtectionName());
            rpClient.pauseTransfer(cdpCopyProtectionInfo);
            rpClient.getCGState(cdpCopyProtectionInfo);
            logger.info("Resume CG copy: " + cdpCopyProtectionInfo.getRpProtectionName());
            rpClient.resumeTransfer(cdpCopyProtectionInfo);
            rpClient.getCGState(cdpCopyProtectionInfo);
        } catch (RecoverPointException e) {
            foundError = true;
            fail(e.getMessage());
        }
    }
}
Also used : RecoverPointVolumeProtectionInfo(com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException)

Example 9 with RecoverPointVolumeProtectionInfo

use of com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo in project coprhd-controller by CoprHD.

the class RecoverPointClientIntegrationTest method testGetProtectionInfoForVolume.

// @Test
public void testGetProtectionInfoForVolume() {
    logger.info("Testing RecoverPoint Get Protection Info For Volume");
    RecoverPointVolumeProtectionInfo protectionInfo = null;
    boolean foundError = false;
    try {
        recreateCG();
        protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestProdLUN1WWN);
    } catch (RecoverPointException e) {
        foundError = true;
        fail(e.getMessage());
    }
    if (protectionInfo == 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_SOURCE) {
            logger.info("RecoverPoint Get Protection Info For Volume PASSED");
            logger.info("Protected source volume " + BourneRPTestProdLUN1WWN + " is on CG Name: " + protectionInfo.getRpProtectionName());
        } else {
            foundError = true;
            fail("Volume " + BourneRPTestProdLUN1WWN + " did not map to a protected source volume");
        }
    }
    protectionInfo = null;
    try {
        protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCRRLUN1WWN);
    } catch (RecoverPointException e) {
        foundError = true;
        fail(e.getMessage());
    }
    if (protectionInfo == null) {
        foundError = true;
        fail("Failed to find protection info for WWN: " + BourneRPTestCRRLUN1WWN);
    }
    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");
        }
    }
    try {
        protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestJrnlLUN1WWN);
    } catch (RecoverPointException e) {
        foundError = true;
        fail(e.getMessage());
    }
    if (protectionInfo == null) {
        foundError = true;
        fail("Failed to find protection info for WWN: " + BourneRPTestJrnlLUN1WWN);
    }
    if (!foundError) {
        // Verify this is a source
        if (protectionInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.SOURCE_JOURNAL) {
            logger.info("RecoverPoint Get Protection Info For Volume PASSED");
            logger.info("Source journal volume " + BourneRPTestJrnlLUN1WWN + " is on CG Name: " + protectionInfo.getRpProtectionName());
        } else {
            foundError = true;
            fail("Volume " + BourneRPTestJrnlLUN1WWN + " did not map to a source journal volume");
        }
    }
    protectionInfo = null;
    try {
        protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestJrnlLUN5WWN);
    } catch (RecoverPointException e) {
        foundError = true;
        fail(e.getMessage());
    }
    if (protectionInfo == null) {
        foundError = true;
        fail("Failed to find protection info for WWN: " + BourneRPTestJrnlLUN5WWN);
    }
    if (!foundError) {
        // Verify this is a source
        if (protectionInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.TARGET_JOURNAL) {
            logger.info("RecoverPoint Get Protection Info For Volume PASSED");
            logger.info("Target journal volume " + BourneRPTestJrnlLUN5WWN + " is on CG Name: " + protectionInfo.getRpProtectionName());
        } else {
            foundError = true;
            fail("Volume " + BourneRPTestJrnlLUN5WWN + " did not map to a protected source target");
        }
    }
    logger.info("TestGetProtectionInfoForVolumeAndEnableAndDisable PASSED");
}
Also used : RecoverPointVolumeProtectionInfo(com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException)

Example 10 with RecoverPointVolumeProtectionInfo

use of com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo in project coprhd-controller by CoprHD.

the class RecoverPointClientIntegrationTest method testFailoverTestAndTestCancel.

// @Test
public void testFailoverTestAndTestCancel() {
    logger.info("Testing RecoverPoint Failover Cancel For Volume");
    RecoverPointVolumeProtectionInfo protectionInfo = null;
    boolean foundError = false;
    try {
        recreateCGAndBookmark();
        protectionInfo = rpClient.getProtectionInfoForVolume(BourneRPTestCRRLUN1WWN);
    } catch (RecoverPointException e) {
        foundError = true;
        fail(e.getMessage());
    }
    if (protectionInfo == null) {
        foundError = true;
        fail("Failed to find protection info for WWN: " + BourneRPTestCRRLUN1WWN);
    }
    if (!foundError) {
        // Verify this is a source
        if (protectionInfo.getRpVolumeCurrentProtectionStatus() == RecoverPointVolumeProtectionInfo.volumeProtectionStatus.PROTECTED_TARGET) {
            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 failoverTestRequest = new RPCopyRequestParams();
    failoverTestRequest.setCopyVolumeInfo(protectionInfo);
    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 test start");
        rpClient.failoverCopyTest(failoverTestRequest);
        logger.info("Sleep 15 seconds before cancel of failover test");
        Thread.sleep(15000);
        logger.info("Failover test cancel start");
        rpClient.failoverCopyTestCancel(failoverTestRequest);
    } catch (RecoverPointException e) {
        foundError = true;
        fail(e.getMessage());
    } catch (InterruptedException e) {
        foundError = true;
        fail(e.getMessage());
    }
    if (!foundError) {
        logger.info("TestFailoverTestAndTestCancel PASSED");
    }
}
Also used : RecoverPointVolumeProtectionInfo(com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) RPCopyRequestParams(com.emc.storageos.recoverpoint.requests.RPCopyRequestParams) URISyntaxException(java.net.URISyntaxException) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException)

Aggregations

RecoverPointVolumeProtectionInfo (com.emc.storageos.recoverpoint.responses.RecoverPointVolumeProtectionInfo)22 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)15 Volume (com.emc.storageos.db.client.model.Volume)7 RecoverPointClient (com.emc.storageos.recoverpoint.impl.RecoverPointClient)7 ArrayList (java.util.ArrayList)7 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)5 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)5 RPCopyRequestParams (com.emc.storageos.recoverpoint.requests.RPCopyRequestParams)5 URISyntaxException (java.net.URISyntaxException)5 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)3 NamedURI (com.emc.storageos.db.client.model.NamedURI)3 ProtectionSet (com.emc.storageos.db.client.model.ProtectionSet)3 ProtectionSystem (com.emc.storageos.db.client.model.ProtectionSystem)3 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)3 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)3 LockRetryException (com.emc.storageos.locking.LockRetryException)3 RecoverPointImageManagementUtils (com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils)3 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)3 URI (java.net.URI)3 ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)2