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);
}
}
}
}
}
}
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;
}
Aggregations