Search in sources :

Example 1 with ActivationSettingsChangesParams

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

the class RecoverPointClient method recreateReplicationSets.

/**
 * Perform Step 2 of expanding a volume, Recreate a replication set that was previously removed.
 *
 * @param volume volume base of replication set
 * @param rsetSettings replication set information used to create replication set
 * @throws RecoverPointException
 */
public void recreateReplicationSets(Map<String, RecreateReplicationSetRequestParams> rsetParams) throws RecoverPointException {
    if (rsetParams != null && !rsetParams.isEmpty()) {
        // Used to capture the volume WWNs associated with each replication set to recreate.
        List<String> volumeWWNs = new ArrayList<String>();
        try {
            // Get the CG ID from the first element in the list. All elements will share
            // the same CG ID.
            RecreateReplicationSetRequestParams param = rsetParams.values().iterator().next();
            ConsistencyGroupUID cgID = param.getConsistencyGroupUID();
            // Rescan the SAN
            functionalAPI.rescanSANVolumesInAllClusters(true);
            ConsistencyGroupSettingsChangesParam cgSettingsParam = new ConsistencyGroupSettingsChangesParam();
            ActivationSettingsChangesParams cgActivationSettings = new ActivationSettingsChangesParams();
            cgActivationSettings.setEnable(true);
            cgActivationSettings.setStartTransfer(true);
            cgSettingsParam.setActivationParams(cgActivationSettings);
            cgSettingsParam.setGroupUID(cgID);
            for (Entry<String, RecreateReplicationSetRequestParams> entry : rsetParams.entrySet()) {
                RecreateReplicationSetRequestParams rsetParam = entry.getValue();
                // Create replication set
                logger.info("Adding replication set: " + rsetParam.getName());
                ReplicationSetSettingsChangesParam repSetSettings = new ReplicationSetSettingsChangesParam();
                repSetSettings.setName(rsetParam.getName());
                repSetSettings.setShouldAttachAsClean(false);
                for (CreateRSetVolumeParams volume : rsetParam.getVolumes()) {
                    UserVolumeSettingsChangesParam volSettings = new UserVolumeSettingsChangesParam();
                    volSettings.setNewVolumeID(volume.getDeviceUID());
                    volSettings.setCopyUID(volume.getConsistencyGroupCopyUID());
                    volSettings.getCopyUID().setGroupUID(cgID);
                    repSetSettings.getVolumesChanges().add(volSettings);
                }
                cgSettingsParam.getReplicationSetsChanges().add(repSetSettings);
                volumeWWNs.add(entry.getKey());
            }
            // Add the replication set
            functionalAPI.setConsistencyGroupSettings(cgSettingsParam);
            logger.info("Checking for volumes unattached to splitters");
            RecoverPointUtils.verifyCGVolumesAttachedToSplitter(functionalAPI, cgID);
            RecoverPointImageManagementUtils rpiMgmt = new RecoverPointImageManagementUtils();
            logger.info("Waiting for links to become active for CG ");
            // Wait for the active state or paused state. If a copy is in direct access mode, the link
            // will be paused but it's still a valid state.
            rpiMgmt.waitForCGLinkState(functionalAPI, cgID, RecoverPointImageManagementUtils.getPipeActiveState(functionalAPI, cgID), PipeState.PAUSED);
        } catch (FunctionalAPIActionFailedException_Exception e) {
            throw RecoverPointException.exceptions.failedToRecreateReplicationSet(volumeWWNs.toString(), e);
        } catch (FunctionalAPIInternalError_Exception e) {
            throw RecoverPointException.exceptions.failedToRecreateReplicationSet(volumeWWNs.toString(), e);
        }
    }
}
Also used : ReplicationSetSettingsChangesParam(com.emc.fapiclient.ws.ReplicationSetSettingsChangesParam) ConsistencyGroupSettingsChangesParam(com.emc.fapiclient.ws.ConsistencyGroupSettingsChangesParam) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) UserVolumeSettingsChangesParam(com.emc.fapiclient.ws.UserVolumeSettingsChangesParam) ArrayList(java.util.ArrayList) RecoverPointImageManagementUtils(com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils) RecreateReplicationSetRequestParams(com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams) CreateRSetVolumeParams(com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams.CreateRSetVolumeParams) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) ConsistencyGroupUID(com.emc.fapiclient.ws.ConsistencyGroupUID) ActivationSettingsChangesParams(com.emc.fapiclient.ws.ActivationSettingsChangesParams)

Example 2 with ActivationSettingsChangesParams

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

the class RecoverPointClient method configureCGSettingsChangeParams.

/**
 * Configures the consistency group settings change param.
 *
 * @param request the CG create request information
 * @param prodSites the list of production clusters
 * @param clusterIdCache the cached map of internal site names to clusters
 * @param attachAsClean attach as clean can be true if source and target are guaranteed to be the same (as in create
 *            new volume). for change vpool, attach as clean should be false
 * @return the consistency group settings change param
 * @throws FunctionalAPIInternalError_Exception
 * @throws FunctionalAPIActionFailedException_Exception
 */
private ConsistencyGroupSettingsChangesParam configureCGSettingsChangeParams(CGRequestParams request, ConsistencyGroupUID cgUID, List<ClusterUID> prodSites, Map<String, ClusterUID> clusterIdCache, Map<Long, ConsistencyGroupCopyUID> productionCopiesUID, Map<Long, ConsistencyGroupCopyUID> nonProductionCopiesUID, boolean attachAsClean) throws FunctionalAPIActionFailedException_Exception, FunctionalAPIInternalError_Exception {
    Set<RPSite> allSites = getAssociatedRPSites();
    // used to set journal volumes and RSets after the CG is created
    ConsistencyGroupSettingsChangesParam cgSettingsParam = new ConsistencyGroupSettingsChangesParam();
    ActivationSettingsChangesParams cgActivationSettings = new ActivationSettingsChangesParams();
    cgActivationSettings.setEnable(true);
    cgActivationSettings.setStartTransfer(true);
    cgSettingsParam.setActivationParams(cgActivationSettings);
    cgSettingsParam.setGroupUID(cgUID);
    for (CreateCopyParams copyParam : request.getCopies()) {
        ClusterUID clusterUID = getClusterUid(copyParam, clusterIdCache);
        if (clusterUID != null) {
            RecoverPointCGCopyType copyType = getCopyType(copyParam, prodSites, clusterUID);
            if (copyType != null) {
                ConsistencyGroupCopyUID cgCopyUID = getCGCopyUid(clusterUID, copyType, cgUID);
                // set up journal params
                ConsistencyGroupCopySettingsChangesParam copySettingsParam = new ConsistencyGroupCopySettingsChangesParam();
                copySettingsParam.setCopyUID(cgCopyUID);
                ActivationSettingsChangesParams copyActivationSettings = new ActivationSettingsChangesParams();
                copyActivationSettings.setEnable(true);
                copyActivationSettings.setStartTransfer(true);
                copySettingsParam.setActivationParams(copyActivationSettings);
                for (CreateVolumeParams journalVolume : copyParam.getJournals()) {
                    logger.info("Configuring Journal : \n" + journalVolume.toString() + "\n for copy: " + copyParam.getName() + "; CG " + request.getCgName());
                    copySettingsParam.getNewJournalVolumes().add(RecoverPointUtils.getDeviceID(allSites, journalVolume.getInternalSiteName(), journalVolume.getWwn()));
                }
                cgSettingsParam.getCopiesChanges().add(copySettingsParam);
            } else {
                logger.warn("No journal volumes specified for CG: " + copyParam.getName());
            }
        } else {
            logger.warn("No journal volumes specified for CG: " + copyParam.getName());
        }
    }
    String previousProdCopyName = null;
    // configure replication sets
    for (CreateRSetParams rsetParam : request.getRsets()) {
        logger.info("Configuring replication set: " + rsetParam.toString() + " for cg " + request.getCgName());
        ReplicationSetSettingsChangesParam repSetSettings = new ReplicationSetSettingsChangesParam();
        repSetSettings.setName(rsetParam.getName());
        repSetSettings.setShouldAttachAsClean(attachAsClean);
        Set<String> sourceWWNsInRset = new HashSet<String>();
        for (CreateVolumeParams volume : rsetParam.getVolumes()) {
            UserVolumeSettingsChangesParam volSettings = new UserVolumeSettingsChangesParam();
            volSettings.setNewVolumeID(RecoverPointUtils.getDeviceID(allSites, volume.getInternalSiteName(), volume.getWwn()));
            ClusterUID volSiteId = getRPSiteID(volume.getInternalSiteName(), clusterIdCache);
            if (volume.isProduction()) {
                // for metropoint, the same production volume will appear twice; we only want to add it once
                if (sourceWWNsInRset.contains(volume.getWwn())) {
                    continue;
                }
                if (previousProdCopyName == null) {
                    previousProdCopyName = volume.getRpCopyName();
                } else if (!previousProdCopyName.equals(volume.getRpCopyName())) {
                    logger.info(String.format("will not add rset for volume %s to prod copy %s because another rset has already been added to prod copy %s", rsetParam.getName(), volume.getRpCopyName(), previousProdCopyName));
                    continue;
                }
                sourceWWNsInRset.add(volume.getWwn());
                logger.info("Configuring production copy volume : \n" + volume.toString());
                ConsistencyGroupCopyUID copyUID = productionCopiesUID.get(Long.valueOf(volSiteId.getId()));
                copyUID.setGroupUID(cgUID);
                volSettings.setCopyUID(copyUID);
            } else {
                logger.info("Configuring non-production copy volume : \n" + volume.toString());
                ConsistencyGroupCopyUID copyUID = nonProductionCopiesUID.get(Long.valueOf(volSiteId.getId()));
                copyUID.setGroupUID(cgUID);
                volSettings.setCopyUID(copyUID);
            }
            repSetSettings.getVolumesChanges().add(volSettings);
        }
        cgSettingsParam.getReplicationSetsChanges().add(repSetSettings);
    }
    return cgSettingsParam;
}
Also used : ReplicationSetSettingsChangesParam(com.emc.fapiclient.ws.ReplicationSetSettingsChangesParam) ConsistencyGroupSettingsChangesParam(com.emc.fapiclient.ws.ConsistencyGroupSettingsChangesParam) CreateRSetParams(com.emc.storageos.recoverpoint.requests.CreateRSetParams) UserVolumeSettingsChangesParam(com.emc.fapiclient.ws.UserVolumeSettingsChangesParam) CreateVolumeParams(com.emc.storageos.recoverpoint.requests.CreateVolumeParams) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID) ClusterUID(com.emc.fapiclient.ws.ClusterUID) ConsistencyGroupCopySettingsChangesParam(com.emc.fapiclient.ws.ConsistencyGroupCopySettingsChangesParam) RPSite(com.emc.storageos.recoverpoint.objectmodel.RPSite) CreateCopyParams(com.emc.storageos.recoverpoint.requests.CreateCopyParams) ActivationSettingsChangesParams(com.emc.fapiclient.ws.ActivationSettingsChangesParams) HashSet(java.util.HashSet)

Aggregations

ActivationSettingsChangesParams (com.emc.fapiclient.ws.ActivationSettingsChangesParams)2 ConsistencyGroupSettingsChangesParam (com.emc.fapiclient.ws.ConsistencyGroupSettingsChangesParam)2 ReplicationSetSettingsChangesParam (com.emc.fapiclient.ws.ReplicationSetSettingsChangesParam)2 UserVolumeSettingsChangesParam (com.emc.fapiclient.ws.UserVolumeSettingsChangesParam)2 ClusterUID (com.emc.fapiclient.ws.ClusterUID)1 ConsistencyGroupCopySettingsChangesParam (com.emc.fapiclient.ws.ConsistencyGroupCopySettingsChangesParam)1 ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)1 ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)1 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)1 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)1 RPSite (com.emc.storageos.recoverpoint.objectmodel.RPSite)1 CreateCopyParams (com.emc.storageos.recoverpoint.requests.CreateCopyParams)1 CreateRSetParams (com.emc.storageos.recoverpoint.requests.CreateRSetParams)1 CreateVolumeParams (com.emc.storageos.recoverpoint.requests.CreateVolumeParams)1 RecreateReplicationSetRequestParams (com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams)1 CreateRSetVolumeParams (com.emc.storageos.recoverpoint.requests.RecreateReplicationSetRequestParams.CreateRSetVolumeParams)1 RecoverPointImageManagementUtils (com.emc.storageos.recoverpoint.utils.RecoverPointImageManagementUtils)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1