Search in sources :

Example 11 with UnManagedProtectionSet

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet in project coprhd-controller by CoprHD.

the class VolumeIngestionUtil method getUnManagedProtectionSetForUnManagedVolume.

/**
 * Get the unmanaged protection set corresponding to the unmanaged volume
 *
 * @param unManagedVolume the UnManagedVolume to find an UnManagedProtectionSet for
 * @param dbClient a reference to the database client
 * @return unmanaged protection set
 */
public static UnManagedProtectionSet getUnManagedProtectionSetForUnManagedVolume(IngestionRequestContext requestContext, UnManagedVolume unManagedVolume, DbClient dbClient) {
    UnManagedProtectionSet umpset = null;
    // Find the UnManagedProtectionSet associated with this unmanaged volume
    List<UnManagedProtectionSet> umpsets = CustomQueryUtility.getUnManagedProtectionSetByUnManagedVolumeId(dbClient, unManagedVolume.getId().toString());
    Iterator<UnManagedProtectionSet> umpsetsItr = umpsets.iterator();
    if (umpsetsItr.hasNext()) {
        umpset = umpsetsItr.next();
    }
    if (umpset != null) {
        UnManagedProtectionSet alreadyLoadedUmpset = requestContext.findDataObjectByType(UnManagedProtectionSet.class, umpset.getId(), false);
        if (alreadyLoadedUmpset != null) {
            umpset = alreadyLoadedUmpset;
        }
    }
    return umpset;
}
Also used : UnManagedProtectionSet(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet)

Example 12 with UnManagedProtectionSet

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet in project coprhd-controller by CoprHD.

the class BlockIngestOrchestrator method setupParentReplicaRelationships.

private void setupParentReplicaRelationships(UnManagedVolume currentUnmanagedVolume, Map<BlockObject, List<BlockObject>> parentReplicaMap, IngestionRequestContext requestContext, List<UnManagedVolume> processedUnManagedVolumes) {
    Set<DataObject> updateObjects = requestContext.getDataObjectsToBeUpdatedMap().get(currentUnmanagedVolume.getNativeGuid());
    if (updateObjects == null) {
        updateObjects = new HashSet<DataObject>();
        requestContext.getDataObjectsToBeUpdatedMap().put(currentUnmanagedVolume.getNativeGuid(), updateObjects);
    }
    String currentBlockObjectNativeGuid = currentUnmanagedVolume.getNativeGuid().replace(VolumeIngestionUtil.UNMANAGEDVOLUME, VolumeIngestionUtil.VOLUME);
    UnManagedProtectionSet umpset = null;
    boolean allRPCGVolumesIngested = true;
    boolean isParentRPVolume = false;
    for (BlockObject parent : parentReplicaMap.keySet()) {
        boolean parentIsCurrentUnManagedVolume = parent.getNativeGuid().equals(currentBlockObjectNativeGuid);
        // don't clear flags if the current block object is for the currently ingesting UnManagedvolume
        if (!parentIsCurrentUnManagedVolume) {
            VolumeIngestionUtil.clearInternalFlags(requestContext, parent, updateObjects, _dbClient);
        }
        // added to the collection of objects to be updated rather than created
        if (null == requestContext.getRootIngestionRequestContext().findCreatedBlockObject(parent.getNativeGuid())) {
            updateObjects.add(parent);
        }
        UnManagedVolume parentRPUmVolume = VolumeIngestionUtil.getRPUnmanagedVolume(parent, _dbClient);
        isParentRPVolume = parentRPUmVolume != null;
        // if its RP volume, then check whether the RP CG is fully ingested.
        if (isParentRPVolume && !parentIsCurrentUnManagedVolume) {
            List<UnManagedVolume> ingestedUnManagedVolumes = requestContext.findAllUnManagedVolumesToBeDeleted();
            ingestedUnManagedVolumes.add(parentRPUmVolume);
            umpset = VolumeIngestionUtil.getUnManagedProtectionSetForUnManagedVolume(requestContext, parentRPUmVolume, _dbClient);
            // has already been ingested. In this case, try to get it from the managed volume
            if (umpset == null) {
                BlockObject parentRPVolume = VolumeIngestionUtil.getRPVolume(requestContext, parent, _dbClient);
                umpset = VolumeIngestionUtil.getUnManagedProtectionSetForManagedVolume(requestContext, parentRPVolume, _dbClient);
            }
            allRPCGVolumesIngested = VolumeIngestionUtil.validateAllVolumesInCGIngested(ingestedUnManagedVolumes, umpset, requestContext, _dbClient);
            // If not fully ingested, mark the volume as internal. This will be marked visible when the RP CG is ingested
            if (!allRPCGVolumesIngested) {
                parent.addInternalFlags(INTERNAL_VOLUME_FLAGS);
            }
        }
        for (BlockObject replica : parentReplicaMap.get(parent)) {
            if (replica instanceof BlockMirror) {
                VolumeIngestionUtil.setupMirrorParentRelations(replica, parent, _dbClient);
            } else if (replica instanceof Volume) {
                if (isSRDFTargetVolume(replica, processedUnManagedVolumes)) {
                    VolumeIngestionUtil.setupSRDFParentRelations(replica, parent, _dbClient);
                } else if (VolumeIngestionUtil.isVplexVolume(parent, _dbClient)) {
                    if (parent instanceof Volume) {
                        StringSet associatedVolumes = ((Volume) parent).getAssociatedVolumes();
                        if (associatedVolumes != null && associatedVolumes.contains(replica.getId().toString())) {
                            _logger.info("associated volume {} of {} has already been ingested", replica.forDisplay(), parent.forDisplay());
                        } else if (VolumeIngestionUtil.isVplexBackendVolume(replica, _dbClient)) {
                            VolumeIngestionUtil.setupVplexParentRelations(replica, parent, _dbClient);
                        }
                    }
                } else {
                    VolumeIngestionUtil.setupCloneParentRelations(replica, parent, _dbClient);
                }
            } else if (replica instanceof BlockSnapshot) {
                VolumeIngestionUtil.setupSnapParentRelations(replica, parent, _dbClient);
            }
            // don't clear flags if the current block object is for the currently ingesting UnManagedvolume
            if (!replica.getNativeGuid().equals(currentBlockObjectNativeGuid)) {
                VolumeIngestionUtil.clearInternalFlags(requestContext, replica, updateObjects, _dbClient);
            }
            // Snaps/mirror/clones of RP volumes should be made visible only after the RP CG has been fully ingested.
            if (isParentRPVolume && !allRPCGVolumesIngested) {
                replica.addInternalFlags(INTERNAL_VOLUME_FLAGS);
            }
            if (null == requestContext.findCreatedBlockObject(replica.getNativeGuid())) {
                updateObjects.add(replica);
            }
        }
    }
    // If RP volume and fully ingested, set up the RP CG
    if (isParentRPVolume && allRPCGVolumesIngested && umpset != null) {
        VolumeIngestionUtil.validateRPVolumesAlignWithIngestVpool(requestContext, umpset, _dbClient);
        VolumeIngestionUtil.setupRPCG(requestContext, umpset, currentUnmanagedVolume, updateObjects, _dbClient);
    }
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) UnManagedProtectionSet(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet) DataObject(com.emc.storageos.db.client.model.DataObject) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject) 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) BlockObject(com.emc.storageos.db.client.model.BlockObject)

Example 13 with UnManagedProtectionSet

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet in project coprhd-controller by CoprHD.

the class BlockRecoverPointIngestOrchestrator method getRPIngestionStatus.

/**
 * This method will assemble a status printout of the ingestion progress for this protection set.
 *
 * @param volumeContext context information
 *
 * @return String status (multi-line, formatted)
 */
private String getRPIngestionStatus(RecoverPointVolumeIngestionContext volumeContext) {
    StringBuffer sb = new StringBuffer();
    UnManagedProtectionSet umpset = volumeContext.getUnManagedProtectionSet();
    sb.append("\nRecoverPoint Ingestion Progress Report\n");
    sb.append("--------------------------------------\n");
    sb.append("RP CG Name:        " + umpset.getCgName() + "\n");
    if (umpset.getProtectionSystemUri() != null) {
        ProtectionSystem ps = _dbClient.queryObject(ProtectionSystem.class, umpset.getProtectionSystemUri());
        sb.append("Protection System: " + ps.getLabel() + " [" + ps.getIpAddress() + "]");
    }
    // Keep track of the column widths
    Map<Integer, Integer> columnWidthMap = new HashMap<Integer, Integer>();
    for (int column = 0; column < ColumnEnum.map.keySet().size(); column++) {
        columnWidthMap.put(column, ColumnEnum.valueOf(column).toString().length());
    }
    if (!umpset.getManagedVolumeIds().isEmpty()) {
        List<Volume> volumes = new ArrayList<Volume>();
        sb.append("\n\nIngested Volumes:\n");
        for (URI volumeId : URIUtil.toURIList(umpset.getManagedVolumeIds())) {
            Volume volume = null;
            BlockObject bo = volumeContext.getRootIngestionRequestContext().findCreatedBlockObject(volumeId);
            if (bo != null && bo instanceof Volume) {
                volume = (Volume) bo;
            }
            if (volume != null) {
                volumes.add(volume);
            } else {
                continue;
            }
            // Name, ID, Personality, copy name, rset name, varray name, vpool name
            if (volume.getLabel() != null && columnWidthMap.get(ColumnEnum.NAME.getColumnNum()) < volume.getLabel().length()) {
                columnWidthMap.put(ColumnEnum.NAME.getColumnNum(), volume.getLabel().length());
            }
            if (volume.getId() != null && columnWidthMap.get(ColumnEnum.ID.getColumnNum()) < volume.getId().toString().length()) {
                columnWidthMap.put(ColumnEnum.ID.getColumnNum(), volume.getId().toString().length());
            }
            if (volume.getPersonality() != null && columnWidthMap.get(ColumnEnum.PERSONALITY.getColumnNum()) < volume.getPersonality().length()) {
                columnWidthMap.put(ColumnEnum.PERSONALITY.getColumnNum(), volume.getPersonality().length());
            }
            if (volume.getRpCopyName() != null && columnWidthMap.get(ColumnEnum.COPY_NAME.getColumnNum()) < volume.getRpCopyName().length()) {
                columnWidthMap.put(ColumnEnum.COPY_NAME.getColumnNum(), volume.getRpCopyName().length());
            }
            if (volume.getRSetName() != null && columnWidthMap.get(ColumnEnum.RSET_NAME.getColumnNum()) < volume.getRSetName().length()) {
                columnWidthMap.put(ColumnEnum.RSET_NAME.getColumnNum(), volume.getRSetName().length());
            }
            if (volume.getVirtualArray() != null) {
                VirtualArray vArray = _dbClient.queryObject(VirtualArray.class, volume.getVirtualArray());
                if (vArray != null && vArray.getLabel() != null && columnWidthMap.get(ColumnEnum.RSET_NAME.getColumnNum()) < vArray.getLabel().length()) {
                    columnWidthMap.put(ColumnEnum.VARRAY.getColumnNum(), vArray.getLabel().length());
                }
            }
            if (volume.getVirtualPool() != null) {
                VirtualPool vPool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
                if (vPool != null && vPool.getLabel() != null && columnWidthMap.get(ColumnEnum.RSET_NAME.getColumnNum()) < vPool.getLabel().length()) {
                    columnWidthMap.put(ColumnEnum.VPOOL.getColumnNum(), vPool.getLabel().length());
                }
            }
        }
        StringBuffer widthFormat = new StringBuffer();
        for (int column = 0; column < ColumnEnum.map.keySet().size(); column++) {
            StringBuffer formatBuf = new StringBuffer();
            formatBuf.append("%");
            formatBuf.append(String.format("%d", columnWidthMap.get(column)));
            formatBuf.append("s ");
            sb.append(String.format(formatBuf.toString(), ColumnEnum.valueOf(column).name()));
            widthFormat.append(formatBuf.toString());
        }
        sb.append("\n");
        widthFormat.append("\n");
        // Now actually print the values
        for (Volume volume : volumes) {
            String vArrayLabel = LABEL_NA;
            String vPoolLabel = LABEL_NA;
            if (volume.getVirtualArray() != null) {
                VirtualArray vArray = _dbClient.queryObject(VirtualArray.class, volume.getVirtualArray());
                vArrayLabel = vArray.getLabel();
            }
            if (volume.getVirtualPool() != null) {
                VirtualPool vPool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
                vPoolLabel = vPool.getLabel();
            }
            sb.append(String.format(widthFormat.toString(), volume.getLabel() != null ? volume.getLabel() : LABEL_NA, volume.getId() != null ? volume.getId() : LABEL_NA, volume.getPersonality() != null ? volume.getPersonality() : LABEL_NA, volume.getRpCopyName() != null ? volume.getRpCopyName() : LABEL_NA, volume.getRSetName() != null ? volume.getRSetName() : LABEL_NA, vArrayLabel, vPoolLabel));
        }
    }
    // Keep track of the column widths
    columnWidthMap.clear();
    for (int column = 0; column < ColumnEnum.map.keySet().size(); column++) {
        columnWidthMap.put(column, ColumnEnum.valueOf(column).toString().length());
    }
    if (!umpset.getUnManagedVolumeIds().isEmpty()) {
        sb.append("\nUningested Volumes:\n");
        List<UnManagedVolume> volumes = _dbClient.queryObject(UnManagedVolume.class, URIUtil.toURIList(umpset.getUnManagedVolumeIds()));
        for (UnManagedVolume volume : volumes) {
            // Name, ID, Personality, copy name, rset name, varray name, vpool name
            if (volume.getLabel() != null && columnWidthMap.get(ColumnEnum.NAME.getColumnNum()) < volume.getLabel().length()) {
                columnWidthMap.put(ColumnEnum.NAME.getColumnNum(), volume.getLabel().length());
            }
            if (volume.getId() != null && columnWidthMap.get(ColumnEnum.ID.getColumnNum()) < volume.getId().toString().length()) {
                columnWidthMap.put(ColumnEnum.ID.getColumnNum(), volume.getId().toString().length());
            }
            String personality = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.RP_PERSONALITY.toString(), volume.getVolumeInformation());
            if (personality != null && columnWidthMap.get(ColumnEnum.PERSONALITY.getColumnNum()) < personality.length()) {
                columnWidthMap.put(ColumnEnum.PERSONALITY.getColumnNum(), personality.length());
            }
            String rpCopyName = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.RP_COPY_NAME.toString(), volume.getVolumeInformation());
            if (rpCopyName != null && columnWidthMap.get(ColumnEnum.COPY_NAME.getColumnNum()) < rpCopyName.length()) {
                columnWidthMap.put(ColumnEnum.COPY_NAME.getColumnNum(), rpCopyName.length());
            }
            String rsetName = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.RP_RSET_NAME.toString(), volume.getVolumeInformation());
            if (rsetName != null && columnWidthMap.get(ColumnEnum.RSET_NAME.getColumnNum()) < rsetName.length()) {
                columnWidthMap.put(ColumnEnum.RSET_NAME.getColumnNum(), rsetName.length());
            }
            columnWidthMap.put(ColumnEnum.VARRAY.getColumnNum(), ColumnEnum.VARRAY.name().length());
            columnWidthMap.put(ColumnEnum.VPOOL.getColumnNum(), ColumnEnum.VPOOL.name().length());
        }
        StringBuffer widthFormat = new StringBuffer();
        for (int column = 0; column < ColumnEnum.map.keySet().size(); column++) {
            StringBuffer formatBuf = new StringBuffer();
            formatBuf.append("%");
            formatBuf.append(String.format("%d", columnWidthMap.get(column)));
            formatBuf.append("s ");
            sb.append(String.format(formatBuf.toString(), ColumnEnum.valueOf(column).name()));
            widthFormat.append(formatBuf.toString());
        }
        sb.append("\n");
        widthFormat.append("\n");
        // Now actually print the values
        for (UnManagedVolume volume : volumes) {
            String vArrayLabel = LABEL_NA;
            String vPoolLabel = LABEL_NA;
            String personality = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.RP_PERSONALITY.toString(), volume.getVolumeInformation());
            String rpCopyName = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.RP_COPY_NAME.toString(), volume.getVolumeInformation());
            String rsetName = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.RP_RSET_NAME.toString(), volume.getVolumeInformation());
            sb.append(String.format(widthFormat.toString(), volume.getLabel() != null ? volume.getLabel() : LABEL_NA, volume.getId() != null ? volume.getId() : LABEL_NA, personality != null ? personality : LABEL_NA, rpCopyName != null ? rpCopyName : LABEL_NA, rsetName != null ? rsetName : LABEL_NA, vArrayLabel, vPoolLabel));
        }
    }
    return sb.toString();
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) UnManagedProtectionSet(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) URI(java.net.URI) 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) BlockObject(com.emc.storageos.db.client.model.BlockObject)

Example 14 with UnManagedProtectionSet

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet in project coprhd-controller by CoprHD.

the class BlockRecoverPointIngestOrchestrator method ingestBlockObjects.

@Override
public <T extends BlockObject> T ingestBlockObjects(IngestionRequestContext parentRequestContext, Class<T> clazz) throws IngestionException {
    if (parentRequestContext == null) {
        _logger.error("Parent request context is null.  Failing ingestion operation");
        throw IngestionException.exceptions.couldNotCreateVolume("Parent request context is null");
    }
    RecoverPointVolumeIngestionContext volumeContext = (RecoverPointVolumeIngestionContext) parentRequestContext.getVolumeContext();
    UnManagedVolume unManagedVolume = volumeContext.getUnmanagedVolume();
    // Validation checks on the unmanaged volume we're trying to ingest
    validateUnManagedVolumeProperties(unManagedVolume, volumeContext.getVarray(unManagedVolume), volumeContext.getVpool(unManagedVolume), volumeContext.getProject());
    BlockObject blockObject = volumeContext.getManagedBlockObject();
    // This ingestion orchestrator only deals with Volume objects. (snapshots, mirrors, clones aren't protected by RP)
    if (blockObject != null && !(blockObject instanceof Volume)) {
        _logger.error("Ingesting a non-volume object in RecoverPoint is not allowed: " + blockObject.getId().toString());
        throw IngestionException.exceptions.rpIngestingNonVolumeObject(unManagedVolume.getNativeGuid());
    }
    // Make sure there's an unmanaged protection set
    UnManagedProtectionSet umpset = volumeContext.getUnManagedProtectionSet();
    // Make sure there's an unmanaged protection set, and validate it
    if (umpset == null) {
        _logger.warn("No unmanaged protection set could be found for unmanaged volume: " + volumeContext.getUnmanagedVolume().getNativeGuid() + " Please run unmanaged CG discovery of registered protection system");
        throw IngestionException.exceptions.unManagedProtectionSetNotFound(volumeContext.getUnmanagedVolume().getNativeGuid());
    }
    validateUnmanagedProtectionSet(volumeContext.getVpool(unManagedVolume), unManagedVolume, umpset);
    // Test ingestion status message
    _logger.info("Printing Ingestion Report before Ingestion Attempt");
    _logger.info(getRPIngestionStatus(volumeContext));
    Volume volume = (Volume) blockObject;
    boolean unManagedVolumeExported = VolumeIngestionUtil.checkUnManagedResourceIsNonRPExported(unManagedVolume) && !unManagedVolume.getUnmanagedExportMasks().isEmpty();
    if (isExportIngestionPending(volume, unManagedVolume.getId(), unManagedVolumeExported)) {
        _logger.info("Volume {} has already been ingested for RecoverPoint, but is still exported via UnManagedExportMasks: {}", volume.forDisplay(), unManagedVolume.getUnmanagedExportMasks());
        return clazz.cast(volume);
    }
    // Perform RP-specific volume ingestion
    volume = performRPVolumeIngestion(parentRequestContext, volumeContext, unManagedVolume, volume);
    // Decorate volume with RP Properties.
    decorateVolumeWithRPProperties(volumeContext, volume, unManagedVolume);
    // Update the unmanaged protection set
    decorateUnManagedProtectionSet(volumeContext, volume, unManagedVolume);
    // Perform RP-specific export ingestion
    performRPExportIngestion(parentRequestContext, volumeContext, unManagedVolume, volume);
    // Print post-ingestion report
    _logger.info("Printing Ingestion Report After Ingestion");
    _logger.info(getRPIngestionStatus(volumeContext));
    // Otherwise check after the export masks are ingested.
    if (!volumeContext.isVolumeExported()) {
        // Create the managed protection set/CG objects when we have all of the volumes ingested
        if (validateAllVolumesInCGIngested(parentRequestContext, volumeContext, unManagedVolume)) {
            _logger.info("Successfully ingested all volumes associated with RP consistency group");
            VolumeIngestionUtil.validateRPVolumesAlignWithIngestVpool(parentRequestContext, umpset, _dbClient);
            createProtectionSet(volumeContext);
            BlockConsistencyGroup bcg = createBlockConsistencyGroup(volumeContext);
            volumeContext.getCGObjectsToCreateMap().put(bcg.getId().toString(), bcg);
            // Once we have a proper managed consistency group and protection set, we need to
            // sprinkle those references over the managed volumes.
            decorateVolumeInformationFinalIngest(volumeContext, unManagedVolume);
        } else {
            // Add internal flags
            volume.addInternalFlags(INTERNAL_VOLUME_FLAGS);
        }
    }
    return clazz.cast(volume);
}
Also used : 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) RecoverPointVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RecoverPointVolumeIngestionContext) UnManagedProtectionSet(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet) BlockObject(com.emc.storageos.db.client.model.BlockObject) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup)

Example 15 with UnManagedProtectionSet

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet in project coprhd-controller by CoprHD.

the class RecoverPointVolumeIngestionContext method getUnManagedProtectionSet.

/**
 * Returns the UnManagedProtectionSet for this UnManagedVolume, or null
 * if none could be found.
 *
 * @return the UnManagedProtectionSet for this UnManagedVolume
 */
public UnManagedProtectionSet getUnManagedProtectionSet() {
    if (_unManagedProtectionSet != null) {
        return _unManagedProtectionSet;
    }
    // Find the UnManagedProtectionSet associated with this unmanaged volume
    UnManagedProtectionSet umpset = VolumeIngestionUtil.getUnManagedProtectionSetForUnManagedVolume(this, getUnmanagedVolume(), _dbClient);
    if (umpset != null) {
        _unManagedProtectionSet = umpset;
        return _unManagedProtectionSet;
    }
    // It is possible that the unmanaged volume was already ingested in which case the ingested block object will be part of the
    // unmanaged protection set's managed volumes list.
    String managedVolumeNativeGUID = getUnmanagedVolume().getNativeGuid().replace(VolumeIngestionUtil.UNMANAGEDVOLUME, VolumeIngestionUtil.VOLUME);
    BlockObject managedVolume = VolumeIngestionUtil.getBlockObject(managedVolumeNativeGUID, _dbClient);
    if (managedVolume != null) {
        umpset = VolumeIngestionUtil.getUnManagedProtectionSetForManagedVolume(this, managedVolume, _dbClient);
    }
    if (umpset == null) {
        _logger.error("Unable to find unmanaged protection set associated with volume: " + getUnmanagedVolume().getId());
        // caller will throw exception
        return null;
    }
    _unManagedProtectionSet = umpset;
    return _unManagedProtectionSet;
}
Also used : UnManagedProtectionSet(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet) BlockObject(com.emc.storageos.db.client.model.BlockObject)

Aggregations

UnManagedProtectionSet (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet)17 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)10 BlockObject (com.emc.storageos.db.client.model.BlockObject)8 DataObject (com.emc.storageos.db.client.model.DataObject)6 ProtectionSet (com.emc.storageos.db.client.model.ProtectionSet)6 Volume (com.emc.storageos.db.client.model.Volume)6 StringSet (com.emc.storageos.db.client.model.StringSet)5 URI (java.net.URI)5 ArrayList (java.util.ArrayList)5 RecoverPointVolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RecoverPointVolumeIngestionContext)3 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)3 HashMap (java.util.HashMap)3 VolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.VolumeIngestionContext)2 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)2 ProtectionSystem (com.emc.storageos.db.client.model.ProtectionSystem)2 IngestionRequestContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.IngestionRequestContext)1 BlockVolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.BlockVolumeIngestionContext)1 AbstractChangeTrackingSet (com.emc.storageos.db.client.model.AbstractChangeTrackingSet)1 BlockMirror (com.emc.storageos.db.client.model.BlockMirror)1 DiscoveredDataObject (com.emc.storageos.db.client.model.DiscoveredDataObject)1