Search in sources :

Example 6 with VNXCifsServer

use of com.emc.storageos.vnx.xmlapi.VNXCifsServer in project coprhd-controller by CoprHD.

the class VNXFileCommunicationInterface method getCifServers.

private List<VNXCifsServer> getCifServers(final StorageSystem system) throws VNXException {
    List<VNXCifsServer> cifsServers;
    try {
        Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
        _discExecutor.setKeyMap(reqAttributeMap);
        _discExecutor.execute((Namespace) _discNamespaces.getNsList().get(VNXFileConstants.VNX_FILE_CIFS_CONFIG));
        cifsServers = (List<VNXCifsServer>) _discExecutor.getKeyMap().get(VNXFileConstants.CIFS_SERVERS);
    } catch (BaseCollectionException e) {
        throw new VNXException("Get CifServers op failed", e);
    }
    return cifsServers;
}
Also used : VNXCifsServer(com.emc.storageos.vnx.xmlapi.VNXCifsServer) VNXException(com.emc.storageos.vnx.xmlapi.VNXException) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject) UnManagedDiscoveredObject(com.emc.storageos.db.client.model.UnManagedDiscoveredObject) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 7 with VNXCifsServer

use of com.emc.storageos.vnx.xmlapi.VNXCifsServer in project coprhd-controller by CoprHD.

the class VNXFileCommunicationInterface method discoverPortGroups.

/**
 * Discover the Data Movers (Port Groups) for the specified VNX File storage array.
 *
 * @param system storage system information including credentials.
 * @return Map of New and Existing port groups
 * @throws VNXFileCollectionException
 */
private HashMap<String, List<StorageHADomain>> discoverPortGroups(StorageSystem system, StringSet fileSharingProtocols) throws VNXFileCollectionException, VNXException {
    HashMap<String, List<StorageHADomain>> portGroups = new HashMap<String, List<StorageHADomain>>();
    List<StorageHADomain> newPortGroups = new ArrayList<StorageHADomain>();
    List<StorageHADomain> existingPortGroups = new ArrayList<StorageHADomain>();
    boolean isNfsCifsSupported = false;
    List<PhysicalNAS> newNasServers = new ArrayList<PhysicalNAS>();
    List<PhysicalNAS> existingNasServers = new ArrayList<PhysicalNAS>();
    _logger.info("Start port group discovery for storage system {}", system.getId());
    List<VNXDataMover> dataMovers = getPortGroups(system);
    _logger.debug("Number movers found: {}", dataMovers.size());
    for (VNXDataMover mover : dataMovers) {
        StorageHADomain portGroup = null;
        if (null == mover) {
            _logger.debug("Null data mover in list of port groups.");
            continue;
        }
        if (mover.getRole().equals(DM_ROLE_STANDBY)) {
            _logger.debug("Found standby data mover");
            continue;
        }
        // Check if port group was previously discovered
        URIQueryResultList results = new URIQueryResultList();
        String adapterNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, mover.getName(), NativeGUIDGenerator.ADAPTER);
        _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageHADomainByNativeGuidConstraint(adapterNativeGuid), results);
        Iterator<URI> iter = results.iterator();
        while (iter.hasNext()) {
            StorageHADomain tmpGroup = _dbClient.queryObject(StorageHADomain.class, iter.next());
            if (tmpGroup != null && !tmpGroup.getInactive() && tmpGroup.getStorageDeviceURI().equals(system.getId())) {
                portGroup = tmpGroup;
                _logger.debug("Found duplicate {} ", mover.getName());
            }
        }
        List<VNXCifsServer> cifsServers = getCifServers(system, String.valueOf(mover.getId()), "false");
        CifsServerMap cifsServersMap = new CifsServerMap();
        for (VNXCifsServer cifsServer : cifsServers) {
            _logger.info("Cifs Server {} for {} ", cifsServer.getName(), mover.getName());
            NasCifsServer nasCifsServer = new NasCifsServer();
            nasCifsServer.setId(cifsServer.getId());
            nasCifsServer.setInterfaces(cifsServer.getInterfaces());
            nasCifsServer.setMoverIdIsVdm(cifsServer.getMoverIdIsVdm());
            nasCifsServer.setName(cifsServer.getName());
            nasCifsServer.setType(cifsServer.getType());
            nasCifsServer.setDomain(cifsServer.getDomain());
            cifsServersMap.put(cifsServer.getName(), nasCifsServer);
        }
        // Check supported network file sharing protocols.
        StringSet protocols = new StringSet();
        protocols.add(StorageProtocol.File.NFS.name());
        protocols.add(StorageProtocol.File.CIFS.name());
        // If the data mover (aka port group) was not previously discovered
        if (portGroup == null) {
            portGroup = new StorageHADomain();
            portGroup.setId(URIUtil.createId(StorageHADomain.class));
            portGroup.setNativeGuid(adapterNativeGuid);
            portGroup.setStorageDeviceURI(system.getId());
            portGroup.setAdapterName(mover.getName());
            portGroup.setVirtual(false);
            portGroup.setName((Integer.toString(mover.getId())));
            portGroup.setFileSharingProtocols(protocols);
            _logger.info("Found data mover {} at {}", mover.getName(), mover.getId());
            newPortGroups.add(portGroup);
        } else {
            // Set protocols if it has changed between discoveries or a upgrade scenario
            portGroup.setFileSharingProtocols(protocols);
            existingPortGroups.add(portGroup);
        }
        PhysicalNAS existingNas = findPhysicalNasByNativeId(system, String.valueOf(mover.getId()));
        if (existingNas != null) {
            existingNas.setProtocols(protocols);
            existingNas.setCifsServersMap(cifsServersMap);
            existingNasServers.add(existingNas);
        } else {
            PhysicalNAS physicalNas = createPhysicalNas(system, mover);
            if (physicalNas != null) {
                physicalNas.setProtocols(protocols);
                physicalNas.setCifsServersMap(cifsServersMap);
                newNasServers.add(physicalNas);
            }
        }
    }
    // Persist the NAS servers!!!
    if (existingNasServers != null && !existingNasServers.isEmpty()) {
        _logger.info("discoverPortGroups - modified PhysicalNAS servers size {}", existingNasServers.size());
        _dbClient.persistObject(existingNasServers);
    }
    if (newNasServers != null && !newNasServers.isEmpty()) {
        _logger.info("discoverPortGroups - new PhysicalNAS servers size {}", newNasServers.size());
        _dbClient.createObject(newNasServers);
    }
    // With current API, NFS/CIFS is assumed to be always supported.
    fileSharingProtocols.add(StorageProtocol.File.NFS.name());
    fileSharingProtocols.add(StorageProtocol.File.CIFS.name());
    _logger.info("Port group discovery for storage system {} complete.", system.getId());
    for (StorageHADomain newDomain : newPortGroups) {
        _logger.info("New Storage Domain : {} : {}", newDomain.getNativeGuid(), newDomain.getAdapterName() + ":" + newDomain.getId());
    }
    for (StorageHADomain domain : existingPortGroups) {
        _logger.info("Old Storage Domain : {} : {}", domain.getNativeGuid(), domain.getAdapterName() + ":" + domain.getId());
    }
    // return portGroups;
    portGroups.put(NEW, newPortGroups);
    portGroups.put(EXISTING, existingPortGroups);
    return portGroups;
}
Also used : VNXCifsServer(com.emc.storageos.vnx.xmlapi.VNXCifsServer) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) VNXDataMover(com.emc.storageos.vnx.xmlapi.VNXDataMover) CifsServerMap(com.emc.storageos.db.client.model.CifsServerMap) StringSet(com.emc.storageos.db.client.model.StringSet) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) NamespaceList(com.emc.storageos.plugins.common.domainmodel.NamespaceList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) NasCifsServer(com.emc.storageos.db.client.model.NasCifsServer) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) PhysicalNAS(com.emc.storageos.db.client.model.PhysicalNAS)

Aggregations

VNXCifsServer (com.emc.storageos.vnx.xmlapi.VNXCifsServer)7 ArrayList (java.util.ArrayList)5 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)4 NamespaceList (com.emc.storageos.plugins.common.domainmodel.NamespaceList)4 VNXException (com.emc.storageos.vnx.xmlapi.VNXException)4 List (java.util.List)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)4 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)3 CifsServerMap (com.emc.storageos.db.client.model.CifsServerMap)2 DiscoveredDataObject (com.emc.storageos.db.client.model.DiscoveredDataObject)2 FileObject (com.emc.storageos.db.client.model.FileObject)2 FileShare (com.emc.storageos.db.client.model.FileShare)2 NasCifsServer (com.emc.storageos.db.client.model.NasCifsServer)2 PhysicalNAS (com.emc.storageos.db.client.model.PhysicalNAS)2 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)2 StorageHADomain (com.emc.storageos.db.client.model.StorageHADomain)2 StringSet (com.emc.storageos.db.client.model.StringSet)2 UnManagedDiscoveredObject (com.emc.storageos.db.client.model.UnManagedDiscoveredObject)2 XMLApiResult (com.emc.storageos.vnx.xmlapi.XMLApiResult)2 URI (java.net.URI)2