Search in sources :

Example 6 with CreateCopyParams

use of com.emc.storageos.recoverpoint.requests.CreateCopyParams 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)

Example 7 with CreateCopyParams

use of com.emc.storageos.recoverpoint.requests.CreateCopyParams 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 8 with CreateCopyParams

use of com.emc.storageos.recoverpoint.requests.CreateCopyParams in project coprhd-controller by CoprHD.

the class RecoverPointClient method configureCGPolicy.

/**
 * Configure the entire consistency group policy.
 *
 * @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 productionCopiesUID mapping of production clusters IDs to consistency group copy IDs
 * @param nonProductionCopiesUID mapping of non-production clusters IDs to consistency group copy IDs
 * @param cgCopyNames mapping of consistency group copy IDs to consistency group copy names
 * @return the full consistency group policy
 * @throws FunctionalAPIActionFailedException_Exception
 * @throws FunctionalAPIInternalError_Exception
 */
private FullConsistencyGroupPolicy configureCGPolicy(CGRequestParams request, List<ClusterUID> prodSites, Map<String, ClusterUID> clusterIdCache, Map<Long, ConsistencyGroupCopyUID> productionCopiesUID, Map<Long, ConsistencyGroupCopyUID> nonProductionCopiesUID, Map<ConsistencyGroupCopyUID, String> cgCopyNames) throws FunctionalAPIActionFailedException_Exception, FunctionalAPIInternalError_Exception {
    logger.info("Requesting preferred RPA for cluster " + prodSites.get(0).getId());
    RpaUID preferredRPA = RecoverPointUtils.getPreferredRPAForNewCG(functionalAPI, prodSites.get(0));
    logger.info("Preferred RPA for cluster " + preferredRPA.getClusterUID().getId() + " is RPA " + preferredRPA.getRpaNumber());
    // used to create the CG; contains CG settings, copies and links
    FullConsistencyGroupPolicy fullConsistencyGroupPolicy = new FullConsistencyGroupPolicy();
    fullConsistencyGroupPolicy.setGroupName(request.getCgName());
    fullConsistencyGroupPolicy.setGroupPolicy(functionalAPI.getDefaultConsistencyGroupPolicy());
    fullConsistencyGroupPolicy.getGroupPolicy().setPrimaryRPANumber(preferredRPA.getRpaNumber());
    for (CreateCopyParams copyParam : request.getCopies()) {
        ClusterUID clusterUID = getClusterUid(copyParam, clusterIdCache);
        if (clusterUID != null) {
            RecoverPointCGCopyType copyType = getCopyType(copyParam, prodSites, clusterUID);
            if (copyType != null) {
                logger.info(String.format("Configuring %s copy %s for CG %s", copyType.toString(), copyParam.getName(), request.getCgName()));
                ConsistencyGroupCopyUID cgCopyUID = getCGCopyUid(clusterUID, copyType, null);
                FullConsistencyGroupCopyPolicy copyPolicy = new FullConsistencyGroupCopyPolicy();
                copyPolicy.setCopyName(copyParam.getName());
                copyPolicy.setCopyPolicy(functionalAPI.getDefaultConsistencyGroupCopyPolicy());
                copyPolicy.setCopyUID(cgCopyUID);
                cgCopyNames.put(cgCopyUID, copyParam.getName());
                if (getMaxNumberOfSnapShots(copyParam) > 0) {
                    copyPolicy.getCopyPolicy().getSnapshotsPolicy().setNumOfDesiredSnapshots(getMaxNumberOfSnapShots(copyParam));
                }
                fullConsistencyGroupPolicy.getCopiesPolicies().add(copyPolicy);
                if (copyType.isProduction()) {
                    fullConsistencyGroupPolicy.getProductionCopies().add(copyPolicy.getCopyUID());
                    productionCopiesUID.put(Long.valueOf(clusterUID.getId()), copyPolicy.getCopyUID());
                } else {
                    nonProductionCopiesUID.put(Long.valueOf(clusterUID.getId()), copyPolicy.getCopyUID());
                }
            } else {
                logger.error("No journal volumes specified for create CG: " + copyParam.getName());
            }
        } else {
            logger.error("No journal volumes specified for create CG: " + copyParam.getName());
        }
    }
    // set links between production and remote/local copies
    configureLinkPolicies(fullConsistencyGroupPolicy, request, productionCopiesUID, nonProductionCopiesUID, cgCopyNames);
    return fullConsistencyGroupPolicy;
}
Also used : ClusterUID(com.emc.fapiclient.ws.ClusterUID) FullConsistencyGroupPolicy(com.emc.fapiclient.ws.FullConsistencyGroupPolicy) FullConsistencyGroupCopyPolicy(com.emc.fapiclient.ws.FullConsistencyGroupCopyPolicy) RpaUID(com.emc.fapiclient.ws.RpaUID) CreateCopyParams(com.emc.storageos.recoverpoint.requests.CreateCopyParams) ConsistencyGroupCopyUID(com.emc.fapiclient.ws.ConsistencyGroupCopyUID)

Example 9 with CreateCopyParams

use of com.emc.storageos.recoverpoint.requests.CreateCopyParams in project coprhd-controller by CoprHD.

the class RecoverPointClient method scan.

/**
 * Walk through the journals and source/target volumes to see where the WWNS lie.
 *
 * @param copies
 * @param rSets
 * @return set of discovered RP sites
 */
private Set<RPSite> scan(List<CreateCopyParams> copies, List<CreateRSetParams> rSets) {
    // Setting the MAX_SCAN_WAIT_TOTAL_TRIES = 240
    // so that we loop for a max of 1 hour (240 * 15000 = 1 hour)
    final int MAX_SCAN_WAIT_TOTAL_TRIES = 240;
    final int MAX_SCAN_WAIT_RETRY_MILLISECONDS = 15000;
    int rescanTries = MAX_SCAN_WAIT_TOTAL_TRIES;
    // set to true to stay in the loop
    boolean needsScan = true;
    Set<RPSite> allSites = null;
    while (needsScan && rescanTries-- > 0) {
        // Reset scan flag. If something goes wrong, it'll get set to true.
        needsScan = false;
        if ((MAX_SCAN_WAIT_TOTAL_TRIES - rescanTries) != 1) {
            logger.info("RecoverPointClient: Briefly sleeping to accommodate export group latencies (Attempt #{} / {})", MAX_SCAN_WAIT_TOTAL_TRIES - rescanTries, MAX_SCAN_WAIT_TOTAL_TRIES);
            try {
                Thread.sleep(MAX_SCAN_WAIT_RETRY_MILLISECONDS);
            } catch (InterruptedException e1) {
                Thread.currentThread().interrupt();
            }
        }
        // Rescan the san
        logger.info("RecoverPointClient: Rescanning san volumes for endpoint: " + _endpoint.toASCIIString());
        try {
            functionalAPI.rescanSANVolumesInAllClusters(true);
        } catch (FunctionalAPIActionFailedException_Exception e) {
            logger.warn("Exception in call to rescanSANVolumesInAllSites");
        } catch (FunctionalAPIInternalError_Exception e) {
            logger.warn("Exception in call to rescanSANVolumesInAllSites");
        }
        // Get all of the volumes
        allSites = getAssociatedRPSites();
        // 
        for (CreateCopyParams copy : copies) {
            for (CreateVolumeParams volumeParam : copy.getJournals()) {
                boolean found = false;
                for (RPSite rpSite : allSites) {
                    ClusterSANVolumes siteSANVolumes = rpSite.getSiteVolumes();
                    for (VolumeInformation volume : siteSANVolumes.getVolumesInformations()) {
                        if (matchesVolumeWWN(volume, volumeParam.getWwn())) {
                            logger.info("Found site and volume ID for journal: " + volumeParam.getWwn() + " for copy: " + copy.getName());
                            found = true;
                            break;
                        }
                    }
                    if (found) {
                        break;
                    }
                }
                if (!found) {
                    logger.warn(String.format("Could not find volume %s for copy %s and internal site %s on any RP site.  We will likely retry.", volumeParam.getWwn(), copy.getName(), volumeParam.getInternalSiteName()));
                    // set that we still need to scan.
                    needsScan = true;
                    if (rescanTries <= 0) {
                        for (RPSite rpSite : allSites) {
                            logger.error(String.format("Could not find volume %s on any RP site.  Retries exhausted.", volumeParam.getWwn()));
                            ClusterSANVolumes siteSANVolumes = rpSite.getSiteVolumes();
                            for (VolumeInformation volume : siteSANVolumes.getVolumesInformations()) {
                                logger.info(String.format("RP Site: %s; volume from RP: %s", rpSite.getSiteName(), RecoverPointUtils.getGuidBufferAsString(volume.getNaaUids(), false)));
                            }
                        }
                        throw RecoverPointException.exceptions.couldNotFindSiteAndVolumeIDForJournal(volumeParam.getWwn(), copy.getName(), volumeParam.getInternalSiteName());
                    }
                }
            }
        }
        // When adding new journal volumes only no need to look at source and target volumes
        if (rSets == null || rSets.isEmpty()) {
            continue;
        }
        // 
        for (CreateRSetParams rset : rSets) {
            for (CreateVolumeParams volumeParam : rset.getVolumes()) {
                boolean found = false;
                for (RPSite rpSite : allSites) {
                    ClusterSANVolumes siteSANVolumes = rpSite.getSiteVolumes();
                    for (VolumeInformation volume : siteSANVolumes.getVolumesInformations()) {
                        if (matchesVolumeWWN(volume, volumeParam.getWwn())) {
                            logger.info(String.format("Found site and volume ID for volume: %s for replication set: %s on site: %s (%s)", volumeParam.getWwn(), rset.getName(), rpSite.getSiteName(), volumeParam.getInternalSiteName()));
                            found = true;
                            break;
                        }
                    }
                    if (found) {
                        break;
                    }
                }
                if (!found) {
                    logger.warn(String.format("Could not find volume %s for internal site %s on any RP site.  We will likely retry.", volumeParam.getWwn(), volumeParam.getInternalSiteName()));
                    // set that we still need to scan
                    needsScan = true;
                    if (rescanTries <= 0) {
                        for (RPSite rpSite : allSites) {
                            logger.error(String.format("Could not find volume %s on any RP site.  Retries exhausted.", volumeParam.getWwn()));
                            ClusterSANVolumes siteSANVolumes = rpSite.getSiteVolumes();
                            for (VolumeInformation volume : siteSANVolumes.getVolumesInformations()) {
                                logger.info(String.format("RP Site: %s; volume from RP: %s", rpSite.getSiteName(), RecoverPointUtils.getGuidBufferAsString(volume.getNaaUids(), false)));
                            }
                        }
                        throw RecoverPointException.exceptions.couldNotFindSiteAndVolumeIDForVolume(volumeParam.getWwn(), rset.getName(), volumeParam.getInternalSiteName());
                    }
                }
            }
        }
    }
    return allSites;
}
Also used : CreateRSetParams(com.emc.storageos.recoverpoint.requests.CreateRSetParams) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) RPSite(com.emc.storageos.recoverpoint.objectmodel.RPSite) ClusterSANVolumes(com.emc.fapiclient.ws.ClusterSANVolumes) CreateCopyParams(com.emc.storageos.recoverpoint.requests.CreateCopyParams) CreateVolumeParams(com.emc.storageos.recoverpoint.requests.CreateVolumeParams) VolumeInformation(com.emc.fapiclient.ws.VolumeInformation)

Example 10 with CreateCopyParams

use of com.emc.storageos.recoverpoint.requests.CreateCopyParams in project coprhd-controller by CoprHD.

the class RecoverPointClientIntegrationTest method createCGParamsHelper.

public CGRequestParams createCGParamsHelper(boolean createCDP, boolean createCRR, int numRSets) {
    CGRequestParams params = new CGRequestParams();
    params.setJunitTest(true);
    if (createCDP && createCRR) {
        params.setCgName("BourneRPTestCDPAndCRR");
        logger.info("Create CG for CDP and CRR: BourneRPTestCDPAndCRR");
    } else if (createCDP) {
        params.setCgName("BourneRPTestCDPOnly");
        logger.info("Create CG for CDP: BourneRPTestCDPOnly");
    } else {
        params.setCgName("BourneRPTestCRROnly");
        logger.info("Create CG for CRR: BourneRPTestCRROnly");
    }
    List<CreateRSetParams> rsetParamList = new LinkedList<CreateRSetParams>();
    // Production copy (VNX: 10.247.160.30)
    CreateVolumeParams copyprodVolumeParams = new CreateVolumeParams();
    copyprodVolumeParams.setWwn(BourneRPTestProdLUN1WWN);
    copyprodVolumeParams.setInternalSiteName(site1InternalSiteName);
    copyprodVolumeParams.setProduction(true);
    List<CreateVolumeParams> rsetVolumeList = new ArrayList<CreateVolumeParams>();
    rsetVolumeList.add(copyprodVolumeParams);
    if (createCDP) {
        CreateVolumeParams copylocalVolumeParams = new CreateVolumeParams();
        copylocalVolumeParams.setWwn(BourneRPTestCDPLUN1WWN);
        copylocalVolumeParams.setInternalSiteName(site1InternalSiteName);
        copylocalVolumeParams.setProduction(false);
        rsetVolumeList.add(copylocalVolumeParams);
    }
    if (createCRR) {
        CreateVolumeParams copyremoteVolumeParams = new CreateVolumeParams();
        copyremoteVolumeParams.setWwn(BourneRPTestCRRLUN1WWN);
        copyremoteVolumeParams.setInternalSiteName(site2InternalSiteName);
        copyremoteVolumeParams.setProduction(false);
        rsetVolumeList.add(copyremoteVolumeParams);
    }
    CreateRSetParams rset = new CreateRSetParams();
    rset.setName("RSet1");
    rset.setVolumes(rsetVolumeList);
    rsetParamList.add(rset);
    // Replication set 2
    if (numRSets > 1) {
        CreateVolumeParams r2copyprodVolumeParams = new CreateVolumeParams();
        r2copyprodVolumeParams.setWwn(BourneRPTestProdLUN2WWN);
        r2copyprodVolumeParams.setInternalSiteName(site1InternalSiteName);
        r2copyprodVolumeParams.setProduction(true);
        rsetVolumeList = new ArrayList<CreateVolumeParams>();
        rsetVolumeList.add(r2copyprodVolumeParams);
        if (createCDP) {
            CreateVolumeParams r2copylocalVolumeParams = new CreateVolumeParams();
            r2copylocalVolumeParams = new CreateVolumeParams();
            r2copylocalVolumeParams.setWwn(BourneRPTestCDPLUN2WWN);
            r2copylocalVolumeParams.setInternalSiteName(site1InternalSiteName);
            r2copylocalVolumeParams.setProduction(false);
            rsetVolumeList.add(r2copylocalVolumeParams);
        }
        if (createCRR) {
            CreateVolumeParams r2copyremoteVolumeParams = new CreateVolumeParams();
            r2copyremoteVolumeParams = new CreateVolumeParams();
            r2copyremoteVolumeParams.setWwn(BourneRPTestCRRLUN2WWN);
            r2copyremoteVolumeParams.setInternalSiteName(site2InternalSiteName);
            r2copyremoteVolumeParams.setProduction(false);
            rsetVolumeList.add(r2copyremoteVolumeParams);
        }
        rset = new CreateRSetParams();
        rset.setName("RSet2");
        rset.setVolumes(rsetVolumeList);
        rsetParamList.add(rset);
    }
    params.setRsets(rsetParamList);
    CreateCopyParams prodCopyParams = new CreateCopyParams();
    CreateCopyParams localCopyParams = new CreateCopyParams();
    CreateCopyParams remoteCopyParams = new CreateCopyParams();
    CreateVolumeParams prodJournalParams = new CreateVolumeParams();
    prodJournalParams.setWwn(BourneRPTestJrnlLUN1WWN);
    prodJournalParams.setInternalSiteName(site1InternalSiteName);
    // necessary for now
    prodJournalParams.setProduction(true);
    List<CreateVolumeParams> prodJournalVolumeList = new ArrayList<CreateVolumeParams>();
    prodJournalVolumeList.add(prodJournalParams);
    if (isSymmDevices) {
        // extra jrnl for symm
        CreateVolumeParams prodJournalParams2 = new CreateVolumeParams();
        prodJournalParams2.setWwn(BourneRPTestJrnlLUN3WWN);
        prodJournalParams2.setInternalSiteName(site1InternalSiteName);
        prodJournalParams2.setProduction(true);
        prodJournalVolumeList.add(prodJournalParams2);
    }
    prodCopyParams.setName("production");
    prodCopyParams.setJournals(prodJournalVolumeList);
    List<CreateCopyParams> copyList = new ArrayList<CreateCopyParams>();
    copyList.add(prodCopyParams);
    if (createCDP) {
        CreateVolumeParams localJournalParams = new CreateVolumeParams();
        localJournalParams.setWwn(BourneRPTestJrnlLUN2WWN);
        localJournalParams.setInternalSiteName(site1InternalSiteName);
        localJournalParams.setProduction(false);
        List<CreateVolumeParams> localJournalVolumeList = new ArrayList<CreateVolumeParams>();
        localJournalVolumeList.add(localJournalParams);
        if (isSymmDevices) {
            // extra jrnl for symm
            CreateVolumeParams localJournalParams2 = new CreateVolumeParams();
            localJournalParams2.setWwn(BourneRPTestJrnlLUN4WWN);
            localJournalParams2.setInternalSiteName(site1InternalSiteName);
            localJournalParams2.setProduction(false);
            localJournalVolumeList.add(localJournalParams2);
        }
        // 
        localCopyParams.setName("local");
        localCopyParams.setJournals(localJournalVolumeList);
        copyList.add(localCopyParams);
    }
    if (createCRR) {
        CreateVolumeParams remoteJournalParams = new CreateVolumeParams();
        remoteJournalParams.setWwn(BourneRPTestJrnlLUN5WWN);
        remoteJournalParams.setInternalSiteName(site2InternalSiteName);
        remoteJournalParams.setProduction(false);
        List<CreateVolumeParams> remoteJournalVolumeList = new ArrayList<CreateVolumeParams>();
        remoteJournalVolumeList.add(remoteJournalParams);
        if (isSymmDevices) {
            // extra jrnl for symm
            CreateVolumeParams remoteJournalParams2 = new CreateVolumeParams();
            remoteJournalParams2.setWwn(BourneRPTestJrnlLUN6WWN);
            remoteJournalParams2.setInternalSiteName(site2InternalSiteName);
            remoteJournalParams2.setProduction(false);
            remoteJournalVolumeList.add(remoteJournalParams2);
        }
        remoteCopyParams.setName("remote");
        remoteCopyParams.setJournals(remoteJournalVolumeList);
        copyList.add(remoteCopyParams);
    }
    params.setCopies(copyList);
    logger.info(params.toString());
    return params;
}
Also used : CreateRSetParams(com.emc.storageos.recoverpoint.requests.CreateRSetParams) ArrayList(java.util.ArrayList) CGRequestParams(com.emc.storageos.recoverpoint.requests.CGRequestParams) CreateCopyParams(com.emc.storageos.recoverpoint.requests.CreateCopyParams) LinkedList(java.util.LinkedList) CreateVolumeParams(com.emc.storageos.recoverpoint.requests.CreateVolumeParams)

Aggregations

CreateCopyParams (com.emc.storageos.recoverpoint.requests.CreateCopyParams)12 CreateVolumeParams (com.emc.storageos.recoverpoint.requests.CreateVolumeParams)11 CreateRSetParams (com.emc.storageos.recoverpoint.requests.CreateRSetParams)9 Volume (com.emc.storageos.db.client.model.Volume)6 ArrayList (java.util.ArrayList)6 ClusterUID (com.emc.fapiclient.ws.ClusterUID)4 ConsistencyGroupCopyUID (com.emc.fapiclient.ws.ConsistencyGroupCopyUID)4 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)4 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)4 NamedURI (com.emc.storageos.db.client.model.NamedURI)4 RPSite (com.emc.storageos.recoverpoint.objectmodel.RPSite)4 URI (java.net.URI)4 HashSet (java.util.HashSet)4 StringSet (com.emc.storageos.db.client.model.StringSet)3 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)3 ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)2 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)2 VolumeDescriptor (com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor)2 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)2 RecoverPointClient (com.emc.storageos.recoverpoint.impl.RecoverPointClient)2