Search in sources :

Example 31 with UnManagedExportMask

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask in project coprhd-controller by CoprHD.

the class StorageVolumeInfoProcessor method processVolumes.

/**
 * Process the volumes to find the unmanaged volumes and populate the volume
 * supported information.
 *
 * @param it
 * @param keyMap
 * @param operation
 * @param pool
 * @param system
 * @param exportedVolumes
 * @param volumesAndReplicas
 * @param existingVolumesInCG
 * @param volumeToRAGroupMap
 * @param poolSupportedSLONames
 * @param boundVolumes
 * @param srdfEnabledTargetVPools
 * @param duplicateSyncAspectElementNameMap
 */
private void processVolumes(Iterator<CIMInstance> it, Map<String, Object> keyMap, Operation operation, StoragePool pool, StorageSystem system, Map<String, VolHostIOObject> exportedVolumes, Set<String> existingVolumesInCG, Map<String, RemoteMirrorObject> volumeToRAGroupMap, Map<String, LocalReplicaObject> volumeToLocalReplicaMap, Map<String, Map<String, String>> volumeToSyncAspectMap, Set<String> poolSupportedSLONames, Set<String> boundVolumes, Set<URI> srdfEnabledTargetVPools, Map<String, Set<String>> duplicateSyncAspectElementNameMap) {
    List<CIMObjectPath> metaVolumes = new ArrayList<CIMObjectPath>();
    List<CIMObjectPath> metaVolumeViews = new ArrayList<CIMObjectPath>();
    while (it.hasNext()) {
        CIMInstance volumeViewInstance = null;
        try {
            volumeViewInstance = it.next();
            String volumeNativeGuid = getVolumeViewNativeGuid(volumeViewInstance.getObjectPath(), keyMap);
            Volume volume = checkStorageVolumeExistsInDB(volumeNativeGuid, _dbClient);
            // create UnManaged Volume object for VPLEX VMAX backend volume.
            if (null != volume) {
                _logger.debug("Skipping discovery, as this Volume {} is already being managed by ViPR.", volumeNativeGuid);
                continue;
            }
            // The discovered volume could also be a BlockSnapshot or a BlockMirror so
            // check for these as well.
            BlockSnapshot snap = DiscoveryUtils.checkBlockSnapshotExistsInDB(_dbClient, volumeNativeGuid);
            if (null != snap) {
                _logger.debug("Skipping discovery, as this discovered volume {} is already a managed BlockSnapshot in ViPR.", volumeNativeGuid);
                continue;
            }
            BlockMirror mirror = checkBlockMirrorExistsInDB(volumeNativeGuid, _dbClient);
            if (null != mirror) {
                _logger.debug("Skipping discovery, as this discovered volume {} is already a managed BlockMirror in ViPR.", volumeNativeGuid);
                continue;
            }
            // skip non-bound volumes for this pool
            if (boundVolumes != null) {
                String deviceId = null;
                if (system.getUsingSmis80()) {
                    deviceId = volumeViewInstance.getObjectPath().getKey(DEVICE_ID).getValue().toString();
                } else {
                    deviceId = volumeViewInstance.getObjectPath().getKey(SVDEVICEID).getValue().toString();
                }
                if (!boundVolumes.contains(deviceId)) {
                    _logger.info("Skipping volume, as this Volume {} is not bound to this Thin Storage Pool {}", volumeNativeGuid, pool.getLabel());
                    continue;
                }
            }
            addPath(keyMap, operation.getResult(), volumeViewInstance.getObjectPath());
            String unManagedVolumeNativeGuid = getUnManagedVolumeNativeGuid(volumeViewInstance.getObjectPath(), keyMap);
            UnManagedVolume unManagedVolume = checkUnManagedVolumeExistsInDB(unManagedVolumeNativeGuid, _dbClient);
            unManagedVolume = createUnManagedVolume(unManagedVolume, volumeViewInstance, unManagedVolumeNativeGuid, pool, system, volumeNativeGuid, exportedVolumes, existingVolumesInCG, volumeToRAGroupMap, volumeToLocalReplicaMap, volumeToSyncAspectMap, poolSupportedSLONames, keyMap, srdfEnabledTargetVPools, duplicateSyncAspectElementNameMap);
            // set up UnManagedExportMask information
            boolean nonRpExported = false;
            @SuppressWarnings("unchecked") Map<String, Set<UnManagedExportMask>> masksMap = (Map<String, Set<UnManagedExportMask>>) keyMap.get(Constants.UNMANAGED_EXPORT_MASKS_MAP);
            if (masksMap != null) {
                Set<UnManagedExportMask> uems = masksMap.get(unManagedVolume.getNativeGuid());
                if (uems != null) {
                    _logger.info("{} UnManagedExportMasks found in the keyMap for volume {}", uems.size(), unManagedVolume.getNativeGuid());
                    for (UnManagedExportMask uem : uems) {
                        boolean backendMaskFound = false;
                        _logger.info("   adding UnManagedExportMask {} to UnManagedVolume", uem.getMaskingViewPath());
                        unManagedVolume.getUnmanagedExportMasks().add(uem.getId().toString());
                        uem.getUnmanagedVolumeUris().add(unManagedVolume.getId().toString());
                        if (!_unManagedExportMasksUpdate.contains(uem)) {
                            _unManagedExportMasksUpdate.add(uem);
                        }
                        // add the known initiators, too
                        for (String initUri : uem.getKnownInitiatorUris()) {
                            _logger.info("   adding known Initiator URI {} to UnManagedVolume", initUri);
                            unManagedVolume.getInitiatorUris().add(initUri);
                            Initiator init = _dbClient.queryObject(Initiator.class, URI.create(initUri));
                            unManagedVolume.getInitiatorNetworkIds().add(init.getInitiatorPort());
                        }
                        // log this info for debugging
                        for (String path : uem.getUnmanagedInitiatorNetworkIds()) {
                            _logger.info("   UnManagedExportMask has this initiator unknown to ViPR: {}", path);
                        }
                        // Check if this volume is in an RP mask, and mark it as an RP
                        // volume if it is.
                        Object o = keyMap.get(Constants.UNMANAGED_RECOVERPOINT_MASKS_SET);
                        if (o != null) {
                            Set<String> unmanagedRecoverPointMasks = (Set<String>) o;
                            if (!unmanagedRecoverPointMasks.isEmpty()) {
                                if (unmanagedRecoverPointMasks.contains(uem.getId().toString())) {
                                    _logger.info("unmanaged volume {} is an RP volume", unManagedVolume.getLabel());
                                    unManagedVolume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_RECOVERPOINT_ENABLED.toString(), "true");
                                    backendMaskFound = true;
                                }
                            }
                        }
                        // check if this volume is in a vplex backend mask
                        // and mark it as such if it is
                        o = keyMap.get(Constants.UNMANAGED_VPLEX_BACKEND_MASKS_SET);
                        if (o != null) {
                            Set<String> unmanagedVplexBackendMasks = (Set<String>) o;
                            if (!unmanagedVplexBackendMasks.isEmpty()) {
                                if (unmanagedVplexBackendMasks.contains(uem.getId().toString())) {
                                    _logger.info("unmanaged volume {} is a vplex backend volume", unManagedVolume.getLabel());
                                    unManagedVolume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_VPLEX_BACKEND_VOLUME.toString(), "true");
                                }
                            }
                        }
                        if (!backendMaskFound) {
                            nonRpExported = true;
                        }
                    }
                }
            }
            // this as a convenience to ingest features.
            if (nonRpExported) {
                _logger.info("unmanaged volume {} is exported to something other than RP.  Marking IS_NONRP_EXPORTED.", unManagedVolume.getLabel());
                unManagedVolume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_NONRP_EXPORTED.toString(), "true");
            } else {
                _logger.info("unmanaged volume {} is not exported OR not exported to something other than RP.  Not marking IS_NONRP_EXPORTED.", unManagedVolume.getLabel());
                unManagedVolume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_NONRP_EXPORTED.toString(), "false");
            }
            _logger.debug("Going to check if the volume is meta: {}, volume meta property: {}", volumeViewInstance.getObjectPath(), unManagedVolume.getVolumeCharacterstics().get(SupportedVolumeCharacterstics.IS_METAVOLUME.toString()));
            // Check if the volume is meta volume and add it to the meta
            // volume list
            String isMetaVolume = unManagedVolume.getVolumeCharacterstics().get(SupportedVolumeCharacterstics.IS_METAVOLUME.toString());
            if (null != isMetaVolume && Boolean.valueOf(isMetaVolume)) {
                if (keyMap.containsKey(Constants.IS_NEW_SMIS_PROVIDER) && Boolean.valueOf(keyMap.get(Constants.IS_NEW_SMIS_PROVIDER).toString())) {
                    metaVolumes.add(volumeViewInstance.getObjectPath());
                } else {
                    metaVolumeViews.add(volumeViewInstance.getObjectPath());
                }
                _logger.info("Found meta volume: {}, name: {}", volumeViewInstance.getObjectPath(), unManagedVolume.getLabel());
            }
            // if volumes size reaches 200 , then dump to Db.
            if (_unManagedVolumesInsert.size() > BATCH_SIZE) {
                _partitionManager.insertInBatches(_unManagedVolumesInsert, BATCH_SIZE, _dbClient, UNMANAGED_VOLUME);
                _unManagedVolumesInsert.clear();
            }
            if (_unManagedVolumesUpdate.size() > BATCH_SIZE) {
                _partitionManager.updateAndReIndexInBatches(_unManagedVolumesUpdate, BATCH_SIZE, _dbClient, UNMANAGED_VOLUME);
                _unManagedVolumesUpdate.clear();
            }
            if (_unManagedExportMasksUpdate.size() > BATCH_SIZE) {
                _partitionManager.updateAndReIndexInBatches(_unManagedExportMasksUpdate, BATCH_SIZE, _dbClient, UNMANAGED_EXPORT_MASK);
                _unManagedExportMasksUpdate.clear();
            }
            unManagedVolumesReturnedFromProvider.add(unManagedVolume.getId());
        } catch (Exception ex) {
            _logger.error("Processing UnManaged Storage Volume {} ", volumeViewInstance.getObjectPath(), ex);
        }
    }
    // Add meta volumes to the keyMap
    try {
        if (metaVolumes != null && !metaVolumes.isEmpty()) {
            _metaVolumePaths.addAll(metaVolumes);
            _logger.info("Added {} meta volumes.", metaVolumes.size());
        }
        if (metaVolumeViews != null && !metaVolumeViews.isEmpty()) {
            _metaVolumeViewPaths.addAll(metaVolumeViews);
            _logger.info("Added {} meta volume views.", metaVolumeViews.size());
        }
    } catch (Exception ex) {
        _logger.error("Processing UnManaged meta volumes.", ex);
    }
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Set(java.util.Set) HashSet(java.util.HashSet) StringSet(com.emc.storageos.db.client.model.StringSet) CIMObjectPath(javax.cim.CIMObjectPath) ArrayList(java.util.ArrayList) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) IOException(java.io.IOException) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) Volume(com.emc.storageos.db.client.model.Volume) Initiator(com.emc.storageos.db.client.model.Initiator) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) Map(java.util.Map) HashMap(java.util.HashMap) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)

Example 32 with UnManagedExportMask

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask in project coprhd-controller by CoprHD.

the class ExportHLUProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    CloseableIterator<CIMInstance> protocolControllerForUnitInstances = null;
    EnumerateResponse<CIMInstance> protocolControllerForUnitInstanceChunks = null;
    dbClient = (DbClient) keyMap.get(Constants.dbClient);
    WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
    @SuppressWarnings("unchecked") Map<String, StringSet> volumeToExportMasksHLUMap = (Map<String, StringSet>) keyMap.get(Constants.UN_VOLUME_EXPORT_MASK_HLUS_MAP);
    CIMObjectPath maskingViewPath = null;
    try {
        maskingViewPath = getObjectPathfromCIMArgument(args, keyMap);
        logger.info("Masking view: {}", maskingViewPath.toString());
        UnManagedExportMask uem = getUnManagedExportMask(maskingViewPath);
        if (uem == null) {
            logger.info("Skipping HLU discovery as there is no unmananged export mask found for masking path {}", maskingViewPath.toString());
            return;
        }
        protocolControllerForUnitInstanceChunks = (EnumerateResponse<CIMInstance>) resultObj;
        protocolControllerForUnitInstances = protocolControllerForUnitInstanceChunks.getResponses();
        processMaskHLUs(protocolControllerForUnitInstances, uem, volumeToExportMasksHLUMap);
        while (!protocolControllerForUnitInstanceChunks.isEnd()) {
            logger.info("Processing Next ProtocolControllerForUnit Chunk of size {}", BATCH_SIZE);
            protocolControllerForUnitInstanceChunks = client.getInstancesWithPath(maskingViewPath, protocolControllerForUnitInstanceChunks.getContext(), new UnsignedInteger32(BATCH_SIZE));
            processMaskHLUs(protocolControllerForUnitInstanceChunks.getResponses(), uem, volumeToExportMasksHLUMap);
        }
    } catch (Exception e) {
        String errMsg = "Extracting HLU for exported Volumes failed: " + e.getMessage();
        logger.error(errMsg, e);
        throw SmisException.exceptions.hluRetrievalFailed(errMsg, e);
    } finally {
        if (null != protocolControllerForUnitInstances) {
            protocolControllerForUnitInstances.close();
        }
        if (null != protocolControllerForUnitInstanceChunks) {
            try {
                client.closeEnumeration(maskingViewPath, protocolControllerForUnitInstanceChunks.getContext());
            } catch (Exception e) {
                logger.debug("Exception occurred while closing enumeration", e);
            }
        }
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) UnsignedInteger32(javax.cim.UnsignedInteger32) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) StringSet(com.emc.storageos.db.client.model.StringSet) WBEMClient(javax.wbem.client.WBEMClient) Map(java.util.Map) UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)

Example 33 with UnManagedExportMask

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask in project coprhd-controller by CoprHD.

the class ExportHLUProcessor method getUnManagedExportMask.

/**
 * Returns an UnManagedExportMask if it exists for the requested CIMObjectPath
 *
 * @param cimObjectPath the CIMObjectPath for the Unmanaged Export on the storage array
 * @return an UnManagedExportMask object to use
 */
protected UnManagedExportMask getUnManagedExportMask(CIMObjectPath cimObjectPath) {
    URIQueryResultList result = new URIQueryResultList();
    dbClient.queryByConstraint(AlternateIdConstraint.Factory.getUnManagedExportMaskPathConstraint(cimObjectPath.toString()), result);
    Iterator<URI> it = result.iterator();
    while (it.hasNext()) {
        UnManagedExportMask uem = dbClient.queryObject(UnManagedExportMask.class, it.next());
        if (uem != null && !uem.getInactive()) {
            return uem;
        }
    }
    return null;
}
Also used : URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)

Example 34 with UnManagedExportMask

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask in project coprhd-controller by CoprHD.

the class ExportProcessor method getUnManagedExportMask.

/**
 * Returns an UnManagedExportMask if it exists for the requested
 * CIMObjectPath, or creates a new one if none exists.
 *
 * @param cimObjectPath the CIMObjectPath for the Unmanaged Export on the storage array
 * @return an UnManagedExportMask object to use
 */
protected UnManagedExportMask getUnManagedExportMask(CIMObjectPath cimObjectPath) {
    URIQueryResultList result = new URIQueryResultList();
    _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getUnManagedExportMaskPathConstraint(cimObjectPath.toString()), result);
    UnManagedExportMask uem = null;
    Iterator<URI> it = result.iterator();
    if (it.hasNext()) {
        uem = _dbClient.queryObject(UnManagedExportMask.class, it.next());
    }
    if (uem != null && !uem.getInactive()) {
        getUnManagedExportMasksToUpdate().add(uem);
        // clean up collections (we'll be refreshing them)
        uem.getKnownInitiatorUris().clear();
        uem.getKnownInitiatorNetworkIds().clear();
        uem.getKnownStoragePortUris().clear();
        uem.getKnownVolumeUris().clear();
        uem.getUnmanagedInitiatorNetworkIds().clear();
        uem.getUnmanagedStoragePortNetworkIds().clear();
        uem.getUnmanagedVolumeUris().clear();
    } else {
        uem = new UnManagedExportMask();
        getUnManagedExportMasksToCreate().add(uem);
    }
    return uem;
}
Also used : URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)

Example 35 with UnManagedExportMask

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask in project coprhd-controller by CoprHD.

the class ExportProcessor method processVolumesAndInitiatorsPaths.

private void processVolumesAndInitiatorsPaths(CloseableIterator<CIMInstance> it, UnManagedExportMask mask, List<Initiator> matchedInitiators, List<StoragePort> matchedPorts, Set<String> knownIniSet, Set<String> knownNetworkIdSet, Set<String> knownPortSet, Set<String> knownVolumeSet) {
    while (it.hasNext()) {
        CIMInstance cimi = it.next();
        _logger.info("looking at classname: " + cimi.getClassName());
        switch(cimi.getClassName()) {
            // process initiators
            case SmisConstants.CP_SE_STORAGE_HARDWARE_ID:
                String initiatorNetworkId = this.getCIMPropertyValue(cimi, SmisConstants.CP_STORAGE_ID);
                _logger.info("looking at initiator network id " + initiatorNetworkId);
                if (WWNUtility.isValidNoColonWWN(initiatorNetworkId)) {
                    initiatorNetworkId = WWNUtility.getWWNWithColons(initiatorNetworkId);
                    _logger.info("   wwn normalized to " + initiatorNetworkId);
                } else if (WWNUtility.isValidWWN(initiatorNetworkId)) {
                    initiatorNetworkId = initiatorNetworkId.toUpperCase();
                    _logger.info("   wwn normalized to " + initiatorNetworkId);
                } else if (initiatorNetworkId.matches(ISCSI_PATTERN) && (iSCSIUtility.isValidIQNPortName(initiatorNetworkId) || iSCSIUtility.isValidEUIPortName(initiatorNetworkId))) {
                    _logger.info("   iSCSI storage port normalized to " + initiatorNetworkId);
                } else {
                    _logger.warn("   this is not a valid FC or iSCSI network id format, skipping");
                    continue;
                }
                // check if a host initiator exists for this id
                // if so, add to _knownInitiators
                // otherwise, add to _unmanagedInitiators
                Initiator knownInitiator = NetworkUtil.getInitiator(initiatorNetworkId, _dbClient);
                if (knownInitiator != null) {
                    _logger.info("   found an initiator in ViPR on host " + knownInitiator.getHostName());
                    knownIniSet.add(knownInitiator.getId().toString());
                    knownNetworkIdSet.add(knownInitiator.getInitiatorPort());
                    if (HostInterface.Protocol.FC.toString().equals(knownInitiator.getProtocol())) {
                        matchedInitiators.add(knownInitiator);
                    }
                } else {
                    _logger.info("   no hosts in ViPR found configured for initiator " + initiatorNetworkId);
                    mask.getUnmanagedInitiatorNetworkIds().add(initiatorNetworkId);
                }
                break;
            // process FC and ISCSI target ports
            case SmisConstants.CP_SYMM_FCSCSI_PROTOCOL_ENDPOINT:
            case SmisConstants.CP_SYMM_ISCSI_PROTOCOL_ENDPOINT:
            case SmisConstants.CP_CLAR_FCSCSI_PROTOCOL_ENDPOINT:
            case SmisConstants.CP_CLAR_ISCSI_PROTOCOL_ENDPOINT:
            case SmisConstants.CP_CLAR_FRONTEND_FC_PORT:
                String portNetworkId = this.getCIMPropertyValue(cimi, SmisConstants.CP_NAME);
                if (portNetworkId == null) {
                    portNetworkId = this.getCIMPropertyValue(cimi, SmisConstants.CP_PERMANENT_ADDRESS);
                }
                _logger.info("looking at storage port network id " + portNetworkId);
                if (WWNUtility.isValidNoColonWWN(portNetworkId)) {
                    portNetworkId = WWNUtility.getWWNWithColons(portNetworkId);
                    _logger.info("   wwn normalized to " + portNetworkId);
                } else if (WWNUtility.isValidWWN(portNetworkId)) {
                    portNetworkId = portNetworkId.toUpperCase();
                    _logger.info("   wwn normalized to " + portNetworkId);
                } else if (portNetworkId.matches(ISCSI_PATTERN) && (iSCSIUtility.isValidIQNPortName(portNetworkId) || iSCSIUtility.isValidEUIPortName(portNetworkId))) {
                    // comes from SMI-S in the following format (just want the
                    // first part)
                    // "iqn.1992-04.com.emc:50000973f0065980,t,0x0001"
                    portNetworkId = portNetworkId.split(",")[0];
                    _logger.info("   iSCSI storage port normalized to " + portNetworkId);
                } else {
                    _logger.warn("   this is not a valid WWN or iSCSI format, skipping");
                    continue;
                }
                // check if a storage port exists for this id in ViPR
                // if so, add to _storagePorts
                StoragePort knownStoragePort = NetworkUtil.getStoragePort(portNetworkId, _dbClient);
                if (knownStoragePort != null) {
                    _logger.info("   found a matching storage port in ViPR " + knownStoragePort.getLabel());
                    knownPortSet.add(knownStoragePort.getId().toString());
                    if (TransportType.FC.toString().equals(knownStoragePort.getTransportType())) {
                        matchedPorts.add(knownStoragePort);
                    }
                } else {
                    _logger.info("   no storage port in ViPR found matching portNetworkId " + portNetworkId);
                    mask.getUnmanagedStoragePortNetworkIds().add(portNetworkId);
                }
                break;
            // process storage volumes
            case _symmvolume:
            case _clarvolume:
                CIMObjectPath volumePath = cimi.getObjectPath();
                _logger.info("volumePath is " + volumePath.toString());
                String systemName = volumePath.getKey(SmisConstants.CP_SYSTEM_NAME).getValue().toString();
                systemName = systemName.replaceAll(Constants.SMIS80_DELIMITER_REGEX, Constants.PLUS);
                String id = volumePath.getKey(SmisConstants.CP_DEVICE_ID).getValue().toString();
                _logger.info("systemName is " + systemName);
                _logger.info("id is " + id);
                String nativeGuid = NativeGUIDGenerator.generateNativeGuidForVolumeOrBlockSnapShot(systemName.toUpperCase(), id);
                _logger.info("nativeGuid for looking up ViPR volumes is " + nativeGuid);
                URIQueryResultList result = new URIQueryResultList();
                _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeNativeGuidConstraint(nativeGuid), result);
                Volume volume = null;
                Iterator<URI> volumes = result.iterator();
                if (volumes.hasNext()) {
                    volume = _dbClient.queryObject(Volume.class, volumes.next());
                    if (null != volume) {
                        knownVolumeSet.add(volume.getId().toString());
                    }
                }
                nativeGuid = NativeGUIDGenerator.generateNativeGuidForPreExistingVolume(systemName.toUpperCase(), id);
                _logger.info("   nativeGuid for keying UnManagedVolumes is " + nativeGuid);
                // add to map of volume paths to export masks
                Set<UnManagedExportMask> maskSet = getVolumeToExportMasksMap().get(nativeGuid);
                if (maskSet == null) {
                    maskSet = new HashSet<UnManagedExportMask>();
                    _logger.info("   creating maskSet for nativeGuid " + nativeGuid);
                    getVolumeToExportMasksMap().put(nativeGuid, maskSet);
                }
                maskSet.add(mask);
                break;
            case SmisConstants.CP_SE_TARGET_MASKING_GROUP:
                String portGroupName = this.getCIMPropertyValue(cimi, SmisConstants.CP_ELEMENT_NAME);
                if (portGroupName == null) {
                    portGroupName = this.getCIMPropertyValue(cimi, SmisConstants.CP_NAME);
                }
                mask.setPortGroup(portGroupName);
                _logger.info(String.format("Set the port group %s in the export mask", portGroupName));
                break;
            default:
                break;
        }
    }
    if (mask.getId() == null) {
        mask.setId(URIUtil.createId(UnManagedExportMask.class));
    }
    handlePersistence();
    getAllCurrentUnManagedExportMaskUris().add(mask.getId());
}
Also used : Initiator(com.emc.storageos.db.client.model.Initiator) Volume(com.emc.storageos.db.client.model.Volume) StoragePort(com.emc.storageos.db.client.model.StoragePort) CIMObjectPath(javax.cim.CIMObjectPath) URI(java.net.URI) CIMInstance(javax.cim.CIMInstance) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)

Aggregations

UnManagedExportMask (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)46 URI (java.net.URI)33 ArrayList (java.util.ArrayList)26 HashSet (java.util.HashSet)20 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)19 StringSet (com.emc.storageos.db.client.model.StringSet)17 Initiator (com.emc.storageos.db.client.model.Initiator)15 HashMap (java.util.HashMap)14 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)13 ExportMask (com.emc.storageos.db.client.model.ExportMask)8 NamedURI (com.emc.storageos.db.client.model.NamedURI)8 Map (java.util.Map)8 Set (java.util.Set)8 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)7 Volume (com.emc.storageos.db.client.model.Volume)7 StoragePort (com.emc.storageos.db.client.model.StoragePort)6 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)6 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)6 CIMInstance (javax.cim.CIMInstance)5 CIMObjectPath (javax.cim.CIMObjectPath)5