Search in sources :

Example 1 with GetVolumeResponse

use of com.emc.storageos.recoverpoint.responses.GetVolumeResponse in project coprhd-controller by CoprHD.

the class RecoverPointClient method getAllCGs.

/**
 * Returns all CGs, policies, and volumes within the CG.
 *
 * @return a set of RP consistency group objects
 * @throws RecoverPointException
 */
public Set<GetCGsResponse> getAllCGs() throws RecoverPointException {
    String mgmtIPAddress = _endpoint.toASCIIString();
    if (null == mgmtIPAddress) {
        throw RecoverPointException.exceptions.noRecoverPointEndpoint();
    }
    // TODO: Refactor to break down into smaller pieces
    Set<GetCGsResponse> cgs = new HashSet<GetCGsResponse>();
    try {
        // Quickly get a map of cluster/sitenames
        Map<Long, String> clusterIdToInternalSiteNameMap = new HashMap<Long, String>();
        FullRecoverPointSettings fullRecoverPointSettings = functionalAPI.getFullRecoverPointSettings();
        for (ClusterConfiguration siteSettings : fullRecoverPointSettings.getSystemSettings().getGlobalSystemConfiguration().getClustersConfigurations()) {
            clusterIdToInternalSiteNameMap.put(siteSettings.getCluster().getId(), siteSettings.getInternalClusterName());
        }
        // Go through all of the CGs and retrieve important pieces of information
        List<ConsistencyGroupUID> allCgs = functionalAPI.getAllConsistencyGroups();
        for (ConsistencyGroupUID cg : allCgs) {
            ConsistencyGroupSettings settings = functionalAPI.getGroupSettings(cg);
            ConsistencyGroupState state = functionalAPI.getGroupState(cg);
            logger.info("Processing CG found on RecoverPoint system: " + settings.getName());
            // First storage attributes about the top-level CG
            GetCGsResponse cgResp = new GetCGsResponse();
            cgResp.setCgName(settings.getName());
            cgResp.setCgId(cg.getId());
            cgResp.setCgPolicy(new GetCGsResponse.GetPolicyResponse());
            // Find and store the policy information
            if (settings.getActiveLinksSettings() != null) {
                for (ConsistencyGroupLinkSettings cgls : settings.getActiveLinksSettings()) {
                    if (cgls.getLinkPolicy() != null && cgls.getLinkPolicy().getProtectionPolicy() != null) {
                        if (cgls.getLinkPolicy().getProtectionPolicy().getProtectionType() != null) {
                            if (cgls.getLinkPolicy().getProtectionPolicy().getProtectionType().toString().equalsIgnoreCase(ProtectionMode.SYNCHRONOUS.toString())) {
                                cgResp.getCgPolicy().synchronous = true;
                            } else {
                                cgResp.getCgPolicy().synchronous = false;
                            }
                        }
                        if (cgls.getLinkPolicy().getProtectionPolicy().getRpoPolicy() != null && cgls.getLinkPolicy().getProtectionPolicy().getRpoPolicy().getMaximumAllowedLag() != null) {
                            cgResp.getCgPolicy().rpoType = cgls.getLinkPolicy().getProtectionPolicy().getRpoPolicy().getMaximumAllowedLag().getType().name();
                            cgResp.getCgPolicy().rpoValue = cgls.getLinkPolicy().getProtectionPolicy().getRpoPolicy().getMaximumAllowedLag().getValue();
                        }
                    }
                }
            }
            // We assume CG health until we see something that indicates otherwise.
            cgResp.setCgState(GetCGsResponse.GetCGStateResponse.HEALTHY);
            RecoverPointCGState cgState = this.getCGState(cg);
            if (cgState.equals(RecoverPointCGState.DELETED)) {
                cgResp.setCgState(GetCGStateResponse.UNHEALTHY_ERROR);
            } else if (cgState.equals(RecoverPointCGState.MIXED)) {
                cgResp.setCgState(GetCGStateResponse.UNHEALTHY_PAUSED_OR_DISABLED);
            } else if (cgState.equals(RecoverPointCGState.PAUSED)) {
                cgResp.setCgState(GetCGStateResponse.UNHEALTHY_PAUSED_OR_DISABLED);
            } else if (cgState.equals(RecoverPointCGState.STOPPED)) {
                cgResp.setCgState(GetCGStateResponse.UNHEALTHY_PAUSED_OR_DISABLED);
            }
            // Fill in the Copy information
            if (settings.getGroupCopiesSettings() == null) {
                continue;
            }
            Map<String, String> copyUIDToNameMap = new HashMap<String, String>();
            Map<String, String> copyNameToRoleMap = new HashMap<String, String>();
            // used to set the copy uid on the rset volume when adding rsets
            Set<String> productionCopiesUID = new HashSet<String>();
            // Retrieve all RP copies for this CG
            for (ConsistencyGroupCopySettings copySettings : settings.getGroupCopiesSettings()) {
                GetCopyResponse copy = new GetCopyResponse();
                copy.setName(copySettings.getName());
                String copyID = copySettings.getCopyUID().getGlobalCopyUID().getClusterUID().getId() + "-" + copySettings.getCopyUID().getGlobalCopyUID().getCopyUID();
                copyUIDToNameMap.put(copyID, copySettings.getName());
                for (ConsistencyGroupCopyState copyState : state.getGroupCopiesStates()) {
                    if (!RecoverPointUtils.copiesEqual(copySettings.getCopyUID(), copyState.getCopyUID())) {
                        continue;
                    }
                    // Get the access image and enabled information
                    copy.setAccessState(copyState.getStorageAccessState().toString());
                    copy.setAccessedImage(copyState.getAccessedImage() != null ? copyState.getAccessedImage().getDescription() : null);
                    copy.setEnabled(copyState.isEnabled());
                    copy.setActive(copyState.isActive());
                }
                // Set ID fields (these are immutable no matter if things are renamed)
                copy.setCgId(copySettings.getCopyUID().getGroupUID().getId());
                copy.setClusterId(copySettings.getCopyUID().getGlobalCopyUID().getClusterUID().getId());
                copy.setCopyId(copySettings.getCopyUID().getGlobalCopyUID().getCopyUID());
                if (ConsistencyGroupCopyRole.ACTIVE.equals(copySettings.getRoleInfo().getRole()) || ConsistencyGroupCopyRole.TEMPORARY_ACTIVE.equals(copySettings.getRoleInfo().getRole())) {
                    productionCopiesUID.add(copyID);
                    copy.setProduction(true);
                    // Standby Production role is defined as: copy is production and copy is NOT active.
                    if (copy.isActive()) {
                        copy.setRole(GetCopyResponse.GetCopyRole.ACTIVE_PRODUCTION);
                    } else {
                        copy.setRole(GetCopyResponse.GetCopyRole.STANDBY_PRODUCTION);
                    }
                } else if (ConsistencyGroupCopyRole.REPLICA.equals(copySettings.getRoleInfo().getRole())) {
                    copy.setProduction(false);
                    copy.setRole(GetCopyResponse.GetCopyRole.TARGET);
                } else {
                    copy.setProduction(false);
                    copy.setRole(GetCopyResponse.GetCopyRole.UNKNOWN);
                }
                // Add an entry for this copy name and its defined role
                copyNameToRoleMap.put(copy.getName(), copy.getRole().toString());
                if (copySettings.getJournal() == null || copySettings.getJournal().getJournalVolumes() == null) {
                    continue;
                }
                for (JournalVolumeSettings journal : copySettings.getJournal().getJournalVolumes()) {
                    GetVolumeResponse volume = new GetVolumeResponse();
                    volume.setRpCopyName(copySettings.getName());
                    volume.setInternalSiteName(clusterIdToInternalSiteNameMap.get(journal.getClusterUID().getId()));
                    // Need to extract the naaUids to format: 600601608D20370089260942815CE511
                    volume.setWwn(RecoverPointUtils.getGuidBufferAsString(journal.getVolumeInfo().getNaaUids(), false).toUpperCase(Locale.ENGLISH));
                    if (copy.getJournals() == null) {
                        copy.setJournals(new ArrayList<GetVolumeResponse>());
                    }
                    copy.getJournals().add(volume);
                }
                if (cgResp.getCopies() == null) {
                    cgResp.setCopies(new ArrayList<GetCopyResponse>());
                }
                cgResp.getCopies().add(copy);
            }
            // Retrieve all replication sets for this CG
            for (ReplicationSetSettings rsetSettings : settings.getReplicationSetsSettings()) {
                GetRSetResponse rset = new GetRSetResponse();
                rset.setName(rsetSettings.getReplicationSetName());
                if (rsetSettings.getVolumes() == null) {
                    continue;
                }
                for (UserVolumeSettings volume : rsetSettings.getVolumes()) {
                    GetVolumeResponse volResp = new GetVolumeResponse();
                    // Get the RP copy name, needed to match up sources to targets
                    String copyID = volume.getGroupCopyUID().getGlobalCopyUID().getClusterUID().getId() + "-" + volume.getGroupCopyUID().getGlobalCopyUID().getCopyUID();
                    volResp.setRpCopyName(copyUIDToNameMap.get(copyID));
                    volResp.setInternalSiteName(clusterIdToInternalSiteNameMap.get(volume.getClusterUID().getId()));
                    if (productionCopiesUID.contains(copyID)) {
                        volResp.setProduction(true);
                        // volumes copy name to role mapping that was populated earlier.
                        if (GetCopyResponse.GetCopyRole.STANDBY_PRODUCTION.toString().equalsIgnoreCase(copyNameToRoleMap.get(volResp.getRpCopyName()))) {
                            volResp.setProductionStandby(true);
                        }
                    } else {
                        volResp.setProduction(false);
                    }
                    // Need to extract the naaUids to format: 600601608D20370089260942815CE511
                    volResp.setWwn(RecoverPointUtils.getGuidBufferAsString(volume.getVolumeInfo().getNaaUids(), false).toUpperCase(Locale.ENGLISH));
                    if (rset.getVolumes() == null) {
                        rset.setVolumes(new ArrayList<GetVolumeResponse>());
                    }
                    rset.getVolumes().add(volResp);
                }
                if (cgResp.getRsets() == null) {
                    cgResp.setRsets(new ArrayList<GetRSetResponse>());
                }
                cgResp.getRsets().add(rset);
            }
            cgs.add(cgResp);
        }
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        throw RecoverPointException.exceptions.failedToLookupConsistencyGroups(getCause(e));
    }
    return cgs;
}
Also used : GetCGsResponse(com.emc.storageos.recoverpoint.responses.GetCGsResponse) GetCopyResponse(com.emc.storageos.recoverpoint.responses.GetCopyResponse) UserVolumeSettings(com.emc.fapiclient.ws.UserVolumeSettings) HashMap(java.util.HashMap) ClusterConfiguration(com.emc.fapiclient.ws.ClusterConfiguration) GetRSetResponse(com.emc.storageos.recoverpoint.responses.GetRSetResponse) ConsistencyGroupUID(com.emc.fapiclient.ws.ConsistencyGroupUID) ConsistencyGroupSettings(com.emc.fapiclient.ws.ConsistencyGroupSettings) HashSet(java.util.HashSet) JournalVolumeSettings(com.emc.fapiclient.ws.JournalVolumeSettings) GetVolumeResponse(com.emc.storageos.recoverpoint.responses.GetVolumeResponse) ConsistencyGroupCopyState(com.emc.fapiclient.ws.ConsistencyGroupCopyState) ConsistencyGroupLinkSettings(com.emc.fapiclient.ws.ConsistencyGroupLinkSettings) ReplicationSetSettings(com.emc.fapiclient.ws.ReplicationSetSettings) FullRecoverPointSettings(com.emc.fapiclient.ws.FullRecoverPointSettings) ConsistencyGroupState(com.emc.fapiclient.ws.ConsistencyGroupState) ConsistencyGroupCopySettings(com.emc.fapiclient.ws.ConsistencyGroupCopySettings) 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)

Example 2 with GetVolumeResponse

use of com.emc.storageos.recoverpoint.responses.GetVolumeResponse in project coprhd-controller by CoprHD.

the class RecoverPointClientIntegrationTest method testGetAllCGs.

@Test
public void testGetAllCGs() {
    logger.info("Testing RecoverPoint CG Retrieval");
    Set<GetCGsResponse> cgs;
    try {
        cgs = rpClient.getAllCGs();
        Set<String> wwns = new HashSet<String>();
        for (GetCGsResponse cg : cgs) {
            logger.info("CG: " + cg);
            assertNotNull(cg.getCgName());
            assertNotNull(cg.getCgId());
            // Make sure certain fields are filled-in
            if (cg.getCopies() != null) {
                for (GetCopyResponse copy : cg.getCopies()) {
                    assertNotNull(copy.getJournals());
                    assertNotNull(copy.getName());
                    for (GetVolumeResponse volume : copy.getJournals()) {
                        assertNotNull(volume.getInternalSiteName());
                        assertNotNull(volume.getRpCopyName());
                        assertNotNull(volume.getWwn());
                        // Make sure the same volume isn't in more than one place in the list.
                        assertFalse(wwns.contains(volume.getWwn()));
                        wwns.add(volume.getWwn());
                    }
                }
            }
            if (cg.getRsets() != null) {
                for (GetRSetResponse rset : cg.getRsets()) {
                    assertNotNull(rset.getName());
                    assertNotNull(rset.getVolumes());
                    for (GetVolumeResponse volume : rset.getVolumes()) {
                        assertNotNull(volume.getInternalSiteName());
                        assertNotNull(volume.getRpCopyName());
                        assertNotNull(volume.getWwn());
                        // Make sure the same volume isn't in more than one place in the list.
                        assertFalse(wwns.contains(volume.getWwn()));
                        wwns.add(volume.getWwn());
                    }
                }
            }
        // Make sure you have journals, sources, and targets
        }
    } catch (RecoverPointException e) {
        fail(e.getMessage());
    }
}
Also used : GetCGsResponse(com.emc.storageos.recoverpoint.responses.GetCGsResponse) GetCopyResponse(com.emc.storageos.recoverpoint.responses.GetCopyResponse) GetRSetResponse(com.emc.storageos.recoverpoint.responses.GetRSetResponse) GetVolumeResponse(com.emc.storageos.recoverpoint.responses.GetVolumeResponse) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 3 with GetVolumeResponse

use of com.emc.storageos.recoverpoint.responses.GetVolumeResponse in project coprhd-controller by CoprHD.

the class RPUnManagedObjectDiscoverer method mapCgJournals.

/**
 * Update (if it exists) the journal UnManagedVolume objects with RP information needed for
 * ingestion
 *
 * @param unManagedProtectionSet unmanaged protection set
 * @param cg CG response got back from RP system
 * @param rpCopyAccessStateMap Map to hold the access state of the replication sets.
 * @param rpWwnToNativeWwn Map of RP volume WWN to native volume WWN - required for XIO but harmless otherwise
 * @param storageNativeIdPrefixes List of XIO systems discovered in ViPR
 * @param dbClient DB client instance
 */
private void mapCgJournals(UnManagedProtectionSet unManagedProtectionSet, GetCGsResponse cg, Map<String, String> rpCopyAccessStateMap, Map<String, String> rpWwnToNativeWwn, List<String> storageNativeIdPrefixes, DbClient dbClient) {
    for (GetCopyResponse copy : cg.getCopies()) {
        String accessState = copy.getAccessState();
        for (GetVolumeResponse volume : copy.getJournals()) {
            // Find this volume in UnManagedVolumes based on wwn
            UnManagedVolume unManagedVolume = findUnManagedVolumeForWwn(volume.getWwn(), dbClient, storageNativeIdPrefixes);
            // Check if this volume is already managed, which would indicate it has already been partially ingested
            Volume managedVolume = DiscoveryUtils.checkManagedVolumeExistsInDBByWwn(dbClient, volume.getWwn());
            // Add the WWN to the unmanaged protection set, regardless of whether this volume is unmanaged or not.
            unManagedProtectionSet.getVolumeWwns().add(volume.getWwn());
            if (null == unManagedVolume && null == managedVolume) {
                log.info("Protection Set {} contains unknown Journal volume: {}. Skipping.", unManagedProtectionSet.getNativeGuid(), volume.getWwn());
                continue;
            }
            if (null != managedVolume) {
                log.info("Protection Set {} contains volume {} that is already managed", unManagedProtectionSet.getNativeGuid(), volume.getWwn());
                // make sure it's in the UnManagedProtectionSet's ManagedVolume ids
                if (!unManagedProtectionSet.getManagedVolumeIds().contains(managedVolume.getId().toString())) {
                    unManagedProtectionSet.getManagedVolumeIds().add(managedVolume.getId().toString());
                }
                if (null != unManagedVolume) {
                    log.info("Protection Set {} also has an orphaned UnManagedVolume {} that will be removed", unManagedProtectionSet.getNativeGuid(), unManagedVolume.getLabel());
                    // remove the unManagedVolume from the UnManagedProtectionSet's UnManagedVolume ids
                    unManagedProtectionSet.getUnManagedVolumeIds().remove(unManagedVolume.getId().toString());
                    unManagedVolumesToDelete.add(unManagedVolume);
                }
                // because this volume is already managed, we can just continue to the next
                continue;
            }
            // at this point, we have an legitimate UnManagedVolume whose RP properties should be updated
            log.info("Processing Journal UnManagedVolume {}", unManagedVolume.forDisplay());
            // Capture the access state
            rpCopyAccessStateMap.put(volume.getRpCopyName(), accessState);
            // Add the unmanaged volume to the list (if it's not there already)
            if (!unManagedProtectionSet.getUnManagedVolumeIds().contains(unManagedVolume.getId().toString())) {
                unManagedProtectionSet.getUnManagedVolumeIds().add(unManagedVolume.getId().toString());
            }
            updateCommonRPProperties(unManagedProtectionSet, unManagedVolume, Volume.PersonalityTypes.METADATA.name(), volume, dbClient);
            rpWwnToNativeWwn.put(volume.getWwn(), unManagedVolume.getWwn());
            unManagedVolumesToUpdateByWwn.put(unManagedVolume.getWwn(), unManagedVolume);
        }
    }
}
Also used : GetCopyResponse(com.emc.storageos.recoverpoint.responses.GetCopyResponse) GetVolumeResponse(com.emc.storageos.recoverpoint.responses.GetVolumeResponse) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) Volume(com.emc.storageos.db.client.model.Volume) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)

Example 4 with GetVolumeResponse

use of com.emc.storageos.recoverpoint.responses.GetVolumeResponse in project coprhd-controller by CoprHD.

the class RPUnManagedObjectDiscoverer method mapCgSourceAndTargets.

/**
 * Update (if it exists) the source and target UnManagedVolume objects with RP information needed for
 * ingestion
 *
 * @param unManagedProtectionSet unmanaged protection set
 * @param cg CG response got back from RP system
 * @param rpCopyAccessStateMap Map to hold the access state of the replication sets
 * @param rpWwnToNativeWwn Map of RP volume WWN to native volume WWN - required for XIO but harmless otherwise
 * @param storageNativeIdPrefixes List of XIO systems discovered in ViPR
 * @param dbClient DB client instance
 */
private void mapCgSourceAndTargets(UnManagedProtectionSet unManagedProtectionSet, GetCGsResponse cg, Map<String, String> rpCopyAccessStateMap, Map<String, String> rpWwnToNativeWwn, List<String> storageNativeIdPrefixes, DbClient dbClient) {
    for (GetRSetResponse rset : cg.getRsets()) {
        for (GetVolumeResponse volume : rset.getVolumes()) {
            // Find this volume in UnManagedVolumes based on wwn
            UnManagedVolume unManagedVolume = findUnManagedVolumeForWwn(volume.getWwn(), dbClient, storageNativeIdPrefixes);
            // Check if this volume is already managed, which would indicate it has already been partially ingested
            Volume managedVolume = DiscoveryUtils.checkManagedVolumeExistsInDBByWwn(dbClient, volume.getWwn());
            // Add the WWN to the unmanaged protection set, regardless of whether this volume is unmanaged or not.
            unManagedProtectionSet.getVolumeWwns().add(volume.getWwn());
            if (null == unManagedVolume && null == managedVolume) {
                log.info("Protection Set {} contains unknown Replication Set volume: {}. Skipping.", unManagedProtectionSet.getNativeGuid(), volume.getWwn());
                continue;
            }
            if (null != managedVolume) {
                log.info("Protection Set {} contains volume {} that is already managed", unManagedProtectionSet.getNativeGuid(), volume.getWwn());
                // make sure it's in the UnManagedProtectionSet's ManagedVolume ids
                if (!unManagedProtectionSet.getManagedVolumeIds().contains(managedVolume.getId().toString())) {
                    unManagedProtectionSet.getManagedVolumeIds().add(managedVolume.getId().toString());
                }
                if (!managedVolume.checkInternalFlags(Flag.INTERNAL_OBJECT) && null != unManagedVolume) {
                    log.info("Protection Set {} also has an orphaned UnManagedVolume {} that will be removed", unManagedProtectionSet.getNativeGuid(), unManagedVolume.getLabel());
                    // remove the unManagedVolume from the UnManagedProtectionSet's UnManagedVolume ids
                    unManagedProtectionSet.getUnManagedVolumeIds().remove(unManagedVolume.getId().toString());
                    unManagedVolumesToDelete.add(unManagedVolume);
                }
                // because this volume is already managed, we can just continue to the next
                continue;
            }
            // at this point, we have an legitimate UnManagedVolume whose RP properties should be updated
            log.info("Processing Replication Set UnManagedVolume {}", unManagedVolume.forDisplay());
            // Add the unmanaged volume to the list (if it's not there already)
            if (!unManagedProtectionSet.getUnManagedVolumeIds().contains(unManagedVolume.getId().toString())) {
                unManagedProtectionSet.getUnManagedVolumeIds().add(unManagedVolume.getId().toString());
            }
            // Update the fields in the UnManagedVolume to reflect RP characteristics
            String personality = Volume.PersonalityTypes.SOURCE.name();
            if (!volume.isProduction()) {
                personality = Volume.PersonalityTypes.TARGET.name();
            }
            updateCommonRPProperties(unManagedProtectionSet, unManagedVolume, personality, volume, dbClient);
            // Update other RP properties for source/targets
            // What Replication Set does this volume belong to? (so we can associate sources to targets.)
            // What is the access state.
            StringSet rpAccessState = new StringSet();
            rpAccessState.add(rpCopyAccessStateMap.get(volume.getRpCopyName()));
            unManagedVolume.putVolumeInfo(SupportedVolumeInformation.RP_ACCESS_STATE.toString(), rpAccessState);
            StringSet rsetName = new StringSet();
            rsetName.add(rset.getName());
            unManagedVolume.putVolumeInfo(SupportedVolumeInformation.RP_RSET_NAME.toString(), rsetName);
            rpWwnToNativeWwn.put(volume.getWwn(), unManagedVolume.getWwn());
            unManagedVolumesToUpdateByWwn.put(unManagedVolume.getWwn(), unManagedVolume);
        }
        // Now that we've processed all of the sources and targets, we can mark all of the target devices in the source devices.
        for (GetVolumeResponse volume : rset.getVolumes()) {
            // Only process source volumes here.
            if (!volume.isProduction()) {
                continue;
            }
            // Find this volume in UnManagedVolumes based on wwn
            // See if the unmanaged volume is in the list of volumes to update
            // (it should be, unless the backing array has not been discovered)
            UnManagedVolume unManagedVolume = null;
            String wwn = rpWwnToNativeWwn.get(volume.getWwn());
            if (wwn != null) {
                unManagedVolume = findUnManagedVolumeForWwn(wwn, dbClient, storageNativeIdPrefixes);
            }
            if (null == unManagedVolume) {
                log.info("Protection Set {} contains unknown volume: {}. Skipping.", unManagedProtectionSet.getNativeGuid(), volume.getWwn());
                continue;
            }
            log.info("Linking target volumes to source volume {}", unManagedVolume.forDisplay());
            StringSet rpTargetVolumeIds = linkTargetVolumes(unManagedProtectionSet, unManagedVolume, rset, rpWwnToNativeWwn, storageNativeIdPrefixes, dbClient);
            // Add the unmanaged target IDs to the source unmanaged volume
            unManagedVolume.putVolumeInfo(SupportedVolumeInformation.RP_UNMANAGED_TARGET_VOLUMES.toString(), rpTargetVolumeIds);
            unManagedVolumesToUpdateByWwn.put(unManagedVolume.getWwn(), unManagedVolume);
        }
    }
}
Also used : GetRSetResponse(com.emc.storageos.recoverpoint.responses.GetRSetResponse) GetVolumeResponse(com.emc.storageos.recoverpoint.responses.GetVolumeResponse) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) Volume(com.emc.storageos.db.client.model.Volume) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) StringSet(com.emc.storageos.db.client.model.StringSet)

Example 5 with GetVolumeResponse

use of com.emc.storageos.recoverpoint.responses.GetVolumeResponse in project coprhd-controller by CoprHD.

the class RPUnManagedObjectDiscoverer method linkTargetVolumes.

/**
 * Link the target volumes to the passed in source volume
 *
 * @param unManagedProtectionSet unmanaged protection set
 * @param sourceVolume RP CG source volume
 * @param rset RP CG replication set
 * @param rpWwnToNativeWwn Map of RP volume WWN to native volume WWN - required for XIO but harmless otherwise
 * @param storageNativeIdPrefixes List of XIO systems discovered in ViPR
 * @param dbClient DB client instance
 * @return rpTargetVolumeIds Set of unmanaged target volume ids for the given source volume
 */
private StringSet linkTargetVolumes(UnManagedProtectionSet unManagedProtectionSet, UnManagedVolume sourceVolume, GetRSetResponse rset, Map<String, String> rpWwnToNativeWwn, List<String> storageNativeIdPrefixes, DbClient dbClient) {
    StringSet rpTargetVolumeIds = new StringSet();
    // Find the target volumes associated with this source volume.
    for (GetVolumeResponse targetVolume : rset.getVolumes()) {
        // Find this volume in UnManagedVolumes based on wwn
        UnManagedVolume targetUnManagedVolume = null;
        String targetWwn = rpWwnToNativeWwn.get(targetVolume.getWwn());
        if (targetWwn != null) {
            targetUnManagedVolume = findUnManagedVolumeForWwn(targetWwn, dbClient, storageNativeIdPrefixes);
        }
        if (null == targetUnManagedVolume) {
            log.info("Protection Set {} contains unknown target volume: {}. Skipping.", unManagedProtectionSet.getNativeGuid(), targetVolume.getWwn());
            continue;
        }
        // Don't bother if we just re-found the source device
        if (targetUnManagedVolume.getId().equals(sourceVolume.getId())) {
            continue;
        }
        // Check if this volume is already managed, which would indicate it has already been partially ingested
        Volume targetManagedVolume = DiscoveryUtils.checkManagedVolumeExistsInDBByWwn(dbClient, targetVolume.getWwn());
        if (null != targetManagedVolume) {
            log.info("Protection Set {} has an orphaned unmanaged target volume {}. Skipping.", unManagedProtectionSet.getNativeGuid(), targetUnManagedVolume.getLabel());
            continue;
        }
        log.info("\tfound target volume {}", targetUnManagedVolume.forDisplay());
        // Add the source unmanaged volume ID to the target volume
        StringSet rpUnManagedSourceVolumeId = new StringSet();
        rpUnManagedSourceVolumeId.add(sourceVolume.getId().toString());
        targetUnManagedVolume.putVolumeInfo(SupportedVolumeInformation.RP_UNMANAGED_SOURCE_VOLUME.toString(), rpUnManagedSourceVolumeId);
        // Update the target unmanaged volume with the source managed volume ID
        unManagedVolumesToUpdateByWwn.put(targetUnManagedVolume.getWwn(), targetUnManagedVolume);
        // Store the unmanaged target ID in the source volume
        rpTargetVolumeIds.add(targetUnManagedVolume.getId().toString());
    }
    return rpTargetVolumeIds;
}
Also used : GetVolumeResponse(com.emc.storageos.recoverpoint.responses.GetVolumeResponse) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) Volume(com.emc.storageos.db.client.model.Volume) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) StringSet(com.emc.storageos.db.client.model.StringSet)

Aggregations

GetVolumeResponse (com.emc.storageos.recoverpoint.responses.GetVolumeResponse)6 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)4 Volume (com.emc.storageos.db.client.model.Volume)4 GetRSetResponse (com.emc.storageos.recoverpoint.responses.GetRSetResponse)4 GetCGsResponse (com.emc.storageos.recoverpoint.responses.GetCGsResponse)3 GetCopyResponse (com.emc.storageos.recoverpoint.responses.GetCopyResponse)3 StringSet (com.emc.storageos.db.client.model.StringSet)2 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)2 HashSet (java.util.HashSet)2 ClusterConfiguration (com.emc.fapiclient.ws.ClusterConfiguration)1 ConsistencyGroupCopySettings (com.emc.fapiclient.ws.ConsistencyGroupCopySettings)1 ConsistencyGroupCopyState (com.emc.fapiclient.ws.ConsistencyGroupCopyState)1 ConsistencyGroupLinkSettings (com.emc.fapiclient.ws.ConsistencyGroupLinkSettings)1 ConsistencyGroupSettings (com.emc.fapiclient.ws.ConsistencyGroupSettings)1 ConsistencyGroupState (com.emc.fapiclient.ws.ConsistencyGroupState)1 ConsistencyGroupUID (com.emc.fapiclient.ws.ConsistencyGroupUID)1 FullRecoverPointSettings (com.emc.fapiclient.ws.FullRecoverPointSettings)1 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)1 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)1 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)1