Search in sources :

Example 1 with VplexCinderMaskingOrchestrator

use of com.emc.storageos.volumecontroller.impl.block.VplexCinderMaskingOrchestrator in project coprhd-controller by CoprHD.

the class VPlexBackendManager method addWorkflowStepsToAddBackendVolumes.

/**
 * Add steps to generate the Workflow to add a volume to the VPLEX backend.
 * The VNX is special, we do zoning after masking.
 * For all the other arrays, we do zoning, then masking.
 *
 * @param workflow
 * @param dependantStepId
 * @param exportGroup
 * @param exportMask
 * @param volumeMap
 * @param varrayURI
 * @param vplex
 * @param array
 * @param forgetRollbackStepId
 * @return String stepId of last added step
 */
public String addWorkflowStepsToAddBackendVolumes(Workflow workflow, String dependantStepId, ExportGroup exportGroup, ExportMask exportMask, Map<URI, Volume> volumeMap, URI varrayURI, StorageSystem vplex, StorageSystem array, String forgetRollbackStepId) {
    // Determine if VNX or OpenStack so can order VNX zoning after masking
    boolean isMaskingFirst = isMaskingFirst(array);
    boolean isOpenStack = isOpenStack(array);
    Map<URI, Integer> volumeLunIdMap = createVolumeMap(array.getId(), volumeMap);
    String zoningStep = null;
    String maskStepId = workflow.createStepId();
    String reValidateExportMaskStep = workflow.createStepId();
    ExportMaskAddVolumeCompleter createCompleter = new ExportMaskAddVolumeCompleter(exportGroup.getId(), exportMask.getId(), volumeLunIdMap, maskStepId, forgetRollbackStepId);
    List<URI> volumeList = new ArrayList<>();
    volumeList.addAll(volumeLunIdMap.keySet());
    String previousStepId = dependantStepId;
    String zoningDependentStep = ((isMaskingFirst && isOpenStack) ? reValidateExportMaskStep : ((isMaskingFirst && !isOpenStack) ? maskStepId : previousStepId));
    if (exportMask.getCreatedBySystem()) {
        _log.info(String.format("Creating zone references for Backend ExportMask %s", exportMask.getMaskName()));
        List<URI> maskURIs = Collections.singletonList(exportMask.getId());
        List<NetworkZoningParam> zoningParams = NetworkZoningParam.convertExportMasksToNetworkZoningParam(exportGroup.getId(), maskURIs, _dbClient);
        HashSet<URI> volumes = new HashSet<URI>(volumeLunIdMap.keySet());
        Workflow.Method zoneCreateMethod = _networkDeviceController.zoneExportAddVolumesMethod(exportGroup.getId(), maskURIs, volumes);
        Workflow.Method zoneDeleteMethod = _networkDeviceController.zoneExportRemoveVolumesMethod(zoningParams, volumes);
        zoningStep = workflow.createStep(ZONING_STEP, String.format("Adding zones for ExportMask %s", exportMask.getMaskName()), zoningDependentStep, nullURI, "network-system", _networkDeviceController.getClass(), zoneCreateMethod, zoneDeleteMethod, null);
        if (!isMaskingFirst) {
            previousStepId = zoningStep;
        }
    }
    // Initiators that are sent down for export validation are the known initiators.
    // For back-end VPLEX masks, I find that userAddedInitiators are not getting filled-in,
    // so we're playing it safe by using known initiators.
    List<URI> initiatorURIs = new ArrayList<>();
    if (exportMask.getInitiators() != null) {
        initiatorURIs = new ArrayList<URI>(Collections2.transform(exportMask.getInitiators(), CommonTransformerFunctions.FCTN_STRING_TO_URI));
    }
    VplexBackEndMaskingOrchestrator orca = getOrch(array);
    Workflow.Method updateMaskMethod = orca.createOrAddVolumesToExportMaskMethod(array.getId(), exportGroup.getId(), exportMask.getId(), volumeLunIdMap, initiatorURIs, createCompleter);
    Workflow.Method rollbackMaskMethod = orca.deleteOrRemoveVolumesFromExportMaskMethod(array.getId(), exportGroup.getId(), exportMask.getId(), volumeList, initiatorURIs);
    workflow.createStep(EXPORT_STEP, "createOrAddVolumesToExportMask: " + exportMask.getMaskName(), previousStepId, array.getId(), array.getSystemType(), orca.getClass(), updateMaskMethod, rollbackMaskMethod, maskStepId);
    // This is required as the export mask gets updated by reading the cinder response.
    if (isOpenStack) {
        // START - updateZoningMapAndValidateExportMask Step
        Workflow.Method updatezoningAndvalidateMaskMethod = ((VplexCinderMaskingOrchestrator) orca).updateZoningMapAndValidateExportMaskMethod(varrayURI, _initiatorPortMap, exportMask.getId(), _directorToInitiatorIds, _idToInitiatorMap, _portWwnToClusterMap, vplex, array, _cluster);
        workflow.createStep(REVALIDATE_MASK, "updatezoningAndrevalidateExportMask: " + exportMask.getMaskName(), maskStepId, array.getId(), array.getSystemType(), orca.getClass(), updatezoningAndvalidateMaskMethod, rollbackMaskMethod, reValidateExportMaskStep);
    // END - updateZoningMapAndValidateExportMask Step
    }
    _log.info(String.format("VPLEX ExportGroup %s (%s) vplex %s varray %s", exportGroup.getLabel(), exportGroup.getId(), vplex.getId(), exportGroup.getVirtualArray()));
    return (isMaskingFirst && zoningStep != null) ? zoningStep : maskStepId;
}
Also used : VplexCinderMaskingOrchestrator(com.emc.storageos.volumecontroller.impl.block.VplexCinderMaskingOrchestrator) ArrayList(java.util.ArrayList) Workflow(com.emc.storageos.workflow.Workflow) URI(java.net.URI) NetworkZoningParam(com.emc.storageos.networkcontroller.impl.NetworkZoningParam) VplexBackEndMaskingOrchestrator(com.emc.storageos.volumecontroller.impl.block.VplexBackEndMaskingOrchestrator) ExportMaskAddVolumeCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportMaskAddVolumeCompleter) HashSet(java.util.HashSet)

Aggregations

NetworkZoningParam (com.emc.storageos.networkcontroller.impl.NetworkZoningParam)1 VplexBackEndMaskingOrchestrator (com.emc.storageos.volumecontroller.impl.block.VplexBackEndMaskingOrchestrator)1 VplexCinderMaskingOrchestrator (com.emc.storageos.volumecontroller.impl.block.VplexCinderMaskingOrchestrator)1 ExportMaskAddVolumeCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportMaskAddVolumeCompleter)1 Workflow (com.emc.storageos.workflow.Workflow)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1