Search in sources :

Example 16 with DataSource

use of com.emc.storageos.customconfigcontroller.DataSource 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());
}
Also used : StoragePortGroup(com.emc.storageos.db.client.model.StoragePortGroup) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) HashMap(java.util.HashMap) ExportMask(com.emc.storageos.db.client.model.ExportMask) CIMObjectPath(javax.cim.CIMObjectPath) URI(java.net.URI) SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) DataSource(com.emc.storageos.customconfigcontroller.DataSource) ExportOperationContext(com.emc.storageos.volumecontroller.impl.utils.ExportOperationContext) StorageGroupPolicyLimitsParam(com.emc.storageos.volumecontroller.impl.StorageGroupPolicyLimitsParam)

Example 17 with DataSource

use of com.emc.storageos.customconfigcontroller.DataSource in project coprhd-controller by CoprHD.

the class VmaxExportOperations method createOrUpdateInitiatorGroups.

private CIMObjectPath createOrUpdateInitiatorGroups(StorageSystem storage, URI exportMaskURI, String cigName, String igCustomTemplateName, List<Initiator> initiatorList, TaskCompleter taskCompleter) throws Exception {
    ExportMask mask = _dbClient.queryObject(ExportMask.class, exportMaskURI);
    String exportType = ExportMaskUtils.getExportType(_dbClient, mask);
    boolean singleIG = false;
    // Determine if we are doing consistent LUNs. Default is to do so. For VPLEX IGs, we want Consistent LUNS false.
    // This parameter is set by the VPlexBackendManager for VPlex Export Masks.
    boolean consistentLUNs = true;
    StringSet consistentLUNsParameter = _helper.getExportMaskDeviceDataMapParameter(exportMaskURI, ExportMask.DeviceDataMapKeys.VMAXConsistentLUNs.name());
    if (consistentLUNsParameter != null && consistentLUNsParameter.contains("false")) {
        consistentLUNs = false;
    }
    String clusterName = checkRequestAndGetClusterName(initiatorList, taskCompleter);
    if (clusterName == null) {
        // and the client will have to check for this condition
        return null;
    }
    ListMultimap<CIMObjectPath, String> igToInitiators = ArrayListMultimap.create();
    Map<String, CIMObjectPath> initiatorsToIGs = mapInitiatorsToInitiatorGroups(igToInitiators, storage, initiatorList);
    handleExistingInitiators(storage, mask, initiatorList, taskCompleter);
    if (isEmptyClusterName(clusterName)) {
        // belong to the existing IG (if one exists).
        if (igToInitiators.keySet().size() > 1) {
            taskCompleter.error(_dbClient, DeviceControllerException.errors.nonClusterExportWithInitiatorsInDifferentExistingIGs());
            return null;
        }
    }
    // club the initiators by host names
    Map<String, List<Initiator>> initiatorListByHost = clubInitiatorsByHostname(initiatorList);
    List<CIMObjectPath> initiatorGroupPaths = new ArrayList<CIMObjectPath>();
    CIMObjectPath initiatorGroupPath = null;
    // Hosts that were grouped together for single IG support
    Set<String> groupedHosts = new HashSet<>();
    for (Map.Entry<String, List<Initiator>> entry : initiatorListByHost.entrySet()) {
        String hostName = entry.getKey();
        if (groupedHosts.contains(hostName)) {
            continue;
        }
        List<Initiator> initiatorListForHost = entry.getValue();
        Collection<String> initiatorPorts = transform(initiatorListForHost, fctnInitiatorToPortName());
        Initiator sample = null;
        // is a matching IG
        for (Initiator initiator : initiatorListForHost) {
            sample = initiator;
            initiatorGroupPath = initiatorsToIGs.get(Initiator.normalizePort(sample.getInitiatorPort()));
            if (initiatorGroupPath != null) {
                _log.info("Found an initiator which is part of some IG");
                break;
            }
        }
        if (initiatorGroupPath != null) {
            CIMInstance igInstance = _helper.getInstance(storage, initiatorGroupPath, false, false, SmisConstants.PS_ELEMENT_NAME);
            String igName = CIMPropertyFactory.getPropertyValue(igInstance, SmisConstants.CP_ELEMENT_NAME);
            _log.info("createOrUpdateInitiatorGroups - Existing initiatorGroup " + "found, {}, validating it...", igName);
            // Yes - initiator is some IG, validate the IG that it's in has the
            // same ports or sub set of host ports. If not ==> error
            List<String> igInitiatorPorts = igToInitiators.get(initiatorGroupPath);
            _log.info("createOrUpdateInitiatorGroups - List of initiators: {} to create/update on host: " + hostName, Joiner.on(',').join(initiatorPorts));
            _log.info("createOrUpdateInitiatorGroups - List of initiators: {} in IG path: " + initiatorGroupPath, Joiner.on(',').join(igInitiatorPorts));
            // That's why there is a check here for if sample.getHost() != null.
            if (sample.getHost() != null) {
                Set<String> initiatorDiff = Sets.difference(new HashSet<String>(igInitiatorPorts), new HashSet<String>(initiatorPorts));
                if (!initiatorDiff.isEmpty()) {
                    /*
                         * If the IG has initiators other than those in the export request,
                         * then be sure the it is subset of host's initiators in
                         * ViPR database.
                         */
                    List<String> initiatorsInDb = queryHostInitiators(sample.getHost());
                    Set<String> initiatorsTmp = new HashSet<>();
                    initiatorsTmp.addAll(initiatorDiff);
                    _log.info("createOrUpdateInitiatorGroups - List of initiators: {} in ViPR database on host: " + hostName, Joiner.on(',').join(initiatorsInDb));
                    initiatorsTmp.removeAll(initiatorsInDb);
                    if (!initiatorsTmp.isEmpty() && isEmptyClusterName(clusterName)) {
                        // if not a subset, throw exception
                        taskCompleter.error(_dbClient, DeviceControllerException.errors.existingInitiatorGroupDoesNotHaveSamePorts(igName));
                        return null;
                    }
                    // We can add any needed initiators right here and maintain the big IG.
                    if (!isEmptyClusterName(clusterName) && !initiatorsTmp.isEmpty()) {
                        initiatorsInDb = queryClusterInitiators(sample.getHost());
                        _log.info("createOrUpdateInitiatorGroups - List of initiators: {} in ViPR database on cluster: " + sample.getClusterName(), Joiner.on(',').join(initiatorsInDb));
                        initiatorsTmp.removeAll(initiatorsInDb);
                        if (!initiatorsTmp.isEmpty()) {
                            // if not a subset, throw exception
                            taskCompleter.error(_dbClient, DeviceControllerException.errors.existingInitiatorGroupDoesNotHaveSamePorts(igName));
                            return null;
                        }
                        _log.info("createOrUpdateInitiatorGroups - List of initiators in cluster found to match IG we want to use.");
                        // Update the initiatorListForHost to include all initiators for this cluster
                        for (String initiatorInDb : initiatorsInDb) {
                            Initiator initiator = ExportUtils.getInitiator(Initiator.toPortNetworkId(initiatorInDb), _dbClient);
                            if (!initiator.getHost().equals(sample.getHost())) {
                                initiatorListForHost.add(initiator);
                            }
                            groupedHosts.add(initiator.getHostName());
                        }
                        singleIG = true;
                    }
                }
            }
            // If we got here, then we're in the clear to use this IG
            _log.info("createOrUpdateInitiatorGroups - Existing initiatorGroup {} " + "looks okay to use", igName);
            // if there are new initiators, add them to the IG
            initiatorGroupPath = createInitiatorGroupWithInitiators(storage, igName, initiatorListForHost, consistentLUNs, taskCompleter);
            // we're done updating the initiator group.
            if (singleIG) {
                return initiatorGroupPath;
            }
        } else {
            // No - initiator is not in an IG, so will need to create an IG and add
            // the initiators to it
            // Get the initiator group name from the custom name framework
            DataSource igDataSource = ExportMaskUtils.getExportDatasource(storage, initiatorListForHost, dataSourceFactory, igCustomTemplateName);
            String initiatorGroupName = customConfigHandler.getComputedCustomConfigValue(igCustomTemplateName, storage.getSystemType(), igDataSource);
            // Non-VPLEX case
            if (sample != null && sample.getHost() != null) {
                // In this case, we may be asked to add initiators to a mask where the initiators are part of a
                // host,
                // but the initiators are not yet represented in an IG, however other initiators in the host are.
                // Get the ports
                // associated with the host and see if you can find an IG (stand-alone or child) where the
                // initiators in
                // initiatorList belong that are part of the mask the orchestrator sent down.
                Entry<String, Boolean> igName = findExistingIGForHostAndMask(storage, mask, sample.getHost());
                if (igName != null && igName.getKey() != null) {
                    initiatorGroupName = igName.getKey();
                    _log.info("createOrUpdateInitiatorGroups - Found an existing " + "initiator group. Will attempt to add initiators for host {} " + "and initiators {}", hostName, Joiner.on(',').join(initiatorPorts));
                    if (igName.getValue()) {
                        // We want to preserve a flat non-cascaded IG if possible.
                        singleIG = true;
                    }
                } else {
                    _log.info("createOrUpdateInitiatorGroups - Did not find any existing " + "initiator group. Will attempt to create a new one for host {} " + "and initiators {}", hostName, Joiner.on(',').join(initiatorPorts));
                }
            }
            initiatorGroupPath = createInitiatorGroupWithInitiators(storage, initiatorGroupName, initiatorListForHost, consistentLUNs, taskCompleter);
        }
        initiatorGroupPaths.add(initiatorGroupPath);
    }
    // One node cluster - create CIG only if cluster type or if consistentLUNs==false (VPlex)
    if (consistentLUNs == false || (!singleIG && ExportGroupType.Cluster.name().equalsIgnoreCase(exportType))) {
        // Create cascaded initiator group the IG(s) created above
        initiatorGroupPath = createInitiatorGroupWithInitiatorGroups(storage, _dbClient.queryObject(ExportMask.class, exportMaskURI), cigName, initiatorGroupPaths, consistentLUNs, taskCompleter);
    }
    return initiatorGroupPath;
}
Also used : ExportMask(com.emc.storageos.db.client.model.ExportMask) CIMObjectPath(javax.cim.CIMObjectPath) ArrayList(java.util.ArrayList) CIMInstance(javax.cim.CIMInstance) DataSource(com.emc.storageos.customconfigcontroller.DataSource) Initiator(com.emc.storageos.db.client.model.Initiator) StringSet(com.emc.storageos.db.client.model.StringSet) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) List(java.util.List) Map(java.util.Map) HashMap(java.util.HashMap) AbstractMap(java.util.AbstractMap) Sets.newHashSet(com.google.common.collect.Sets.newHashSet) HashSet(java.util.HashSet)

Example 18 with DataSource

use of com.emc.storageos.customconfigcontroller.DataSource in project coprhd-controller by CoprHD.

the class VPlexDeviceController method promoteMirror.

/**
 * This method creates the virtual volume from the detached mirror device.
 *
 * @param vplexURI
 *            The vplex storage system URI
 * @param vplexMirrorURI
 *            The URI of the vplex mirror that needs to be promoted to the virtual volume
 * @param promoteVolumeURI
 *            The URI of the volume will be used as a promoted vplex volume
 * @param stepId
 *            The worflow stepId
 *
 * @throws WorkflowException
 *             When an error occurs updating the workflow step
 *             state.
 */
public void promoteMirror(URI vplexURI, URI vplexMirrorURI, URI promoteVolumeURI, String stepId) throws WorkflowException {
    try {
        WorkflowStepCompleter.stepExecuting(stepId);
        VPlexApiClient client = getVPlexAPIClient(_vplexApiFactory, vplexURI, _dbClient);
        VplexMirror vplexMirror = getDataObject(VplexMirror.class, vplexMirrorURI, _dbClient);
        Volume sourceVplexVolume = getDataObject(Volume.class, vplexMirror.getSource().getURI(), _dbClient);
        Volume promoteVolume = _dbClient.queryObject(Volume.class, promoteVolumeURI);
        // Find virtual volume that should have been created when we did detach mirror.
        // Virtual volume is created with the same name as the device name.
        VPlexVirtualVolumeInfo vvInfo = client.findVirtualVolume(vplexMirror.getDeviceLabel(), null);
        // Get the backend volume for this promoted VPLEX volume.
        StringSet assocVolumes = vplexMirror.getAssociatedVolumes();
        // Get the ViPR label for the promoted VPLEX volume.
        String promotedLabel = String.format("%s-%s", sourceVplexVolume.getLabel(), vplexMirror.getLabel());
        // Rename the vplex volume created using device detach mirror. If custom naming is enabled
        // generate the custom name, else the name follows the default naming convention and must
        // be renamed to append the "_vol" suffix.
        String newVolumeName = null;
        try {
            if (CustomVolumeNamingUtils.isCustomVolumeNamingEnabled(customConfigHandler, DiscoveredDataObject.Type.vplex.name())) {
                String customConfigName = CustomConfigConstants.CUSTOM_VOLUME_NAME;
                Project project = _dbClient.queryObject(Project.class, promoteVolume.getProject().getURI());
                TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, promoteVolume.getTenant().getURI());
                DataSource customNameDataSource = CustomVolumeNamingUtils.getCustomConfigDataSource(project, tenant, promotedLabel, vvInfo.getWwn(), null, dataSourceFactory, customConfigName, _dbClient);
                if (customNameDataSource != null) {
                    newVolumeName = CustomVolumeNamingUtils.getCustomName(customConfigHandler, customConfigName, customNameDataSource, DiscoveredDataObject.Type.vplex.name());
                }
                // Rename the vplex volume created using device detach mirror,
                vvInfo = CustomVolumeNamingUtils.renameVolumeOnVPlex(vvInfo, newVolumeName, client);
                promotedLabel = newVolumeName;
            } else {
                // Build the name for volume so as to rename the vplex volume that is created
                // with the same name as the device name to follow the name pattern _vol
                // as the suffix for the vplex volumes
                StringBuilder volumeNameBuilder = new StringBuilder();
                volumeNameBuilder.append(vplexMirror.getDeviceLabel());
                volumeNameBuilder.append(VPlexApiConstants.VIRTUAL_VOLUME_SUFFIX);
                newVolumeName = volumeNameBuilder.toString();
                // Rename the vplex volume created using device detach mirror,
                vvInfo = CustomVolumeNamingUtils.renameVolumeOnVPlex(vvInfo, newVolumeName, client);
            }
        } catch (Exception e) {
            _log.warn(String.format("Error renaming promoted VPLEX volume %s", promoteVolumeURI), e);
        }
        _log.info(String.format("Renamed promoted virtual volume: %s path: %s", vvInfo.getName(), vvInfo.getPath()));
        // Fill in the details for the promoted vplex volume
        promoteVolume.setLabel(promotedLabel);
        promoteVolume.setNativeId(vvInfo.getPath());
        promoteVolume.setNativeGuid(vvInfo.getPath());
        promoteVolume.setDeviceLabel(vvInfo.getName());
        promoteVolume.setThinlyProvisioned(vvInfo.isThinEnabled());
        promoteVolume.setWWN(vvInfo.getWwn());
        // For Vplex virtual volumes set allocated capacity to 0 (cop-18608)
        promoteVolume.setAllocatedCapacity(0L);
        promoteVolume.setCapacity(vplexMirror.getCapacity());
        promoteVolume.setProvisionedCapacity(vplexMirror.getProvisionedCapacity());
        promoteVolume.setVirtualPool(vplexMirror.getVirtualPool());
        promoteVolume.setVirtualArray(vplexMirror.getVirtualArray());
        promoteVolume.setStorageController(vplexMirror.getStorageController());
        promoteVolume.setSystemType(DiscoveredDataObject.Type.vplex.name());
        promoteVolume.setPool(NullColumnValueGetter.getNullURI());
        promoteVolume.setAssociatedVolumes(new StringSet(assocVolumes));
        promoteVolume.setThinlyProvisioned(vplexMirror.getThinlyProvisioned());
        promoteVolume.setThinVolumePreAllocationSize(vplexMirror.getThinPreAllocationSize());
        // VPLEX volumes created by VIPR have syncActive set to true hence setting same value for promoted vplex
        // volumes
        promoteVolume.setSyncActive(true);
        // Also, we update the name portion of the project and tenant URIs
        // to reflect the new name. This is necessary because the API
        // to search for volumes by project, extracts the name portion of the
        // project URI to get the volume name.
        NamedURI namedURI = promoteVolume.getProject();
        namedURI.setName(promotedLabel);
        promoteVolume.setProject(namedURI);
        namedURI = promoteVolume.getTenant();
        namedURI.setName(promotedLabel);
        promoteVolume.setTenant(namedURI);
        // Remove mirror from the source VPLEX volume
        sourceVplexVolume.getMirrors().remove(vplexMirror.getId().toString());
        _dbClient.updateObject(sourceVplexVolume);
        // Delete the mirror object
        _dbClient.removeObject(vplexMirror);
        // Persist changes for the newly promoted volume
        _dbClient.updateObject(promoteVolume);
        WorkflowStepCompleter.stepSucceded(stepId);
    } catch (VPlexApiException vae) {
        _log.error("Exception promoting mirror volume: " + vae.getMessage(), vae);
        WorkflowStepCompleter.stepFailed(stepId, vae);
    } catch (Exception ex) {
        _log.error("Exception promoting mirror volume: " + ex.getMessage(), ex);
        ServiceError serviceError = VPlexApiException.errors.promoteMirrorFailed(ex);
        WorkflowStepCompleter.stepFailed(stepId, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) NamedURI(com.emc.storageos.db.client.model.NamedURI) VPlexVirtualVolumeInfo(com.emc.storageos.vplex.api.VPlexVirtualVolumeInfo) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) VPlexApiException(com.emc.storageos.vplex.api.VPlexApiException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) DataSource(com.emc.storageos.customconfigcontroller.DataSource) Project(com.emc.storageos.db.client.model.Project) Volume(com.emc.storageos.db.client.model.Volume) VPlexApiException(com.emc.storageos.vplex.api.VPlexApiException) VPlexApiClient(com.emc.storageos.vplex.api.VPlexApiClient) StringSet(com.emc.storageos.db.client.model.StringSet) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) VplexMirror(com.emc.storageos.db.client.model.VplexMirror)

Example 19 with DataSource

use of com.emc.storageos.customconfigcontroller.DataSource in project coprhd-controller by CoprHD.

the class AbstractDefaultMaskingOrchestrator method getComputedExportMaskName.

protected String getComputedExportMaskName(StorageSystem storage, ExportGroup exportGroup, List<Initiator> initiators) {
    String configTemplateName = getMaskingCustomConfigTypeName(exportGroup.getType());
    DataSource dataSource = ExportMaskUtils.getExportDatasource(storage, initiators, dataSourceFactory, configTemplateName);
    if (dataSource == null) {
        return null;
    }
    return customConfigHandler.getComputedCustomConfigValue(configTemplateName, storage.getSystemType(), dataSource);
}
Also used : DataSource(com.emc.storageos.customconfigcontroller.DataSource)

Example 20 with DataSource

use of com.emc.storageos.customconfigcontroller.DataSource in project coprhd-controller by CoprHD.

the class NetworkScheduler method nameZone.

/**
 * Generates a zoneName from the input parameters according to the CustomConfig handler.
 * @param arrayURI -- URI of StorageSystem
 * @param networkSystemURI -- URI of network system
 * @param initiatorPort -- Initiator port address
 * @param portNetworkAddress -- Port network address
 * @param fabricId -- Fabric id
 * @param lsanZone -- true if LSAN zone
 * @return -- zone name
 */
public String nameZone(URI arrayURI, URI networkSystemURI, String initiatorPort, String portNetworkAddress, String fabricId, boolean lsanZone) {
    StorageSystem array = _dbClient.queryObject(StorageSystem.class, arrayURI);
    NetworkSystem networkSystem = _dbClient.queryObject(NetworkSystem.class, networkSystemURI);
    Initiator initiator = NetworkUtil.findInitiatorInDB(initiatorPort, _dbClient);
    StoragePort port = NetworkUtil.getStoragePort(portNetworkAddress, _dbClient);
    String hostName = initiator.getHostName();
    if (array == null || initiator == null || hostName == null) {
        throw DeviceControllerException.exceptions.unexpectedCondition("Cannot generate zone name because array, initiator, or hostName were null");
    }
    DataSource dataSource = dataSourceFactory.createZoneNameDataSource(hostName, initiator, port, fabricId, array);
    if (array.getSystemType().equals(DiscoveredDataObject.Type.vplex.name())) {
        dataSource.addProperty(CustomConfigConstants.ARRAY_PORT_NAME, getVPlexPortName(port));
        dataSource.addProperty(CustomConfigConstants.ARRAY_SERIAL_NUMBER, getVPlexClusterSerialNumber(port));
    }
    String systemType = networkSystem.getSystemType();
    String resolvedZoneName = customConfigHandler.resolve(CustomConfigConstants.ZONE_MASK_NAME, systemType, dataSource);
    validateZoneNameLength(resolvedZoneName, lsanZone, systemType);
    String zoneName = customConfigHandler.getComputedCustomConfigValue(CustomConfigConstants.ZONE_MASK_NAME, systemType, dataSource);
    if (lsanZone && DiscoveredDataObject.Type.brocade.name().equals(systemType)) {
        zoneName = LSAN + zoneName;
    }
    return zoneName;
}
Also used : Initiator(com.emc.storageos.db.client.model.Initiator) NetworkSystem(com.emc.storageos.db.client.model.NetworkSystem) StoragePort(com.emc.storageos.db.client.model.StoragePort) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) DataSource(com.emc.storageos.customconfigcontroller.DataSource)

Aggregations

DataSource (com.emc.storageos.customconfigcontroller.DataSource)21 Initiator (com.emc.storageos.db.client.model.Initiator)7 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)7 URI (java.net.URI)7 ArrayList (java.util.ArrayList)7 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)6 Project (com.emc.storageos.db.client.model.Project)5 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)5 StringSet (com.emc.storageos.db.client.model.StringSet)5 HashSet (java.util.HashSet)5 ExportMask (com.emc.storageos.db.client.model.ExportMask)4 HashMap (java.util.HashMap)4 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)3 NamedURI (com.emc.storageos.db.client.model.NamedURI)3 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)3 Volume (com.emc.storageos.db.client.model.Volume)3 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)3 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)3 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)3 ControllerException (com.emc.storageos.volumecontroller.ControllerException)3