Search in sources :

Example 11 with ConsistencyGroupCopyUID

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);
    }
}
Also used : FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) DeviceUID(com.emc.fapiclient.ws.DeviceUID) RPSite(com.emc.storageos.recoverpoint.objectmodel.RPSite) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID)

Example 12 with ConsistencyGroupCopyUID

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);
    }
}
Also used : FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID)

Example 13 with ConsistencyGroupCopyUID

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;
}
Also used : GlobalCopyUID(com.emc.fapiclient.ws.GlobalCopyUID) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID)

Example 14 with ConsistencyGroupCopyUID

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);
    }
}
Also used : FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) ConsistencyGroupUID(com.emc.fapiclient.ws.ConsistencyGroupUID) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID)

Example 15 with ConsistencyGroupCopyUID

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);
    }
}
Also used : FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) ConsistencyGroupUID(com.emc.fapiclient.ws.ConsistencyGroupUID) RecoverPointImageManagementUtils(com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID)

Aggregations

ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)34 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)24 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)24 ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)14 ConsistencyGroupSettings (com.emc.fapiclient.ws.ConsistencyGroupSettings)9 RecoverPointImageManagementUtils (com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils)9 ClusterUID (com.emc.fapiclient.ws.ClusterUID)8 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)6 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)6 HashMap (java.util.HashMap)6 ConsistencyGroupCopySettings (com.emc.fapiclient.ws.ConsistencyGroupCopySettings)5 GlobalCopyUID (com.emc.fapiclient.ws.GlobalCopyUID)5 ConsistencyGroupState (com.emc.fapiclient.ws.ConsistencyGroupState)4 RPSite (com.emc.storageos.recoverpoint.objectmodel.RPSite)4 CreateCopyParams (com.emc.storageos.recoverpoint.requests.CreateCopyParams)4 HashSet (java.util.HashSet)4 ConsistencyGroupCopyState (com.emc.fapiclient.ws.ConsistencyGroupCopyState)3 ConsistencyGroupLinkSettings (com.emc.fapiclient.ws.ConsistencyGroupLinkSettings)3 ConsistencyGroupSettingsChangesParam (com.emc.fapiclient.ws.ConsistencyGroupSettingsChangesParam)3 ReplicationSetSettings (com.emc.fapiclient.ws.ReplicationSetSettings)3