Search in sources :

Example 11 with FunctionalAPIActionFailedException_Exception

use of com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception 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 12 with FunctionalAPIActionFailedException_Exception

use of com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception 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)

Example 13 with FunctionalAPIActionFailedException_Exception

use of com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception in project coprhd-controller by CoprHD.

the class RecoverPointBookmarkManagementUtils method mapCGsForWWNs.

/**
 * Take a list of WWNs for a RecoverPoint appliance and return consistency group information for the WWNs
 *
 * @param impl - RP handle to perform RP operations
 * @param request - Input request of WWNs
 * @param unmappedWWNs - WWNs that could not be mapped to a consistency group
 *
 * @return WWN to consistency group mappings
 *
 * @throws RecoverPointException
 */
public Map<String, RPConsistencyGroup> mapCGsForWWNs(FunctionalAPIImpl impl, CreateBookmarkRequestParams request, Set<String> unmappedWWNs) throws RecoverPointException {
    try {
        Set<String> wwnList = request.getVolumeWWNSet();
        if (wwnList.isEmpty()) {
            logger.error("Input WWN list size is 0");
            return null;
        }
        Map<String, RPConsistencyGroup> returnMap = new HashMap<String, RPConsistencyGroup>();
        Set<String> wwnListCopy = new HashSet<String>();
        for (String wwn : wwnList) {
            wwnListCopy.add(wwn.toLowerCase(Locale.ENGLISH));
            logger.info("Mapping source WWN " + wwn.toLowerCase(Locale.ENGLISH) + " to RecoverPoint CG");
        }
        List<ConsistencyGroupSettings> cgSettings = impl.getAllGroupsSettings();
        RPConsistencyGroup rpCG = null;
        for (ConsistencyGroupSettings cgSetting : cgSettings) {
            for (ReplicationSetSettings rsSetting : cgSetting.getReplicationSetsSettings()) {
                // Only get the unique volumes from a replication set. In MetroPoint, a replication set will list the source volume
                // twice. This is because in MetroPoint each VPLEX leg is considered a copy but the WWN/volume is the same.
                Set<UserVolumeSettings> uvSettings = new HashSet<UserVolumeSettings>();
                uvSettings.addAll(rsSetting.getVolumes());
                for (UserVolumeSettings uvSetting : uvSettings) {
                    String volUID = RecoverPointUtils.getGuidBufferAsString(uvSetting.getVolumeInfo().getRawUids(), false);
                    if (wwnListCopy.contains(volUID.toLowerCase(Locale.ENGLISH))) {
                        // Remove the volUID from the list
                        wwnListCopy.remove(volUID.toLowerCase(Locale.ENGLISH));
                        // We are getting the index of the first production copy because we only need to
                        // get the cluster ID of the source. All source copies in a CG, across different Rsets, are on the same cluster.
                        // Hence we are ok fetching the first one and getting its cluster id and using it.
                        ConsistencyGroupCopyUID productionCopyUID = cgSetting.getProductionCopiesUIDs().get(0);
                        // Get the RecoverPoint CG name and ID
                        String cgName = cgSetting.getName();
                        ConsistencyGroupUID cgUID = cgSetting.getGroupUID();
                        // Get the Copy information
                        RPCopy rpCopy = new RPCopy();
                        rpCopy.setCGGroupCopyUID(uvSetting.getGroupCopyUID());
                        Set<RPCopy> copies = new HashSet<RPCopy>();
                        copies.add(rpCopy);
                        logger.info("Source WWN: " + volUID + " is on RecoverPoint CG " + cgName + " with RecoverPoint CGID " + cgUID.getId());
                        rpCG = new RPConsistencyGroup();
                        rpCG.setName(cgName);
                        rpCG.setCGUID(cgUID);
                        rpCG.setClusterUID(productionCopyUID.getGlobalCopyUID().getClusterUID());
                        rpCG.setSiteToArrayIDsMap(mapCGToStorageArraysNoConnection(cgSetting));
                        rpCG.setCopies(copies);
                        returnMap.put(volUID, rpCG);
                        break;
                    }
                }
            }
            if (wwnListCopy.isEmpty()) {
                break;
            }
        }
        for (String wwnMissing : wwnListCopy) {
            logger.error("Could not map WWN: " + wwnMissing);
            unmappedWWNs.add(wwnMissing);
        }
        return returnMap;
    } catch (FunctionalAPIActionFailedException_Exception e) {
        logger.error(e.getMessage());
        return null;
    } catch (FunctionalAPIInternalError_Exception e) {
        logger.error(e.getMessage());
        return null;
    }
}
Also used : UserVolumeSettings(com.emc.fapiclient.ws.UserVolumeSettings) HashMap(java.util.HashMap) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) RPCopy(com.emc.storageos.recoverpoint.objectmodel.RPCopy) ReplicationSetSettings(com.emc.fapiclient.ws.ReplicationSetSettings) RPConsistencyGroup(com.emc.storageos.recoverpoint.objectmodel.RPConsistencyGroup) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) ConsistencyGroupUID(com.emc.fapiclient.ws.ConsistencyGroupUID) ConsistencyGroupSettings(com.emc.fapiclient.ws.ConsistencyGroupSettings) HashSet(java.util.HashSet)

Example 14 with FunctionalAPIActionFailedException_Exception

use of com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception in project coprhd-controller by CoprHD.

the class RecoverPointBookmarkManagementUtils method getBookmarksForMostRecentBookmarkName.

/**
 * Find the most recent bookmarks that were created for a CG with a given name
 *
 * @param impl - RP handle to use for RP operations
 * @param request - Information about the bookmark that was created on the CGs
 * @param cgUID - The CG to look for bookmarks
 *
 * @return A set of RP bookmarks found on the CG
 *
 * @throws RecoverPointException
 */
private Set<RPBookmark> getBookmarksForMostRecentBookmarkName(FunctionalAPIImpl impl, CreateBookmarkRequestParams request, ConsistencyGroupUID cgUID) throws RecoverPointException {
    Set<RPBookmark> returnBookmarkSet = null;
    try {
        String bookmarkName = request.getBookmark();
        Set<RPBookmark> bookmarkSet = new HashSet<RPBookmark>();
        ConsistencyGroupSettings cgSettings = impl.getGroupSettings(cgUID);
        List<ConsistencyGroupCopySettings> cgCopySettings = cgSettings.getGroupCopiesSettings();
        ConsistencyGroupCopyUID prodCopyUID = cgSettings.getLatestSourceCopyUID();
        for (ConsistencyGroupCopySettings cgcopysetting : cgCopySettings) {
            RPBookmark newEM = new RPBookmark();
            newEM.setCGGroupCopyUID(cgcopysetting.getCopyUID());
            newEM.setBookmarkName(bookmarkName);
            newEM.setBookmarkTime(null);
            bookmarkSet.add(newEM);
        }
        logger.debug("Getting list of snapshots with event marker name: " + bookmarkName);
        List<ConsistencyGroupCopySnapshots> cgCopySnapList = impl.getGroupSnapshots(cgUID).getCopiesSnapshots();
        for (ConsistencyGroupCopySnapshots cgCopySnap : cgCopySnapList) {
            ConsistencyGroupCopyUID copyUID = cgCopySnap.getCopyUID();
            logger.debug("Found " + cgCopySnap.getSnapshots().size() + " snapshots on copy: " + copyUID.getGlobalCopyUID().getCopyUID());
            for (Snapshot snapItem : cgCopySnap.getSnapshots()) {
                if (snapItem.getDescription().equals(bookmarkName)) {
                    for (RPBookmark rpBookmark : bookmarkSet) {
                        ConsistencyGroupCopyUID rpBookmarkCopyCG = rpBookmark.getCGGroupCopyUID();
                        if (RecoverPointUtils.copiesEqual(copyUID, rpBookmarkCopyCG)) {
                            // Update record with bookmark time, and add back
                            rpBookmark.setBookmarkTime(snapItem.getClosingTimeStamp());
                            Timestamp protectionTimeStr = new Timestamp(snapItem.getClosingTimeStamp().getTimeInMicroSeconds() / numMicroSecondsInMilli);
                            // Remove it, and add it back
                            RPBookmark updatedBookmark = new RPBookmark();
                            updatedBookmark.setBookmarkTime(snapItem.getClosingTimeStamp());
                            updatedBookmark.setCGGroupCopyUID(rpBookmark.getCGGroupCopyUID());
                            logger.info("Found our bookmark with time: " + protectionTimeStr.toString() + " and group copy ID: " + rpBookmark.getCGGroupCopyUID().getGlobalCopyUID().getCopyUID());
                            updatedBookmark.setBookmarkName(rpBookmark.getBookmarkName());
                            updatedBookmark.setProductionCopyUID(prodCopyUID);
                            if (returnBookmarkSet == null) {
                                returnBookmarkSet = new HashSet<RPBookmark>();
                            }
                            // TODO: logic is suspect, need to revisit. Why are we removing and adding the same object??
                            returnBookmarkSet.remove(updatedBookmark);
                            returnBookmarkSet.add(updatedBookmark);
                        }
                    }
                }
            }
        }
    } catch (FunctionalAPIActionFailedException_Exception e) {
        throw RecoverPointException.exceptions.exceptionLookingForBookmarks(e);
    } catch (FunctionalAPIInternalError_Exception e) {
        throw RecoverPointException.exceptions.exceptionLookingForBookmarks(e);
    }
    logger.debug("Return set has " + ((returnBookmarkSet != null) ? returnBookmarkSet.size() : 0) + " items");
    return ((returnBookmarkSet != null) ? returnBookmarkSet : null);
}
Also used : FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) Timestamp(java.sql.Timestamp) ConsistencyGroupCopySettings(com.emc.fapiclient.ws.ConsistencyGroupCopySettings) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID) Snapshot(com.emc.fapiclient.ws.Snapshot) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) ConsistencyGroupCopySnapshots(com.emc.fapiclient.ws.ConsistencyGroupCopySnapshots) ConsistencyGroupSettings(com.emc.fapiclient.ws.ConsistencyGroupSettings) RPBookmark(com.emc.storageos.recoverpoint.objectmodel.RPBookmark) HashSet(java.util.HashSet)

Example 15 with FunctionalAPIActionFailedException_Exception

use of com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception in project coprhd-controller by CoprHD.

the class RecoverPointImageManagementUtils method getCopyLinkState.

/**
 * Get the link state of a copy
 *
 * @param impl - RP handle
 * @param cgCopy - CG Copy, contains CG
 * @throws RecoverPointException
 */
public ConsistencyGroupLinkState getCopyLinkState(FunctionalAPIImpl impl, ConsistencyGroupCopyUID cgCopy) throws RecoverPointException {
    String cgCopyName = NAME_UNKNOWN;
    String cgName = NAME_UNKNOWN;
    try {
        cgCopyName = impl.getGroupCopyName(cgCopy);
        cgName = impl.getGroupName(cgCopy.getGroupUID());
        ConsistencyGroupUID groupUID = cgCopy.getGroupUID();
        ConsistencyGroupState groupState = impl.getGroupState(groupUID);
        List<ConsistencyGroupLinkState> linkStates = groupState.getLinksStates();
        for (ConsistencyGroupLinkState cgLinkState : linkStates) {
            if ((RecoverPointUtils.copiesEqual(cgLinkState.getGroupLinkUID().getSecondCopy(), cgCopy.getGlobalCopyUID()) || (RecoverPointUtils.copiesEqual(cgLinkState.getGroupLinkUID().getFirstCopy(), cgCopy.getGlobalCopyUID())))) {
                return cgLinkState;
            }
        }
        return null;
    } catch (FunctionalAPIActionFailedException_Exception e) {
        throw RecoverPointException.exceptions.failedToEnableCopy(cgCopyName, cgName, e);
    } catch (FunctionalAPIInternalError_Exception e) {
        throw RecoverPointException.exceptions.failedToEnableCopy(cgCopyName, cgName, e);
    }
}
Also used : ConsistencyGroupLinkState(com.emc.fapiclient.ws.ConsistencyGroupLinkState) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) ConsistencyGroupUID(com.emc.fapiclient.ws.ConsistencyGroupUID) ConsistencyGroupState(com.emc.fapiclient.ws.ConsistencyGroupState)

Aggregations

FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)42 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)42 ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)21 ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)15 ConsistencyGroupSettings (com.emc.fapiclient.ws.ConsistencyGroupSettings)11 HashSet (java.util.HashSet)10 ConsistencyGroupState (com.emc.fapiclient.ws.ConsistencyGroupState)8 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)8 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)7 RecoverPointImageManagementUtils (com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils)7 ConsistencyGroupCopySettings (com.emc.fapiclient.ws.ConsistencyGroupCopySettings)5 ConsistencyGroupCopyState (com.emc.fapiclient.ws.ConsistencyGroupCopyState)5 ConsistencyGroupLinkState (com.emc.fapiclient.ws.ConsistencyGroupLinkState)5 HashMap (java.util.HashMap)5 ClusterUID (com.emc.fapiclient.ws.ClusterUID)4 ReplicationSetSettings (com.emc.fapiclient.ws.ReplicationSetSettings)4 RPSite (com.emc.storageos.recoverpoint.objectmodel.RPSite)4 ClusterConfiguration (com.emc.fapiclient.ws.ClusterConfiguration)3 ConsistencyGroupCopySnapshots (com.emc.fapiclient.ws.ConsistencyGroupCopySnapshots)3 DeviceUID (com.emc.fapiclient.ws.DeviceUID)3