Search in sources :

Example 31 with ExportTaskCompleter

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

the class ExportWorkflowUtils method generateZoningAddPathsWorkflow.

/**
 * Generate workflow step for add path zoning
 *
 * @param workflow -- workflow step to be added to
 * @param wfGroupId -- worflow group id
 * @param storageURI -- Storage System URI
 * @param exportGroupURI -- Export Group URI
 * @param adjustedPaths - The paths going to be added and/or retained
 * @param waitFor -- wait for this previous step
 * @return stepId that was generated
 * @throws ControllerException
 */
public String generateZoningAddPathsWorkflow(Workflow workflow, String wfGroupId, URI systemURI, URI exportGroupURI, Map<URI, Map<URI, List<URI>>> exportMaskNewPathsMap, Map<URI, List<URI>> newPaths, String waitFor) throws ControllerException {
    String zoningStep = workflow.createStepId();
    ExportTaskCompleter taskCompleter = new ZoningAddPathsCompleter(exportGroupURI, zoningStep, exportMaskNewPathsMap);
    List<URI> maskURIs = new ArrayList<URI>(exportMaskNewPathsMap.keySet());
    Workflow.Method zoningExecuteMethod = networkDeviceController.zoneExportAddPathsMethod(systemURI, exportGroupURI, maskURIs, newPaths, taskCompleter);
    zoningStep = workflow.createStep(wfGroupId, "Zoning add paths subtask: " + exportGroupURI, waitFor, NullColumnValueGetter.getNullURI(), "network-system", networkDeviceController.getClass(), zoningExecuteMethod, null, zoningStep);
    return zoningStep;
}
Also used : ExportTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter) ArrayList(java.util.ArrayList) Workflow(com.emc.storageos.workflow.Workflow) URI(java.net.URI) ZoningAddPathsCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ZoningAddPathsCompleter)

Example 32 with ExportTaskCompleter

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

the class HDSMaskingOrchestrator method generateWorkflowStepToToRemoveVolumesFromExportMask.

/**
 * Generates workflow step to remove volumes from ExportMask.
 *
 * @param workflow
 * @param previousStep
 * @param exportGroup
 * @param exportMask
 * @param completer
 * @return
 */
public String generateWorkflowStepToToRemoveVolumesFromExportMask(Workflow workflow, String previousStep, ExportGroup exportGroup, ExportMask exportMask, List<URI> volumesToRemove, ExportTaskCompleter completer) {
    URI exportGroupURI = exportGroup.getId();
    String stepId = workflow.createStepId();
    ExportTaskCompleter exportTaskCompleter;
    if (completer != null) {
        exportTaskCompleter = completer;
        exportTaskCompleter.setOpId(stepId);
    } else {
        exportTaskCompleter = new ExportMaskRemoveVolumeCompleter(exportGroupURI, exportMask.getId(), volumesToRemove, stepId);
    }
    Workflow.Method removeVolumesFromExportMaskExecuteMethod = new Workflow.Method("doExportGroupToCleanVolumesInExportMask", exportGroupURI, exportMask.getId(), volumesToRemove, exportTaskCompleter);
    stepId = workflow.createStep(EXPORT_MASK_CLEANUP_TASK, String.format("ExportMask to removeVolumes %s (%s)", exportMask.getMaskName(), exportMask.getId().toString()), previousStep, NullColumnValueGetter.getNullURI(), "storage-system", MaskingWorkflowEntryPoints.class, removeVolumesFromExportMaskExecuteMethod, null, stepId);
    return stepId;
}
Also used : ExportTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter) Workflow(com.emc.storageos.workflow.Workflow) URI(java.net.URI) ExportMaskRemoveVolumeCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportMaskRemoveVolumeCompleter) HDSExportMaskRemoveVolumeCompleter(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSExportMaskRemoveVolumeCompleter)

Example 33 with ExportTaskCompleter

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

the class HDSMaskingOrchestrator method generateWorkflowStepToMarkExportMaskInActive.

/**
 * Generates workflow step to Mark ExportMask inActive.
 *
 * @param workflow
 * @param previousStep
 * @param exportGroup
 * @param exportMask
 * @param completer
 * @return
 */
public String generateWorkflowStepToMarkExportMaskInActive(Workflow workflow, String previousStep, ExportGroup exportGroup, ExportMask exportMask, ExportTaskCompleter completer) {
    URI exportGroupURI = exportGroup.getId();
    String stepId = workflow.createStepId();
    ExportTaskCompleter exportTaskCompleter;
    if (completer != null) {
        exportTaskCompleter = completer;
        exportTaskCompleter.setOpId(stepId);
    } else {
        exportTaskCompleter = new ExportMaskDeleteCompleter(exportGroupURI, exportMask.getId(), stepId);
    }
    Workflow.Method markExportMaskInActiveExecuteMethod = new Workflow.Method("doExportGroupToCleanExportMask", exportGroupURI, exportMask.getId(), exportTaskCompleter);
    stepId = workflow.createStep(EXPORT_MASK_CLEANUP_TASK, String.format("Marking exportmasks to inactive %s (%s)", exportMask.getMaskName(), exportMask.getId().toString()), previousStep, NullColumnValueGetter.getNullURI(), "storage-system", MaskingWorkflowEntryPoints.class, markExportMaskInActiveExecuteMethod, null, stepId);
    return stepId;
}
Also used : ExportTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter) Workflow(com.emc.storageos.workflow.Workflow) URI(java.net.URI) HDSExportMaskDeleteCompleter(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSExportMaskDeleteCompleter) ExportMaskDeleteCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportMaskDeleteCompleter)

Example 34 with ExportTaskCompleter

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

the class MaskingWorkflowEntryPoints method rollbackExportGroupAddInitiators.

/**
 * Rollback entry point. This is a wrapper around the exportRemoveInitiators
 * operation, which requires that we create a specific completer using the token
 * that's passed in. This token is generated by the rollback processing.
 *
 * @param storageURI
 *            [in] - StorageSystem URI
 * @param exportGroupURI
 *            [in] - ExportGroup URI
 * @param exportMaskURI
 *            [in] - ExportMask URI
 * @param volumeURIs
 *            [in] - Impacted volume URIs
 * @param initiatorURIs
 *            [in] - List of Initiator URIs
 * @param contextKey
 *            [in] - context token
 * @param token
 *            [in] - String token generated by the rollback processing
 * @throws ControllerException
 */
public void rollbackExportGroupAddInitiators(URI storageURI, URI exportGroupURI, URI exportMaskURI, List<URI> volumeURIs, List<URI> initiatorURIs, String contextKey, String token) throws ControllerException {
    ExportTaskCompleter taskCompleter = new ExportMaskRemoveInitiatorCompleter(exportGroupURI, exportMaskURI, initiatorURIs, token);
    try {
        ExportOperationContext context = (ExportOperationContext) WorkflowService.getInstance().loadStepData(contextKey);
        WorkflowService.getInstance().storeStepData(token, context);
    } catch (ClassCastException e) {
        _log.info("Step {} has stored step data other than ExportOperationContext. Exception: {}", token, e);
    }
    doExportGroupRemoveInitiators(storageURI, exportGroupURI, exportMaskURI, volumeURIs, initiatorURIs, true, taskCompleter, token);
}
Also used : ExportTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter) ExportOperationContext(com.emc.storageos.volumecontroller.impl.utils.ExportOperationContext) ExportMaskRemoveInitiatorCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportMaskRemoveInitiatorCompleter)

Example 35 with ExportTaskCompleter

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

the class AbstractDefaultMaskingOrchestrator method generateExportMaskAddInitiatorsWorkflow.

/**
 * Generate workflow steps to add initiators to an export mask
 *
 * @param workflow
 *            workflow
 * @param previousStep
 *            previous step ID
 * @param storage
 *            storage device
 * @param exportGroup
 *            export group
 * @param exportMask
 *            export mask
 * @param initiatorURIs
 *            initiator list
 * @param newVolumeURIs
 *            new volume IDs
 * @param token
 *            step ID
 * @return step ID
 * @throws Exception
 */
public String generateExportMaskAddInitiatorsWorkflow(Workflow workflow, String previousStep, StorageSystem storage, ExportGroup exportGroup, ExportMask exportMask, List<URI> initiatorURIs, Set<URI> newVolumeURIs, String token) throws Exception {
    URI exportGroupURI = exportGroup.getId();
    URI exportMaskURI = exportMask.getId();
    URI storageURI = storage.getId();
    List<URI> newTargetURIs = new ArrayList<>();
    List<Initiator> initiators = null;
    if (initiatorURIs != null && !initiatorURIs.isEmpty()) {
        initiators = _dbClient.queryObject(Initiator.class, initiatorURIs);
    } else {
        _log.error("Internal Error: Need to add the initiatorURIs to the call that assembles this step.");
    }
    // Allocate any new ports that are required for the initiators
    // and update the zoning map in the exportMask.
    Collection<URI> volumeURIs = (exportMask.getVolumes() == null) ? newVolumeURIs : (Collection<URI>) (Collections2.transform(exportMask.getVolumes().keySet(), CommonTransformerFunctions.FCTN_STRING_TO_URI));
    if (null == volumeURIs) {
        volumeURIs = new ArrayList<URI>();
    }
    ExportPathParams pathParams = _blockScheduler.calculateExportPathParamForVolumes(volumeURIs, exportGroup.getNumPaths(), storageURI, exportGroupURI);
    if (exportGroup.getType() != null) {
        pathParams.setExportGroupType(exportGroup.getType());
    }
    URI pgURI = exportMask.getPortGroup();
    if (!NullColumnValueGetter.isNullURI(pgURI)) {
        StoragePortGroup portGroup = _dbClient.queryObject(StoragePortGroup.class, pgURI);
        if (!portGroup.getInactive() && !portGroup.getMutable()) {
            _log.info(String.format("Using the port group %s for allocate ports for adding initiators", portGroup.getNativeGuid()));
            pathParams.setStoragePorts(portGroup.getStoragePorts());
        }
    }
    Map<URI, List<URI>> assignments = _blockScheduler.assignStoragePorts(storage, exportGroup, initiators, exportMask.getZoningMap(), pathParams, volumeURIs, _networkDeviceController, exportGroup.getVirtualArray(), token);
    newTargetURIs = BlockStorageScheduler.getTargetURIsFromAssignments(assignments);
    exportMask.addZoningMap(BlockStorageScheduler.getZoneMapFromAssignments(assignments));
    _dbClient.updateObject(exportMask);
    String maskingStep = workflow.createStepId();
    ExportTaskCompleter exportTaskCompleter = new ExportMaskAddInitiatorCompleter(exportGroupURI, exportMask.getId(), initiatorURIs, newTargetURIs, maskingStep);
    Workflow.Method maskingExecuteMethod = new Workflow.Method("doExportGroupAddInitiators", storageURI, exportGroupURI, exportMaskURI, new ArrayList<URI>(volumeURIs), initiatorURIs, newTargetURIs, exportTaskCompleter);
    Workflow.Method rollbackMethod = new Workflow.Method("rollbackExportGroupAddInitiators", storageURI, exportGroupURI, exportMaskURI, new ArrayList<URI>(volumeURIs), initiatorURIs, maskingStep);
    maskingStep = workflow.createStep(EXPORT_GROUP_MASKING_TASK, String.format("Adding initiators to mask %s (%s)", exportMask.getMaskName(), exportMask.getId().toString()), previousStep, storageURI, storage.getSystemType(), MaskingWorkflowEntryPoints.class, maskingExecuteMethod, rollbackMethod, maskingStep);
    return maskingStep;
}
Also used : StoragePortGroup(com.emc.storageos.db.client.model.StoragePortGroup) ExportTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter) ArrayList(java.util.ArrayList) ExportMaskAddInitiatorCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportMaskAddInitiatorCompleter) Workflow(com.emc.storageos.workflow.Workflow) URI(java.net.URI) Initiator(com.emc.storageos.db.client.model.Initiator) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) ExportPathParams(com.emc.storageos.db.client.model.ExportPathParams)

Aggregations

ExportTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter)55 URI (java.net.URI)44 ArrayList (java.util.ArrayList)34 ExportMask (com.emc.storageos.db.client.model.ExportMask)31 Workflow (com.emc.storageos.workflow.Workflow)28 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)24 Initiator (com.emc.storageos.db.client.model.Initiator)20 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)19 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)16 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)16 HashMap (java.util.HashMap)12 HashSet (java.util.HashSet)12 List (java.util.List)11 NamedURI (com.emc.storageos.db.client.model.NamedURI)10 StringMap (com.emc.storageos.db.client.model.StringMap)10 ExportOrchestrationTask (com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportOrchestrationTask)10 Test (org.junit.Test)10 BlockStorageDevice (com.emc.storageos.volumecontroller.BlockStorageDevice)9 ControllerException (com.emc.storageos.volumecontroller.ControllerException)6 ExportMaskOnlyRemoveVolumeCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportMaskOnlyRemoveVolumeCompleter)6