Search in sources :

Example 6 with VplexVolumeIngestionContext

use of com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.VplexVolumeIngestionContext in project coprhd-controller by CoprHD.

the class BlockRecoverPointIngestOrchestrator method clearReplicaFlagsInIngestionContext.

/**
 * Clear the flags of replicas which have been updated during the ingestion process
 *
 * @param volumeContext
 * @param volumes RP volumes
 */
private void clearReplicaFlagsInIngestionContext(RecoverPointVolumeIngestionContext volumeContext, List<Volume> volumes) {
    for (Set<DataObject> updatedObjects : volumeContext.getDataObjectsToBeUpdatedMap().values()) {
        for (DataObject updatedObject : updatedObjects) {
            if (updatedObject instanceof BlockMirror || updatedObject instanceof BlockSnapshot || updatedObject instanceof BlockSnapshotSession || (updatedObject instanceof Volume && !NullColumnValueGetter.isNullURI(((Volume) updatedObject).getAssociatedSourceVolume()))) {
                _logger.info("Clearing internal volume flag of replica {} of RP volume ", updatedObject.getLabel());
                updatedObject.clearInternalFlags(INTERNAL_VOLUME_FLAGS);
            }
        }
    }
    // We need to look for all snapshots and snapshot session in the contexts related to the rp volumes and its backend volumes and
    // clear their flags.
    List<String> rpVolumes = new ArrayList<String>();
    for (Volume volume : volumes) {
        rpVolumes.add(volume.getId().toString());
        if (RPHelper.isVPlexVolume(volume, _dbClient) && volumeContext instanceof RpVplexVolumeIngestionContext) {
            VplexVolumeIngestionContext vplexVolumeContext = ((RpVplexVolumeIngestionContext) volumeContext.getVolumeContext()).getVplexVolumeIngestionContext();
            StringSet associatedVolumes = vplexVolumeContext.getAssociatedVolumeIds(volume);
            rpVolumes.addAll(associatedVolumes);
        }
    }
    for (VolumeIngestionContext volumeIngestionContext : volumeContext.getRootIngestionRequestContext().getProcessedUnManagedVolumeMap().values()) {
        if (volumeIngestionContext instanceof IngestionRequestContext) {
            for (Set<DataObject> objectsToBeUpdated : ((IngestionRequestContext) volumeIngestionContext).getDataObjectsToBeUpdatedMap().values()) {
                for (DataObject o : objectsToBeUpdated) {
                    if (o instanceof BlockSnapshot && rpVolumes.contains(((BlockSnapshot) o).getParent().getURI().toString())) {
                        _logger.info("Clearing internal volume flag of BlockSnapshot {} of RP volume ", o.getLabel());
                        o.clearInternalFlags(INTERNAL_VOLUME_FLAGS);
                    } else if (o instanceof BlockSnapshotSession && rpVolumes.contains(((BlockSnapshotSession) o).getParent().getURI().toString())) {
                        _logger.info("Clearing internal volume flag of BlockSnapshotSession {} of RP volume ", o.getLabel());
                        o.clearInternalFlags(INTERNAL_VOLUME_FLAGS);
                    }
                }
            }
        }
    }
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) BlockSnapshotSession(com.emc.storageos.db.client.model.BlockSnapshotSession) VplexVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.VplexVolumeIngestionContext) RpVplexVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RpVplexVolumeIngestionContext) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) ArrayList(java.util.ArrayList) DataObject(com.emc.storageos.db.client.model.DataObject) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) Volume(com.emc.storageos.db.client.model.Volume) IngestionRequestContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.IngestionRequestContext) StringSet(com.emc.storageos.db.client.model.StringSet) RpVplexVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RpVplexVolumeIngestionContext) VplexVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.VplexVolumeIngestionContext) RecoverPointVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RecoverPointVolumeIngestionContext) VolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.VolumeIngestionContext) RpVplexVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RpVplexVolumeIngestionContext)

Example 7 with VplexVolumeIngestionContext

use of com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.VplexVolumeIngestionContext in project coprhd-controller by CoprHD.

the class VolumeIngestionUtil method validateExportMaskMatchesVplexCluster.

/**
 * Validates that the given UnManagedExportMask exists on the same VPLEX Cluster
 * as the VirtualArray in the ingestion request. The cluster name is actually
 * set by the BlockVplexIngestOrchestrator in order to re-use the cluster-id-to-name
 * cache, avoiding a expensive call to get cluster name info from the VPLEX API.
 *
 * @param requestContext the current IngestionRequestContext
 * @param unManagedVolume the current UnManagedVolume being processed for exports
 * @param unManagedExportMask the current UnManagdExportMask being processed
 *
 * @return true if the mask exists on the same VPLEX cluster as the ingestion request VirtualArray
 */
public static boolean validateExportMaskMatchesVplexCluster(IngestionRequestContext requestContext, UnManagedVolume unManagedVolume, UnManagedExportMask unManagedExportMask) {
    VolumeIngestionContext volumeContext = requestContext.getRootIngestionRequestContext().getProcessedVolumeContext(unManagedVolume.getNativeGuid());
    if (volumeContext == null) {
        // just get the current one
        volumeContext = requestContext.getVolumeContext();
    }
    if (volumeContext != null && volumeContext instanceof RpVplexVolumeIngestionContext) {
        volumeContext = ((RpVplexVolumeIngestionContext) volumeContext).getVplexVolumeIngestionContext();
    }
    if (volumeContext != null && volumeContext instanceof VplexVolumeIngestionContext) {
        String clusterName = ((VplexVolumeIngestionContext) volumeContext).getVirtualVolumeVplexClusterName();
        String maskingViewPath = unManagedExportMask.getMaskingViewPath();
        _logger.info("cluster name is {} and masking view path is {}", clusterName, maskingViewPath);
        if (clusterName != null && maskingViewPath != null) {
            String startOfPath = VPlexApiConstants.URI_CLUSTERS_RELATIVE + clusterName;
            // for this ingestion request) overlaps the masking view path, then we are on the right vplex cluster
            if (maskingViewPath.startsWith(startOfPath)) {
                _logger.info("\tUnManagedExportMask {} is on VPLEX cluster {} and will be processed now", unManagedExportMask.getMaskName(), clusterName);
                return true;
            }
        }
    }
    _logger.warn("\tUnManagedExportMask {} is not on the right VPLEX cluster for this ingestion request", unManagedExportMask.getMaskName());
    return false;
}
Also used : VplexVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.VplexVolumeIngestionContext) RpVplexVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RpVplexVolumeIngestionContext) RpVplexVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RpVplexVolumeIngestionContext) VplexVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.VplexVolumeIngestionContext) RpVplexVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RpVplexVolumeIngestionContext) BlockVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.BlockVolumeIngestionContext) RecoverPointVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RecoverPointVolumeIngestionContext) VolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.VolumeIngestionContext)

Aggregations

VplexVolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.VplexVolumeIngestionContext)7 RpVplexVolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RpVplexVolumeIngestionContext)6 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)6 Volume (com.emc.storageos.db.client.model.Volume)6 ArrayList (java.util.ArrayList)4 VolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.VolumeIngestionContext)3 BlockObject (com.emc.storageos.db.client.model.BlockObject)3 Project (com.emc.storageos.db.client.model.Project)3 StringSet (com.emc.storageos.db.client.model.StringSet)3 RecoverPointVolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RecoverPointVolumeIngestionContext)2 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)2 BlockSnapshotSession (com.emc.storageos.db.client.model.BlockSnapshotSession)2 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)2 Initiator (com.emc.storageos.db.client.model.Initiator)2 NamedURI (com.emc.storageos.db.client.model.NamedURI)2 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 UnManagedExportMask (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)2 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)2 URI (java.net.URI)2 IngestionRequestContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.IngestionRequestContext)1