use of com.emc.storageos.db.client.model.StoragePortGroup in project coprhd-controller by CoprHD.
the class VmaxExportOperations method findExportMasks.
/**
* This call can be used to look up the passed in initiator/port names and find (if
* any) to which export masks they belong on the 'storage' array.
*
* @param storage
* [in] - StorageSystem object representing the array
* @param initiatorNames
* [in] - Port identifiers (WWPN or iSCSI name)
* @param mustHaveAllInitiators
* [in] - Indicates if true, *all* the passed in initiators
* have to be in the existing matching mask. If false,
* a mask with *any* of the specified initiators will be
* considered a hit.
* @return Map of port name to Set of ExportMask URIs
*/
@Override
public Map<String, Set<URI>> findExportMasks(StorageSystem storage, List<String> initiatorNames, boolean mustHaveAllInitiators) throws DeviceControllerException {
long startTime = System.currentTimeMillis();
Map<String, Set<URI>> matchingMasks = new HashMap<String, Set<URI>>();
Map<URI, ExportMask> maskMap = new HashMap<>();
CloseableIterator<CIMInstance> maskInstanceItr = null;
try {
// Get a mapping of the initiator port names to their CIMObjectPaths on the provider
WBEMClient client = _helper.getConnection(storage).getCimClient();
HashMap<String, CIMObjectPath> initiatorPathsMap = _cimPath.getInitiatorToInitiatorPath(storage, initiatorNames);
// 'maskNames' will be used to do one-time operations against the ExportMask
List<String> maskNames = new ArrayList<String>();
Set<String> maskNamesFromArray = new HashSet<>();
// Iterate through each port name ...
for (String initiatorName : initiatorPathsMap.keySet()) {
CIMObjectPath initiatorPath = initiatorPathsMap.get(initiatorName);
// Find out if there is a MaskingView associated with the initiator ...
maskInstanceItr = _helper.getAssociatorInstances(storage, initiatorPath, null, SmisConstants.SYMM_LUN_MASKING_VIEW, null, null, SmisConstants.PS_LUN_MASKING_CNTRL_NAME_AND_ROLE);
while (maskInstanceItr.hasNext()) {
// Found a MaskingView ...
CIMInstance instance = maskInstanceItr.next();
String systemName = CIMPropertyFactory.getPropertyValue(instance, SmisConstants.CP_SYSTEM_NAME);
if (!systemName.contains(storage.getSerialNumber())) {
// SMISProvider pointed to by 'storage' system.
continue;
}
String name = CIMPropertyFactory.getPropertyValue(instance, SmisConstants.CP_ELEMENT_NAME);
CIMProperty<String> deviceIdProperty = (CIMProperty<String>) instance.getObjectPath().getKey(SmisConstants.CP_DEVICE_ID);
// Look up ExportMask by deviceId/name and storage URI
ExportMask exportMask = ExportMaskUtils.getExportMaskByName(_dbClient, storage.getId(), name);
boolean foundMaskInDb = (exportMask != null);
maskNamesFromArray.add(name);
// then create a new one
if (!foundMaskInDb) {
exportMask = new ExportMask();
exportMask.setMaskName(name);
exportMask.setNativeId(deviceIdProperty.getValue());
exportMask.setStorageDevice(storage.getId());
exportMask.setId(URIUtil.createId(ExportMask.class));
exportMask.setCreatedBySystem(false);
}
// Do some one-time updates for the ExportMask
if (!maskNames.contains(name)) {
// https://coprhd.atlassian.net/browse/COP-20149
// Find all the initiators associated with the MaskingView and add them
List<String> initiatorPorts = _helper.getInitiatorsFromLunMaskingInstance(client, instance);
if (!CollectionUtils.isEmpty(exportMask.getExistingInitiators())) {
exportMask.getExistingInitiators().clear();
}
exportMask.addToExistingInitiatorsIfAbsent(initiatorPorts);
// Update the initiator list to include existing initiators if we know about them (and remove from existing)
for (String portName : initiatorPorts) {
Initiator existingInitiator = ExportUtils.getInitiator(Initiator.toPortNetworkId(portName), _dbClient);
if (existingInitiator != null && !ExportMaskUtils.checkIfDifferentResource(exportMask, existingInitiator)) {
exportMask.addInitiator(existingInitiator);
exportMask.addToUserCreatedInitiators(existingInitiator);
exportMask.removeFromExistingInitiators(existingInitiator);
}
}
// Update the tracking containers
Map<String, Integer> volumeWWNs = _helper.getVolumesFromLunMaskingInstance(client, instance);
if (!CollectionUtils.isEmpty(exportMask.getExistingVolumes())) {
exportMask.getExistingVolumes().clear();
}
exportMask.addToExistingVolumesIfAbsent(volumeWWNs);
// Update the volumes list to include existing volumes if we know about them (and remove from existing)
if (volumeWWNs != null) {
for (Entry<String, Integer> entry : volumeWWNs.entrySet()) {
String wwn = entry.getKey();
URIQueryResultList results = new URIQueryResultList();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeWwnConstraint(wwn.toUpperCase()), results);
if (results != null) {
Iterator<URI> resultsIter = results.iterator();
if (resultsIter.hasNext()) {
Volume volume = _dbClient.queryObject(Volume.class, resultsIter.next());
if (volume != null) {
Integer hlu = volumeWWNs.get(wwn);
if (hlu == null) {
_log.warn(String.format("The HLU for %s could not be found from the provider. Setting this to -1 (Unknown).", wwn));
hlu = -1;
}
exportMask.addVolume(volume.getId(), hlu);
exportMask.removeFromExistingVolumes(volume);
}
}
}
}
}
// Grab the storage ports that have been allocated for this
// existing mask and add them.
List<String> storagePorts = _helper.getStoragePortsFromLunMaskingInstance(client, instance);
List<String> storagePortURIs = ExportUtils.storagePortNamesToURIs(_dbClient, storagePorts);
exportMask.setStoragePorts(storagePortURIs);
// Get port group for the new exportMask
if (!foundMaskInDb) {
StoragePortGroup portGroup = null;
_log.info("Setting port group for the export mask");
String portGroupName = _helper.getPortGroupForGivenMaskingView(name, storage);
String guid = String.format("%s+%s", storage.getNativeGuid(), portGroupName);
URIQueryResultList result = new URIQueryResultList();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getPortGroupNativeGuidConstraint(guid), result);
Iterator<URI> it = result.iterator();
if (it.hasNext()) {
URI pgURI = it.next();
portGroup = _dbClient.queryObject(StoragePortGroup.class, pgURI);
} else {
portGroup = new StoragePortGroup();
portGroup.setId(URIUtil.createId(StoragePortGroup.class));
portGroup.setLabel(portGroupName);
portGroup.setNativeGuid(guid);
portGroup.setStorageDevice(storage.getId());
portGroup.setInactive(false);
portGroup.setStoragePorts(new StringSet(storagePortURIs));
_dbClient.createObject(portGroup);
}
exportMask.setPortGroup(portGroup.getId());
if (isUsePortGroupEnabled()) {
portGroup.setRegistrationStatus(RegistrationStatus.REGISTERED.name());
portGroup.setMutable(false);
} else {
portGroup.setRegistrationStatus(RegistrationStatus.UNREGISTERED.name());
portGroup.setMutable(true);
}
_dbClient.updateObject(portGroup);
}
// Add the mask name to the list for which volumes are already updated
maskNames.add(name);
}
// Update the maskMap with the latest in-memory exportMask reference.
maskMap.put(exportMask.getId(), exportMask);
if (foundMaskInDb) {
ExportMaskUtils.sanitizeExportMaskContainers(_dbClient, exportMask);
_dbClient.updateObject(exportMask);
} else {
_dbClient.createObject(exportMask);
}
// Update our results map
Set<URI> maskURIs = matchingMasks.get(initiatorName);
if (maskURIs == null) {
maskURIs = new HashSet<>();
matchingMasks.put(initiatorName, maskURIs);
}
maskURIs.add(exportMask.getId());
}
}
// COP-19514 - After we've found all ExportMasks that are related to a given set of initiators, we
// need to eliminate any that do not have all the initiators if mustHaveAllInitiators=true. The
// masksNotContainingAllInitiators set is used to hold references to those ExportMasks that do not
// match the criteria of having all the initiators.
Set<URI> masksNotContainingAllInitiators = new HashSet<>();
if (mustHaveAllInitiators) {
// Check if each ExportMask has all the ports. If not, add it to masksNotContainingAllInitiators
for (URI exportMaskURI : maskMap.keySet()) {
ExportMask mask = maskMap.get(exportMaskURI);
if (!matchesSearchCriteria(mask, initiatorNames, true)) {
masksNotContainingAllInitiators.add(exportMaskURI);
}
}
}
// Skip the masking views whose IGs can be reused to create a new Masking view instead.
Set<URI> masksWithReusableIGs = getMasksWhoseIGsCanBeReused(storage, maskMap, initiatorNames);
// Adjust the matchingMap if there are any masksNotContainingAllInitiators / singleIGContainedMasks
if (!masksNotContainingAllInitiators.isEmpty() || !masksWithReusableIGs.isEmpty()) {
_log.info("ExportMasks not containing all initiators requested: {}", masksNotContainingAllInitiators);
_log.info("ExportMasks whose IGs can be reused to create new masking view: {}", masksWithReusableIGs);
// Remove references to the ExportMask URIs from the matchingMasks map entries
Iterator<Entry<String, Set<URI>>> matchingMapEntryIterator = matchingMasks.entrySet().iterator();
while (matchingMapEntryIterator.hasNext()) {
Entry<String, Set<URI>> matchingMapEntry = matchingMapEntryIterator.next();
Set<URI> maskURIs = matchingMapEntry.getValue();
maskURIs.removeAll(masksNotContainingAllInitiators);
maskURIs.removeAll(masksWithReusableIGs);
// If all the ExportMask keys are cleared out, then we need to remove the whole entry
if (maskURIs.isEmpty()) {
matchingMapEntryIterator.remove();
}
}
}
StringBuilder builder = new StringBuilder();
for (URI exportMaskURI : maskMap.keySet()) {
ExportMask exportMask = maskMap.get(exportMaskURI);
String qualifier = (masksNotContainingAllInitiators.contains(exportMaskURI)) ? ", but not containing all initiators we're looking for" : (masksWithReusableIGs.contains(exportMaskURI) ? ", but it's IGs can be reused to create new masking view" : SmisConstants.EMPTY_STRING);
builder.append(String.format("\nXM:%s is matching%s: ", exportMask.getMaskName(), qualifier)).append('\n').append(exportMask.toString());
}
/**
* Needs to clean up stale EM from ViPR DB.
*/
ExportUtils.cleanStaleExportMasks(storage, maskNamesFromArray, initiatorNames, _dbClient);
_log.info(builder.toString());
} catch (Exception e) {
String msg = "Error when attempting to query LUN masking information: " + e.getMessage();
_log.error(MessageFormat.format("Encountered an SMIS error when attempting to query existing exports: {0}", msg), e);
throw SmisException.exceptions.queryExistingMasksFailure(msg, e);
} finally {
if (maskInstanceItr != null) {
maskInstanceItr.close();
}
long totalTime = System.currentTimeMillis() - startTime;
_log.info(String.format("findExportMasks took %f seconds", (double) totalTime / (double) 1000));
}
return matchingMasks;
}
use of com.emc.storageos.db.client.model.StoragePortGroup in project coprhd-controller by CoprHD.
the class VmaxExportOperations method changePortGroupAddPaths.
@Override
public void changePortGroupAddPaths(StorageSystem storage, URI newMaskURI, URI oldMaskURI, URI portGroupURI, TaskCompleter completer) {
try {
ExportOperationContext context = new VmaxExportOperationContext();
// Prime the context object
completer.updateWorkflowStepContext(context);
StoragePortGroup portGroup = _dbClient.queryObject(StoragePortGroup.class, portGroupURI);
ExportMask newMask = _dbClient.queryObject(ExportMask.class, newMaskURI);
ExportMask oldMask = _dbClient.queryObject(ExportMask.class, oldMaskURI);
String maskName = oldMask.getMaskName();
String storageGroupName = _helper.getStorageGroupForGivenMaskingView(maskName, storage);
CIMObjectPath storageGroupPath = _cimPath.getStorageGroupObjectPath(storageGroupName, storage);
CIMObjectPath igPath = _helper.getInitiatorGroupForGivenMaskingView(maskName, storage);
CIMObjectPath targetPortGroupPath = _cimPath.getMaskingGroupPath(storage, portGroup.getLabel(), SmisConstants.MASKING_GROUP_TYPE.SE_TargetMaskingGroup);
createMaskingView(storage, newMaskURI, newMask.getMaskName(), storageGroupPath, new VolumeURIHLU[0], targetPortGroupPath, igPath, completer);
} catch (Exception e) {
_log.error(String.format("change port group failed %s", oldMaskURI.toString()), e);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
completer.error(_dbClient, serviceError);
}
}
use of com.emc.storageos.db.client.model.StoragePortGroup in project coprhd-controller by CoprHD.
the class VmaxExportOperations method createTargetPortGroup.
private CIMObjectPath createTargetPortGroup(StorageSystem storage, String portGroupName, ExportMask mask, List<URI> targetURIList, TaskCompleter taskCompleter) throws Exception {
_log.debug("{} createTargetPortGroup START...", storage.getSerialNumber());
CIMObjectPath targetPortGroupPath = null;
CIMArgument[] inArgs = _helper.getCreateTargetPortGroupInputArguments(storage, portGroupName, targetURIList);
CIMArgument[] outArgs = new CIMArgument[5];
try {
// Try to look up the port group. If it already exists, use it,
// otherwise try to create it.
targetPortGroupPath = _cimPath.getMaskingGroupPath(storage, portGroupName, SmisConstants.MASKING_GROUP_TYPE.SE_TargetMaskingGroup);
CIMInstance instance = _helper.checkExists(storage, targetPortGroupPath, false, false);
if (instance == null) {
_helper.invokeMethod(storage, _cimPath.getControllerConfigSvcPath(storage), "CreateGroup", inArgs, outArgs);
targetPortGroupPath = _cimPath.getCimObjectPathFromOutputArgs(outArgs, "MaskingGroup");
ExportOperationContext.insertContextOperation(taskCompleter, VmaxExportOperationContext.OPERATION_CREATE_PORT_GROUP, portGroupName, targetURIList);
// Create port group
StoragePortGroup portGroup = new StoragePortGroup();
String guid = String.format("%s+%s", storage.getNativeGuid(), portGroupName);
portGroup.setId(URIUtil.createId(StoragePortGroup.class));
portGroup.setLabel(portGroupName);
portGroup.setNativeGuid(guid);
portGroup.setStorageDevice(storage.getId());
portGroup.setInactive(false);
portGroup.setRegistrationStatus(RegistrationStatus.UNREGISTERED.name());
portGroup.setMutable(true);
portGroup.setStoragePorts(StringSetUtil.uriListToStringSet(targetURIList));
_dbClient.createObject(portGroup);
mask.setPortGroup(portGroup.getId());
_dbClient.updateObject(mask);
}
} catch (WBEMException we) {
_log.info("{} Problem when trying to create target port group ... going to look up target port group.", storage.getSystemType(), we);
targetPortGroupPath = handleCreateMaskingGroupException(storage, portGroupName, inArgs, SmisCommandHelper.MASKING_GROUP_TYPE.SE_TargetMaskingGroup);
if (targetPortGroupPath == null) {
_log.info("{} Problem looking up target port group.", storage.getSerialNumber(), we);
throw we;
} else {
_log.info("{} Found target port group.", storage.getSerialNumber());
}
}
_log.debug("{} createTargetPortGroup END...", storage.getSerialNumber());
return targetPortGroupPath;
}
use of com.emc.storageos.db.client.model.StoragePortGroup in project coprhd-controller by CoprHD.
the class VmaxExportOperations method createExportMask.
/**
* This implementation will attempt to create a MaskingView on the VMAX with the
* associated elements. The goal of this is to create a MaskingView per compute
* resource. A compute resource is either a host or a cluster. A host is a single
* entity with multiple initiators. A cluster is an entity consisting of multiple
* hosts.
*
* The idea is to maintain 1 MaskingView to 1 compute resource,
* regardless of the number of ViPR Export*Groups* that are created. An
* Export*Mask* will map to a MaskingView.
*
* @param storage
* @param exportMaskURI
* @param volumeURIHLUs
* @param targetURIList
* @param initiatorList
* @param taskCompleter
* @throws DeviceControllerException
*/
@Override
public void createExportMask(StorageSystem storage, URI exportMaskURI, VolumeURIHLU[] volumeURIHLUs, List<URI> targetURIList, List<Initiator> initiatorList, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("{} createExportMask START...", storage.getSerialNumber());
Map<StorageGroupPolicyLimitsParam, CIMObjectPath> newlyCreatedChildVolumeGroups = new HashMap<StorageGroupPolicyLimitsParam, CIMObjectPath>();
ExportOperationContext context = new VmaxExportOperationContext();
// Prime the context object
taskCompleter.updateWorkflowStepContext(context);
try {
_log.info("Export mask id: {}", exportMaskURI);
_log.info("createExportMask: volume-HLU pairs: {}", Joiner.on(',').join(volumeURIHLUs));
_log.info("createExportMask: initiators: {}", Joiner.on(',').join(initiatorList));
_log.info("createExportMask: assignments: {}", Joiner.on(',').join(targetURIList));
ExportMask mask = _dbClient.queryObject(ExportMask.class, exportMaskURI);
String maskingViewName = generateMaskViewName(storage, mask);
// Fill this in now so we have it in case of exceptions
String cascadedIGCustomTemplateName = CustomConfigConstants.VMAX_HOST_CASCADED_IG_MASK_NAME;
String initiatorGroupCustomTemplateName = CustomConfigConstants.VMAX_HOST_INITIATOR_GROUP_MASK_NAME;
String cascadedSGCustomTemplateName = CustomConfigConstants.VMAX_HOST_CASCADED_SG_MASK_NAME;
String portGroupCustomTemplateName = CustomConfigConstants.VMAX_HOST_PORT_GROUP_MASK_NAME;
String exportType = ExportMaskUtils.getExportType(_dbClient, mask);
if (ExportGroupType.Cluster.name().equals(exportType)) {
cascadedIGCustomTemplateName = CustomConfigConstants.VMAX_CLUSTER_CASCADED_IG_MASK_NAME;
initiatorGroupCustomTemplateName = CustomConfigConstants.VMAX_CLUSTER_INITIATOR_GROUP_MASK_NAME;
cascadedSGCustomTemplateName = CustomConfigConstants.VMAX_CLUSTER_CASCADED_SG_MASK_NAME;
portGroupCustomTemplateName = CustomConfigConstants.VMAX_CLUSTER_PORT_GROUP_MASK_NAME;
}
// 1. InitiatorGroup (IG)
DataSource cascadedIGDataSource = ExportMaskUtils.getExportDatasource(storage, initiatorList, dataSourceFactory, cascadedIGCustomTemplateName);
String cigName = customConfigHandler.getComputedCustomConfigValue(cascadedIGCustomTemplateName, storage.getSystemType(), cascadedIGDataSource);
cigName = _helper.generateGroupName(_helper.getExistingInitiatorGroupsFromArray(storage), cigName);
CIMObjectPath cascadedIG = createOrUpdateInitiatorGroups(storage, exportMaskURI, cigName, initiatorGroupCustomTemplateName, initiatorList, taskCompleter);
if (cascadedIG == null) {
// return from here.
return;
}
// 2. StorageGroup (SG)
DataSource cascadedSGDataSource = ExportMaskUtils.getExportDatasource(storage, initiatorList, dataSourceFactory, cascadedSGCustomTemplateName);
String csgName = customConfigHandler.getComputedCustomConfigValue(cascadedSGCustomTemplateName, storage.getSystemType(), cascadedSGDataSource);
// 3. PortGroup (PG)
// check if port group name is specified
URI portGroupURI = mask.getPortGroup();
String portGroupName = null;
CIMObjectPath targetPortGroupPath = null;
if (!NullColumnValueGetter.isNullURI(portGroupURI) && isUsePortGroupEnabled()) {
StoragePortGroup pg = _dbClient.queryObject(StoragePortGroup.class, portGroupURI);
portGroupName = pg.getLabel();
_log.info(String.format("port group name: %s", portGroupName));
// Check if the port group existing in the array
targetPortGroupPath = _cimPath.getMaskingGroupPath(storage, portGroupName, SmisConstants.MASKING_GROUP_TYPE.SE_TargetMaskingGroup);
List<URI> ports = _helper.getPortGroupMembers(storage, targetPortGroupPath);
if (!ports.containsAll(targetURIList)) {
String targets = Joiner.on(',').join(targetURIList);
_log.error(String.format("The port group %s does not contain all the storage ports in the target list %s", pg.getNativeGuid(), targets));
taskCompleter.error(_dbClient, DeviceControllerException.exceptions.portGroupNotUptodate(pg.getNativeGuid(), targets));
return;
}
} else {
DataSource portGroupDataSource = ExportMaskUtils.getExportDatasource(storage, initiatorList, dataSourceFactory, portGroupCustomTemplateName);
portGroupName = customConfigHandler.getComputedCustomConfigValue(portGroupCustomTemplateName, storage.getSystemType(), portGroupDataSource);
// CTRL-9054 Always create unique port Groups.
portGroupName = _helper.generateGroupName(_helper.getExistingPortGroupsFromArray(storage), portGroupName);
targetPortGroupPath = createTargetPortGroup(storage, portGroupName, mask, targetURIList, taskCompleter);
}
// 4. ExportMask = MaskingView (MV) = IG + SG + PG
CIMObjectPath volumeParentGroupPath = storage.checkIfVmax3() ? // TODO: Customized name for SLO based group
createOrSelectSLOBasedStorageGroup(storage, exportMaskURI, initiatorList, volumeURIHLUs, csgName, newlyCreatedChildVolumeGroups, taskCompleter) : createOrSelectStorageGroup(storage, exportMaskURI, initiatorList, volumeURIHLUs, csgName, newlyCreatedChildVolumeGroups, taskCompleter);
createMaskingView(storage, exportMaskURI, maskingViewName, volumeParentGroupPath, volumeURIHLUs, targetPortGroupPath, cascadedIG, taskCompleter);
} catch (Exception e) {
_log.error(String.format("createExportMask failed - maskName: %s", exportMaskURI.toString()), e);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
taskCompleter.error(_dbClient, serviceError);
}
_log.info("{} createExportMask END...", storage.getSerialNumber());
}
use of com.emc.storageos.db.client.model.StoragePortGroup 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