Search in sources :

Example 6 with ConsistencyGroupUID

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

Example 7 with ConsistencyGroupUID

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

Example 8 with ConsistencyGroupUID

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;
}
Also used : GetBookmarksResponse(com.emc.storageos.recoverpoint.responses.GetBookmarksResponse) RecoverPointBookmarkManagementUtils(com.emc.storageos.recoverpoint.utils.RecoverPointBookmarkManagementUtils) ConsistencyGroupUID(com.emc.fapiclient.ws.ConsistencyGroupUID) ArrayList(java.util.ArrayList) List(java.util.List) LinkedList(java.util.LinkedList)

Example 9 with ConsistencyGroupUID

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;
}
Also used : HashMap(java.util.HashMap) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) DeviceUID(com.emc.fapiclient.ws.DeviceUID) CreateVolumeParams(com.emc.storageos.recoverpoint.requests.CreateVolumeParams) FunctionalAPIValidationException_Exception(com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID) ClusterUID(com.emc.fapiclient.ws.ClusterUID) Entry(java.util.Map.Entry) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) ConsistencyGroupUID(com.emc.fapiclient.ws.ConsistencyGroupUID) RPSite(com.emc.storageos.recoverpoint.objectmodel.RPSite) CreateCopyParams(com.emc.storageos.recoverpoint.requests.CreateCopyParams) ConsistencyGroupSettings(com.emc.fapiclient.ws.ConsistencyGroupSettings)

Example 10 with ConsistencyGroupUID

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);
    }
}
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)

Aggregations

ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)29 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)21 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)21 ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)14 ConsistencyGroupSettings (com.emc.fapiclient.ws.ConsistencyGroupSettings)8 ConsistencyGroupState (com.emc.fapiclient.ws.ConsistencyGroupState)8 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)8 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)8 RecoverPointImageManagementUtils (com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils)7 ConsistencyGroupCopyState (com.emc.fapiclient.ws.ConsistencyGroupCopyState)6 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 ClusterUID (com.emc.fapiclient.ws.ClusterUID)5 ReplicationSetSettings (com.emc.fapiclient.ws.ReplicationSetSettings)5 ConsistencyGroupSettingsChangesParam (com.emc.fapiclient.ws.ConsistencyGroupSettingsChangesParam)4 StorageAccessState (com.emc.fapiclient.ws.StorageAccessState)4 UserVolumeSettings (com.emc.fapiclient.ws.UserVolumeSettings)4 ConsistencyGroupCopySettings (com.emc.fapiclient.ws.ConsistencyGroupCopySettings)3 ConsistencyGroupLinkSettings (com.emc.fapiclient.ws.ConsistencyGroupLinkSettings)2 FullConsistencyGroupPolicy (com.emc.fapiclient.ws.FullConsistencyGroupPolicy)2