Search in sources :

Example 1 with StorageHADomain

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

the class CinderUtils method getStorageAdapter.

/**
 * Creates StorageHADomain for storage port.
 *
 * Cinder API does not provide the information about the storage adapter.
 * Consider it as a dummy storageHADomain for cinder based systems. If the storageHADomain
 * is not populated then the port will not be considered for multipath participatipation. While
 * creating a virtual pool with multiple paths, it gets discarded if storageHADomain is not found.
 *
 * @param storageSystem
 * @param dbClient
 * @return
 */
public static StorageHADomain getStorageAdapter(StorageSystem storageSystem, DbClient dbClient) {
    String cinderHostName = "";
    URI providerUri = storageSystem.getActiveProviderURI();
    StorageProvider provider = dbClient.queryObject(StorageProvider.class, providerUri);
    if (null != provider && null != provider.getKeys()) {
        cinderHostName = provider.getKeyValue(CinderConstants.KEY_CINDER_HOST_NAME);
    }
    String adapterNativeGUID = NativeGUIDGenerator.generateNativeGuid(storageSystem, cinderHostName, NativeGUIDGenerator.ADAPTER);
    StorageHADomain adapter = new StorageHADomain();
    adapter.setStorageDeviceURI(storageSystem.getId());
    adapter.setId(URIUtil.createId(StorageHADomain.class));
    adapter.setAdapterName(cinderHostName);
    adapter.setLabel(cinderHostName);
    adapter.setNativeGuid(adapterNativeGUID);
    adapter.setNumberofPorts("1");
    adapter.setAdapterType(StorageHADomain.HADomainType.FRONTEND.name());
    adapter.setInactive(false);
    dbClient.createObject(adapter);
    return adapter;
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) URI(java.net.URI)

Example 2 with StorageHADomain

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

the class NetAppFileStorageDevice method findVfilerName.

/**
 * Return the vFiler name associated with the file system. If a vFiler is not associated with
 * this file system, then it will return null.
 */
private String findVfilerName(FileShare fs) {
    String portGroup = null;
    URI port = fs.getStoragePort();
    if (port == null) {
        _log.info("No storage port URI to retrieve vFiler name");
    } else {
        StoragePort stPort = _dbClient.queryObject(StoragePort.class, port);
        if (stPort != null) {
            URI haDomainUri = stPort.getStorageHADomain();
            if (haDomainUri == null) {
                _log.info("No Port Group URI for port {}", port);
            } else {
                StorageHADomain haDomain = _dbClient.queryObject(StorageHADomain.class, haDomainUri);
                if (haDomain != null && haDomain.getVirtual() == true) {
                    portGroup = stPort.getPortGroup();
                    _log.debug("using port {} and vFiler {}", stPort.getPortNetworkId(), portGroup);
                }
            }
        }
    }
    return portGroup;
}
Also used : StoragePort(com.emc.storageos.db.client.model.StoragePort) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) URI(java.net.URI)

Example 3 with StorageHADomain

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

the class VNXFileCommunicationInterface method getAllStoragePort.

private List<StoragePort> getAllStoragePort(StorageSystem storageSystem, Boolean isVirtual) throws IOException {
    ArrayList<StoragePort> allStoragePorts = new ArrayList<>();
    List<URI> storagePortURIs = _dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceStoragePortConstraint(storageSystem.getId()));
    List<StoragePort> storagePorts = _dbClient.queryObject(StoragePort.class, storagePortURIs);
    for (StoragePort sp : storagePorts) {
        URI moverOrVdmURI = sp.getStorageHADomain();
        if (!sp.getInactive() && moverOrVdmURI != null) {
            StorageHADomain moverOrVdm = _dbClient.queryObject(StorageHADomain.class, moverOrVdmURI);
            if (moverOrVdm != null) {
                if (moverOrVdm.getVirtual() == isVirtual) {
                    allStoragePorts.add(sp);
                }
            }
        }
    }
    // return ports;
    return allStoragePorts;
}
Also used : StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) URI(java.net.URI)

Example 4 with StorageHADomain

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

the class VNXFileCommunicationInterface method discoverPorts.

/**
 * Retrieve the Data Mover IP Interfaces (aka Storage Ports) for the specified VNX File Storage Array
 *
 * @param system storage system information including credentials.
 * @return Map of New and Existing Storage Ports
 * @throws VNXFileCollectionException
 * @throws IOException
 */
private HashMap<String, List<StoragePort>> discoverPorts(StorageSystem system, Set<StorageHADomain> movers) throws VNXFileCollectionException, VNXException, IOException {
    HashMap<String, List<StoragePort>> storagePorts = new HashMap<String, List<StoragePort>>();
    List<StoragePort> newStoragePorts = new ArrayList<StoragePort>();
    List<StoragePort> existingStoragePorts = new ArrayList<StoragePort>();
    List<PhysicalNAS> modifiedServers = new ArrayList<PhysicalNAS>();
    _logger.info("Start storage port discovery for storage system {}", system.getId());
    // Retrieve the list of data movers interfaces for the VNX File device.
    List<VNXDataMoverIntf> allDmIntfs = getPorts(system);
    List<VNXVdm> vdms = getVdmPortGroups(system);
    // Filter VDM ports
    List<VNXDataMoverIntf> dataMovers = null;
    Map<String, VNXDataMoverIntf> dmIntMap = new HashMap();
    for (VNXDataMoverIntf intf : allDmIntfs) {
        _logger.info("getPorts Adding {} : {}", intf.getName(), intf.getIpAddress());
        dmIntMap.put(intf.getName(), intf);
    }
    // Changes to fix Jira CTRL - 9151
    VNXFileSshApi sshDmApi = new VNXFileSshApi();
    sshDmApi.setConnParams(system.getIpAddress(), system.getUsername(), system.getPassword());
    // collect VDM interfaces
    for (VNXVdm vdm : vdms) {
        // Sometimes getVdmPortGroups(system) method does not collect all VDM interfaces,
        // So running Collect NFS/CIFS interfaces from nas_server -info command. This will return
        // Interfaces assigned to VDM and not thru CIFS servers
        Map<String, String> vdmIntfs = sshDmApi.getVDMInterfaces(vdm.getVdmName());
        for (String vdmIF : vdmIntfs.keySet()) {
            _logger.info("Remove VDM interface {}", vdmIF);
            dmIntMap.remove(vdmIF);
        }
    }
    // Got the filtered out DataMover Interfaces
    List<VNXDataMoverIntf> dmIntfs = new ArrayList(dmIntMap.values());
    _logger.info("Number unfiltered mover interfaces found: {}", allDmIntfs.size());
    _logger.info("Number mover interfaces found: {}", dmIntfs.size());
    // Create the list of storage ports.
    for (VNXDataMoverIntf intf : dmIntfs) {
        StoragePort port = null;
        StorageHADomain matchingHADomain = getMatchingMoverById(movers, intf.getDataMoverId());
        // Check for valid data mover
        if (null == matchingHADomain) {
            continue;
        }
        // Check if storage port was already discovered
        String portNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, intf.getIpAddress(), NativeGUIDGenerator.PORT);
        port = findExistingPort(portNativeGuid);
        if (null == port) {
            // Since a port was not found, attempt with previous naming convention (ADAPTER instead of PORT)
            String oldNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, intf.getIpAddress(), NativeGUIDGenerator.ADAPTER);
            port = findExistingPort(oldNativeGuid);
            if (null != port) {
                // found with old naming convention, therefore update name.
                port.setLabel(portNativeGuid);
                port.setNativeGuid(portNativeGuid);
            }
        }
        // If data mover interface was not previously discovered, add new storage port
        if (port == null) {
            port = new StoragePort();
            port.setId(URIUtil.createId(StoragePort.class));
            port.setLabel(portNativeGuid);
            port.setTransportType("IP");
            port.setNativeGuid(portNativeGuid);
            port.setStorageDevice(system.getId());
            port.setRegistrationStatus(RegistrationStatus.REGISTERED.toString());
            port.setPortName(intf.getName());
            port.setPortNetworkId(intf.getIpAddress());
            port.setPortGroup(intf.getDataMoverId());
            port.setStorageHADomain(matchingHADomain.getId());
            _logger.info("Creating new storage port using NativeGuid : {} name : {}, IP : {}", new Object[] { portNativeGuid, intf.getName(), intf.getIpAddress() });
            newStoragePorts.add(port);
        } else {
            port.setStorageHADomain(matchingHADomain.getId());
            existingStoragePorts.add(port);
        }
        port.setDiscoveryStatus(DiscoveryStatus.VISIBLE.name());
        port.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
        // Set storage port details to vNas
        PhysicalNAS nas = findPhysicalNasByNativeId(system, intf.getDataMoverId());
        if (nas != null) {
            if (nas.getStoragePorts() != null && !nas.getStoragePorts().isEmpty()) {
                if (nas.getStoragePorts().contains(port.getId())) {
                    nas.getStoragePorts().remove(port.getId());
                }
            }
            nas.getStoragePorts().add(port.getId().toString());
            modifiedServers.add(nas);
            _logger.info("PhysicalNAS : {} : port : {} got modified", nas.getId(), port.getPortName());
        }
    }
    // Persist the changed nas servers!!!
    if (modifiedServers != null && !modifiedServers.isEmpty()) {
        _logger.info("Modified PhysicalNAS servers size {}", modifiedServers.size());
        _dbClient.persistObject(modifiedServers);
    }
    _logger.info("Storage port discovery for storage system {} complete", system.getId());
    for (StoragePort newPort : newStoragePorts) {
        _logger.info("New Storage Port : {} : {}", newPort.getNativeGuid(), newPort.getPortName() + ":" + newPort.getId());
    }
    for (StoragePort port : existingStoragePorts) {
        _logger.info("Old Storage Port : {} : {}", port.getNativeGuid(), port.getPortName() + ":" + port.getId());
    }
    storagePorts.put(NEW, newStoragePorts);
    storagePorts.put(EXISTING, existingStoragePorts);
    return storagePorts;
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) VNXDataMoverIntf(com.emc.storageos.vnx.xmlapi.VNXDataMoverIntf) VNXVdm(com.emc.storageos.vnx.xmlapi.VNXVdm) VNXFileSshApi(com.emc.storageos.vnx.xmlapi.VNXFileSshApi) 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) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) PhysicalNAS(com.emc.storageos.db.client.model.PhysicalNAS)

Example 5 with StorageHADomain

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

the class VNXFileCommunicationInterface method getAllVDMs.

private Map<String, StorageHADomain> getAllVDMs(StorageSystem storageSystem) throws IOException {
    Map<String, StorageHADomain> allVDMs = new ConcurrentHashMap<>();
    List<URI> storageAdapterURIs = _dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceStorageHADomainConstraint(storageSystem.getId()));
    List<StorageHADomain> dataMovers = _dbClient.queryObject(StorageHADomain.class, storageAdapterURIs);
    for (StorageHADomain dm : dataMovers) {
        if (!dm.getInactive() && dm.getVirtual()) {
            _logger.info("found a Virtual StorageHADomain for storage system  {} {}", storageSystem.getSerialNumber(), dm.getAdapterName());
            allVDMs.put(dm.getAdapterName(), dm);
        }
    }
    return allVDMs;
}
Also used : StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) URI(java.net.URI)

Aggregations

StorageHADomain (com.emc.storageos.db.client.model.StorageHADomain)80 URI (java.net.URI)41 StoragePort (com.emc.storageos.db.client.model.StoragePort)35 ArrayList (java.util.ArrayList)33 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)26 HashMap (java.util.HashMap)22 List (java.util.List)20 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)19 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)18 StringSet (com.emc.storageos.db.client.model.StringSet)17 VNXException (com.emc.storageos.vnx.xmlapi.VNXException)12 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)11 NamespaceList (com.emc.storageos.plugins.common.domainmodel.NamespaceList)11 URISyntaxException (java.net.URISyntaxException)11 LinkedList (java.util.LinkedList)10 IOException (java.io.IOException)9 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)8 XMLApiResult (com.emc.storageos.vnx.xmlapi.XMLApiResult)8 HashSet (java.util.HashSet)8 Map (java.util.Map)7