Search in sources :

Example 6 with ExportMaskAddInitiatorCompleter

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

the class VnxMaskingOrchestrator method generateExportMaskAddInitiatorsWorkflow.

/*
     * (non-Javadoc)
     *
     * @see
     * com.emc.storageos.volumecontroller.impl.block.AbstractDefaultMaskingOrchestrator#
     * generateExportMaskAddInitiatorsWorkflow(com.emc.
     * storageos.workflow.Workflow, java.lang.String, com.emc.storageos.db.client.model.StorageSystem,
     * com.emc.storageos.db.client.model.ExportGroup, com.emc.storageos.db.client.model.ExportMask, java.util.List,
     * java.util.Set,
     * java.lang.String)
     */
@Override
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);
    }
    // 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));
    ExportPathParams pathParams = _blockScheduler.calculateExportPathParamForVolumes(volumeURIs, exportGroup.getNumPaths(), storage.getId(), exportGroup.getId());
    if (exportGroup.getType() != null) {
        pathParams.setExportGroupType(exportGroup.getType());
    }
    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 : 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) ArrayList(java.util.ArrayList) List(java.util.List) ExportPathParams(com.emc.storageos.db.client.model.ExportPathParams)

Aggregations

ExportMaskAddInitiatorCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportMaskAddInitiatorCompleter)6 Workflow (com.emc.storageos.workflow.Workflow)6 URI (java.net.URI)6 ArrayList (java.util.ArrayList)6 Initiator (com.emc.storageos.db.client.model.Initiator)5 ExportPathParams (com.emc.storageos.db.client.model.ExportPathParams)4 NamedURI (com.emc.storageos.db.client.model.NamedURI)4 List (java.util.List)4 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)3 ExportMask (com.emc.storageos.db.client.model.ExportMask)3 HashSet (java.util.HashSet)3 ApplicationAddVolumeList (com.emc.storageos.volumecontroller.ApplicationAddVolumeList)2 ExportTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter)2 VPlexApiClient (com.emc.storageos.vplex.api.VPlexApiClient)2 VPlexStorageViewInfo (com.emc.storageos.vplex.api.VPlexStorageViewInfo)2 HashMap (java.util.HashMap)2 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)1 OpStatusMap (com.emc.storageos.db.client.model.OpStatusMap)1 StoragePortGroup (com.emc.storageos.db.client.model.StoragePortGroup)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1