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