Search in sources :

Example 11 with VolumeIngestionContext

use of com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.VolumeIngestionContext 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)

Example 12 with VolumeIngestionContext

use of com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.VolumeIngestionContext 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 13 with VolumeIngestionContext

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

the class BlockVplexVolumeIngestOrchestrator method ingestBackendExportMasks.

/**
 * Ingests the export masks between the backend storage arrays and the
 * VPLEX for the backend storage volumes.
 *
 * Calls ingestExportMasks by getting a nested IngestStrategy
 * for each backend volume or replica from the IngestStrategyFactory.
 *
 * @param system the VPLEX storage system
 * @param vPool the virtual pool for ingestion
 * @param virtualArray the virtual array for ingestion
 * @param tenant the tenant for ingestion
 * @param unManagedVolumesToBeDeleted unmanaged volumes that will be marked for deletion
 * @param taskStatusMap a map of task statuses
 * @param context the VplexBackendIngestionContext for the parent virtual volume
 *
 * @throws IngestionException
 */
private void ingestBackendExportMasks(IngestionRequestContext requestContext, VplexVolumeIngestionContext backendRequestContext) throws IngestionException {
    // process masking for any successfully processed UnManagedVolumes
    for (Entry<String, VolumeIngestionContext> entry : backendRequestContext.getProcessedUnManagedVolumeMap().entrySet()) {
        String unManagedVolumeGUID = entry.getKey();
        VolumeIngestionContext volumeContext = entry.getValue();
        UnManagedVolume processedUnManagedVolume = volumeContext.getUnmanagedVolume();
        VirtualArray virtualArray = backendRequestContext.getVarray(processedUnManagedVolume);
        VirtualPool vPool = backendRequestContext.getVpool(processedUnManagedVolume);
        if (processedUnManagedVolume.getUnmanagedExportMasks().isEmpty()) {
            String reason = "the backend volume has no unmanaged export masks " + processedUnManagedVolume.getLabel();
            _logger.warn(reason);
            continue;
        }
        _logger.info("ingesting VPLEX backend export mask(s) for unmanaged volume " + processedUnManagedVolume);
        String createdObjectGuid = unManagedVolumeGUID.replace(VolumeIngestionUtil.UNMANAGEDVOLUME, VolumeIngestionUtil.VOLUME);
        BlockObject processedBlockObject = backendRequestContext.getBlockObjectsToBeCreatedMap().get(createdObjectGuid);
        if (processedBlockObject == null) {
            String reason = "The ingested block object is null. Skipping ingestion of export masks.";
            throw IngestionException.exceptions.generalVolumeException(processedUnManagedVolume.getLabel(), reason);
        }
        // and it will have the correct virtual array and virtual pool already set on it
        if (backendRequestContext.isDistributed()) {
            // a backend volume can only be a Volume BlockObject type, so this is safe
            Volume backendVolume = ((Volume) processedBlockObject);
            virtualArray = _dbClient.queryObject(VirtualArray.class, backendVolume.getVirtualArray());
            vPool = _dbClient.queryObject(VirtualPool.class, backendVolume.getVirtualPool());
            if (virtualArray == null) {
                throw IngestionException.exceptions.failedToIngestVplexBackend("Could not find virtual array for backend volume " + backendVolume.getLabel());
            }
            if (vPool == null) {
                throw IngestionException.exceptions.failedToIngestVplexBackend("Could not find virtual pool for backend volume " + backendVolume.getLabel());
            }
        }
        try {
            // assuming only one export mask for this volume between the backend array and VPLEX
            int uemCount = 0;
            for (String uri : processedUnManagedVolume.getUnmanagedExportMasks()) {
                if (uemCount++ > 1) {
                    _logger.warn("more than one unmanaged export mask found on this backend volume");
                }
                UnManagedExportMask uem = _dbClient.queryObject(UnManagedExportMask.class, URI.create(uri));
                _logger.info("preparing to ingest backend unmanaged export mask {}", uem.getMaskName());
                // find the associated storage system
                URI storageSystemUri = processedUnManagedVolume.getStorageSystemUri();
                StorageSystem associatedSystem = _dbClient.queryObject(StorageSystem.class, storageSystemUri);
                // collect the initiators in this backend mask
                List<URI> initUris = new ArrayList<URI>();
                for (String initUri : uem.getKnownInitiatorUris()) {
                    initUris.add(URI.create(initUri));
                }
                List<Initiator> initiators = _dbClient.queryObject(Initiator.class, initUris);
                backendRequestContext.setDeviceInitiators(initiators);
                // find or create the backend export group
                ExportGroup exportGroup = this.findOrCreateExportGroup(backendRequestContext.getRootIngestionRequestContext(), associatedSystem, initiators, virtualArray.getId(), backendRequestContext.getBackendProject().getId(), backendRequestContext.getTenant().getId(), DEFAULT_BACKEND_NUMPATHS, uem);
                if (null == exportGroup.getId()) {
                    backendRequestContext.setExportGroupCreated(true);
                    exportGroup.setId(URIUtil.createId(ExportGroup.class));
                }
                backendRequestContext.setExportGroup(exportGroup);
                // find the ingest export strategy and call into for this unmanaged export mask
                IngestExportStrategy ingestStrategy = ingestStrategyFactory.buildIngestExportStrategy(processedUnManagedVolume);
                BlockObject blockObject = ingestStrategy.ingestExportMasks(processedUnManagedVolume, processedBlockObject, backendRequestContext);
                if (null == blockObject) {
                    // ingestion did not succeed, but in case it wasn't, throw one
                    throw IngestionException.exceptions.generalVolumeException(processedUnManagedVolume.getLabel(), "check the logs for more details");
                } else {
                    backendRequestContext.getObjectsIngestedByExportProcessing().add(blockObject);
                }
                backendRequestContext.getVplexBackendExportGroupMap().put(blockObject, exportGroup);
            }
        } catch (Exception ex) {
            _logger.error(ex.getLocalizedMessage());
            throw ex;
        }
    }
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) ArrayList(java.util.ArrayList) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) PrefixConstraint(com.emc.storageos.db.client.constraint.PrefixConstraint) ExportGroup(com.emc.storageos.db.client.model.ExportGroup) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) Volume(com.emc.storageos.db.client.model.Volume) Initiator(com.emc.storageos.db.client.model.Initiator) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) RpVplexVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RpVplexVolumeIngestionContext) VplexVolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.VplexVolumeIngestionContext) VolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.VolumeIngestionContext) BlockObject(com.emc.storageos.db.client.model.BlockObject) UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 14 with VolumeIngestionContext

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

the class BaseIngestionRequestContext method findExportGroup.

/*
     * (non-Javadoc)
     * 
     * @see com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.IngestionRequestContext#findExportGroup(java.lang.
     * String)
     */
@Override
public ExportGroup findExportGroup(String exportGroupLabel, URI project, URI varray, URI computeResource, String resourceType) {
    if (exportGroupLabel != null) {
        ExportGroup localExportGroup = getExportGroup();
        if (null != localExportGroup && exportGroupLabel.equals(localExportGroup.getLabel())) {
            if (VolumeIngestionUtil.verifyExportGroupMatches(localExportGroup, exportGroupLabel, project, varray, computeResource, resourceType)) {
                _logger.info("Found existing local ExportGroup {} in base ingestion request context", localExportGroup.forDisplay());
                return localExportGroup;
            }
        }
        ExportGroup nestedExportGroup = null;
        for (VolumeIngestionContext volumeContext : getProcessedUnManagedVolumeMap().values()) {
            if (volumeContext instanceof IngestionRequestContext) {
                nestedExportGroup = ((IngestionRequestContext) volumeContext).findExportGroup(exportGroupLabel, project, varray, computeResource, resourceType);
            }
            if (null != nestedExportGroup) {
                if (VolumeIngestionUtil.verifyExportGroupMatches(nestedExportGroup, exportGroupLabel, project, varray, computeResource, resourceType)) {
                    _logger.info("Found existing nested ExportGroup {} in volume context {}", nestedExportGroup.forDisplay(), volumeContext.getUnmanagedVolume().forDisplay());
                    return nestedExportGroup;
                }
            }
        }
    }
    _logger.info("Could not find existing export group for label " + exportGroupLabel);
    return null;
}
Also used : ExportGroup(com.emc.storageos.db.client.model.ExportGroup) IngestionRequestContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.IngestionRequestContext) VolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.VolumeIngestionContext)

Example 15 with VolumeIngestionContext

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

the class RecoverPointVolumeIngestionContext method findExportGroup.

/*
     * (non-Javadoc)
     * 
     * @see com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.IngestionRequestContext#findExportGroup(java.lang.
     * String)
     */
@Override
public ExportGroup findExportGroup(String exportGroupLabel, URI project, URI varray, URI computeResource, String resourceType) {
    if (exportGroupLabel != null) {
        for (ExportGroup localExportGroup : getRpExportGroupMap().keySet()) {
            if (null != localExportGroup && exportGroupLabel.equals(localExportGroup.getLabel())) {
                if (VolumeIngestionUtil.verifyExportGroupMatches(localExportGroup, exportGroupLabel, project, varray, computeResource, resourceType)) {
                    _logger.info("Found existing local ExportGroup {} in RP ingestion request context", localExportGroup.forDisplay());
                    return localExportGroup;
                }
            }
        }
    }
    ExportGroup nestedExportGroup = null;
    for (VolumeIngestionContext volumeContext : getProcessedUnManagedVolumeMap().values()) {
        if (volumeContext instanceof IngestionRequestContext) {
            nestedExportGroup = ((IngestionRequestContext) volumeContext).findExportGroup(exportGroupLabel, project, varray, computeResource, resourceType);
        }
        if (null != nestedExportGroup) {
            if (VolumeIngestionUtil.verifyExportGroupMatches(nestedExportGroup, exportGroupLabel, project, varray, computeResource, resourceType)) {
                _logger.info("Found existing nested ExportGroup {} in volume context {}", nestedExportGroup.forDisplay(), volumeContext.getUnmanagedVolume().forDisplay());
                return nestedExportGroup;
            }
        }
    }
    _logger.info("Could not find existing export group for label " + exportGroupLabel);
    return null;
}
Also used : ExportGroup(com.emc.storageos.db.client.model.ExportGroup) IngestionRequestContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.IngestionRequestContext) VolumeIngestionContext(com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.VolumeIngestionContext)

Aggregations

VolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.VolumeIngestionContext)16 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)9 IngestionRequestContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.IngestionRequestContext)6 BlockObject (com.emc.storageos.db.client.model.BlockObject)6 DataObject (com.emc.storageos.db.client.model.DataObject)6 Volume (com.emc.storageos.db.client.model.Volume)6 RpVplexVolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RpVplexVolumeIngestionContext)5 VplexVolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.VplexVolumeIngestionContext)5 ArrayList (java.util.ArrayList)5 RecoverPointVolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.RecoverPointVolumeIngestionContext)4 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)4 URI (java.net.URI)4 BlockVolumeIngestionContext (com.emc.storageos.api.service.impl.resource.blockingestorchestration.context.impl.BlockVolumeIngestionContext)3 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)3 StringSet (com.emc.storageos.db.client.model.StringSet)3 UnManagedProtectionSet (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedProtectionSet)3 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)3 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)3 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)2 BlockSnapshotSession (com.emc.storageos.db.client.model.BlockSnapshotSession)2