跳转到: 导航, 搜索

Mellanox-Neutron-Havana-Redhat


概述

Mellanox Neutron 插件

Openstack Mellanox Neutron 插件支持 Mellanox 嵌入式交换机功能,作为 VPI(以太网/InfiniBand)HCA 的一部分。Mellanox Neutron 插件允许每个虚拟机 vNIC 具有其独特的硬件 vNIC(基于 SR-IOV 虚拟功能),具有独特的连接性、安全性和 QoS 属性。硬件 vNIC 可以通过准虚拟化(使用 Tap 设备)映射到客户机 VM,或者直接作为虚拟 PCI 设备映射到客户机,从而实现更高的性能和高级功能,例如 RDMA(远程直接内存访问)。

基于硬件的交换,为虚拟云环境提供更好的性能、功能以及安全性和隔离性。插件的未来版本将包括 OpenFlow API,以控制和监控嵌入式交换机和 vNIC 功能。

此插件是根据 Plugin-Agent 模式实现的。


   	         +-----------------+                       +--------------+
                 | Controller node |                       | Compute node |
       +-----------------------------------+     +-----------------------------------+
       |  +-----------+      +----------+  |     |  +----------+       +----------+  |
       |  |           |      |          |  |     |  |          |  zmq  |          |  |
       |  | Openstack | v2.0 | Mellanox |  | RPC |  | Mellanox |REQ/REP| Mellanox |  |
       |  | Neutron   +------+ Neutron  +-----------+ Neutron  +-------+ Embedded |  |
       |  |           |      | Plugin   |  |     |  | Agent    |       | Switch   |  |
       |  |           |      |          |  |     |  |          |       | (NIC)    |  |
       |  +-----------+      +----------+  |     |  +----------+       +----------+  |
       +-----------------------------------+     +-----------------------------------+
  • Openstack Mellanox Neutron 插件实现了 Neutron v2.0 API。
  • Mellanox Neutron 插件处理 Neutron API 调用并管理网络分段 ID 分配。
  • 该插件使用数据库来存储配置和分配映射。
  • 该插件与 Linux Bridge 插件保持兼容,通过在网络节点上运行 L2 Linux Bridge Agent 来支持 DHCP 和 L3 Agent。
  • Mellanox Openstack Neutron Agent(L2 Agent)在每个计算节点上运行。
  • Agent 应根据 VIF(VM vNIC)和嵌入式交换机端口之间的映射应用 VIF 连接性。

Mellanox Nova VIF 驱动程序

在使用 Mellanox Neutron 插件时,应使用 Mellanox Nova VIF 驱动程序。此驱动程序通过将 vNIC(准虚拟化或 SR-IOV,可选的 RDMA 客户机访问)绑定到嵌入式交换机端口来支持 VIF 插件。Nova 中包含用于准虚拟化模式的 VIF 驱动程序。对于 SR-IOV 直通,需要使用 Mellanox git 仓库或 RPM 中的 VIF 驱动程序。

先决条件

使用 Red Hat Enterprise Linux OpenStack Platform 安装

请确保您遵循 Red Hat Enterprise Linux OpenStack Platform 所需的 Red Hat 先决条件。请参阅 https://access.redhat.com/products/Cloud/OpenStack/,以获取有关此产品的更多信息。

其他 Red Hat 参考资料

1. RHOS 参考文档

2. RDO 快速入门


Neutron 服务器

无需特殊先决条件。


计算节点

1. python-pip(使用“yum install python-pip”)

2. 计算节点应配备 Mellanox ConnectX®-3 网络适配器(链接

3. 安装了 Mellanox OFED 2.0.3 或更高版本。请参阅 Mellanox 网站以获取最新的 OFED([1]

4. 在 ConnectX-3 卡上启用 SR-IOV。请参阅 Mellanox 社区

5. 软件包 iproute2 -(代码 文档)必须安装。仅需要在计算节点上安装

6. 软件包 ethtool(代码)必须安装(版本 3.8 或更高版本)。仅需要在计算节点上安装。

7. oslo.config(使用“pip-python install oslo.config”)。仅需要在计算节点上安装。


网络节点

1. 网络节点应配备 Mellanox ConnectX®-3 网络适配器(链接

2. 安装了 Mellanox OFED 2.0.3 或更高版本。请参阅 Mellanox 网站以获取最新的 OFED([2]

以太网网络

控制器节点

在 /etc/nova/nova.conf 中,请确保您有以下行

  security_group_api=nova

如果更改了它 - 请重新启动 nova 服务(例如 cd /etc/init.d && for i in $( ls openstack-nova-*); do service $i restart; done)

Neutron 服务器节点

安装

1. Neutron 服务器使用 MySQL 数据库。请确保您有正在运行的 Neutron MySQL 数据库。

如果 Neutron 服务器已经运行,则应停止它。

  #/etc/init.d/neutron-server stop

如果您想使用创建的数据库,则必须删除它并创建另一个数据库。例如

  mysql -u root -ppassword <<EOF
  drop database if exists neutron;
  create database neutron;
  EOF

如果您想创建一个新的数据库

  mysql -u root -ppassword <<EOF
  drop database if exists neutron;
  create database neutron;
  GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'password';
  GRANT ALL PRIVILEGES ON neutron.* TO 'neutron' IDENTIFIED BY 'password';
  FLUSH PRIVILEGES;
  EOF


2. 安装 Mellanox Neutron 插件的所需 RPM

  #yum install openstack-neutron-mellanox

3. 修改 /etc/neutron/neutron.conf 文件。

  core_plugin = neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin

4. 修改 /etc/neutron/plugins/mlnx/mlnx_conf.ini 文件以反映您的环境。单击 此处 以获取配置选项。

5. 更改插件配置文件的软链接(plugin.ini)

  #unlink /etc/neutron/plugin.ini 
  #ln -s /etc/neutron/plugins/mlnx/mlnx_conf.ini /etc/neutron/plugin.ini

配置

1. 通过编辑 neutron.conf 并更改 core_plugin,使 Mellanox 插件成为当前的 Neutron 插件。

  core_plugin = neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin

2. 插件配置:编辑配置文件:/etc/neutron/plugins/mlnx/mlnx_conf.ini

  [DATABASE]
  sql_connection - The parameter should be changed to the connection of the Neutron DB used by the plugin.
                   It must match the mysql configuration. For example:
                   "mysql://neutron:password@127.0.0.1:3306/neutron"
  reconnect_interval = 2 (default)


  [MLNX]
  tenant_network_type - must be set on of supported tenant network types.  
                        Possible values: 'vlan' for Ethernet or 'ib' for Infiniband.'vlan' is the default.
  network_vlan_ranges - must be configured to specify the names of the physical networks
                        managed by the mellanox plugin, along with the ranges of VLAN IDs
                        available on each physical network for allocation to virtual networks. 
                        Possible range is vlan range is 1-4093. 
                        The default  is "default:1:100" 
                        <fabric name >:<vlan range start>:<vlan end range>
   [agent]
   # Agent's polling interval in seconds
   # polling_interval = 2
   # (BoolOpt) Enable server RPC compatibility with old (pre-havana)
   # agents.
   #
   rpc_support_old_agents = True

注意:rpc_support_old_agents 应设置为“True”(非默认值)。

启动服务

启动(或重新启动)Neutron 服务器

  #/etc/init.d/neutron-server start

计算节点

安装

1. 如果您没有下载 Mellanox OpenStack 仓库文件,请下载它 

#wget http://www.mellanox.com/downloads/solutions/openstack/havana/repo/mlnx-havana/mlnx-havana.repo -O /etc/yum.repos.d/mlnx-havana.repo

2. 安装 eswitchd RPM

#yum install eswitchd

3. 如果您想使用以太网的准虚拟化模式,VIF 驱动程序已包含在 Nova 包中。否则,请安装 Mellanox VIF 驱动程序(确保 nova 已安装在您的服务器上)

#yum install mlnxvif

4. 安装 Neutron 代理的所需 RPM

#yum install openstack-neutron-mellanox

配置

1. 如果需要,配置 /etc/eswitchd/eswitchd.conf

请参阅 Mellanox 社区以获取 eSwitchd 安装说明(单击 此处

2. 修改 /etc/nova/nova.conf

   compute_driver=nova.virt.libvirt.driver.LibvirtDriver
   libvirt_vif_driver=mlnxvif.vif.MlxEthVIFDriver
   security_group_api=nova
   connection_type=libvirt

如果您尚未安装 Mellanox VIF 驱动程序,并且计划仅以准虚拟化模式使用以太网:更改以下内容

   libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtGenericVIFDriver

3. 修改 /etc/neutron/plugins/mlnx/mlnx_conf.ini 文件以反映您的环境。

  [AGENT]
  polling_interval - Polling interval (in seconds) for existing vNICs. The default is 2 seconds.
  rpc  - must be set to 'True'
  [ESWITCH]
  physical_interface_mapping -  the network_interface_mappings maps each physical network name to the physical interface (on top of Mellanox Adapter) connecting the node to that physical network. The format of this paramter is:     <fabric name>:< PF name> (Only releavant on Compute node). PF Name can either be the PF (Physical Function) Name or 'autoeth' for automatic Ethernet configuration,'autoib' for automatic Infiniband configuration.The default is  "default:autoeth".  
  vnic_type - type of VM network interface: 'mlnx_direct' or 'hostdev' according to libvirt terminology.
        hostdev: this is the traditional method of assigning any generic PCI device to a guest (SR-IOV).
        mlnx_direct: this is a method to provide macvtap device on top of the PCI device (default).
        bridge:  - When using Linux Bridge Plugin on top of eIPoIB device
  daemon_endpoint - eswitch daemon end point connection (URL) (default value='tcp://127.0.0.1:5001')
                    daemon_endpoint should be changed to tcp://127.0.0.1:60001
  request_timeout - the number of milliseconds the agent will wait for response on request to daemon. (default=3000 msec)

注意:daemon_endpoint 应更改为 tcp://127.0.0.1:60001

有关插件配置文件示例(Havana),请参阅 Mellanox config *ini 文件

启动服务

1. 重新启动 Nova。

  #/etc/init.d/openstack-nova-compute restart

2. 启动 eswitch 守护程序

   #/etc/init.d/eswitchd start

3. 启动 Neutron 代理

  #/etc/init.d/neutron-mlnx-agent start

注意:在启动 Neutron 代理之前,应启动 eswitch 守护程序。


网络节点

1. 安装 Neutron linux bridge 插件和 Neutron dhcp l3-agent

  #yum install openstack-neutron-linuxbridge

2. 更改 ini 文件(/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini)中的以下配置。示例中的“default”是根据 /etc/neutron/plugins/mlnx/mlnx_conf.ini 中配置的物理网络的名称。

  physical_interface_mappings = default:eth2 

3. 按照以下指南配置 DHCP 服务器

使用以下内容更新以下文件:/etc/neutron/dhcp_agent.ini

  interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver 

有关更多信息,请参阅:https://docs.openstack.org/trunk/openstack-network/admin/content/adv_cfg_dhcp_agent.html

4. 启动 DHCP 服务器

  #/etc/init.d/neutron-linuxbridge-agent start
  #/etc/init.d/neutron-dhcp-agent start

InfiniBand 网络

Mellanox Neutron 插件使用 InfiniBand 分区(PKeys)来分隔网络。

SM 配置

OpenSM 配置 - 无 UFM

所有 PKeys 均应在 partitions.conf 文件(/etc/opensm/partitions.conf)中预定义(未来阶段计划自动配置)

在 partitions.conf 文件中添加/更改以下内容

  management=0x7fff,ipoib, sl=0, defmember=full : ALL, ALL_SWITCHES=full,SELF=full;

对于您想在 Neutron 中配置的每个网络,您必须配置与该网络 VLAN 关联的 pkey(在 Neutron 中定义)。

  vlan1=0x1, ipoib, sl=0, defmember=full : ALL;

例如:如果我们在 /etc/neutron/plugins/mlnx/mlnx_conf.ini 中定义了 10 个 VLAN

  [MLNX]
  network_vlan_ranges = default:1:10

我们将拥有以下 partitions.conf 文件的配置

  management=0x7fff,ipoib, sl=0, defmember=full : ALL, ALL_SWITCHES=full,SELF=full;
  vlan1=0x1, ipoib, sl=0, defmember=full : ALL;
  vlan2=0x2, ipoib, sl=0, defmember=full : ALL;
  vlan3=0x3, ipoib, sl=0, defmember=full : ALL;
  vlan4=0x4, ipoib, sl=0, defmember=full : ALL;
  vlan5=0x5, ipoib, sl=0, defmember=full : ALL;
  vlan6=0x6, ipoib, sl=0, defmember=full : ALL;
  vlan7=0x7, ipoib, sl=0, defmember=full : ALL;
  vlan8=0x8, ipoib, sl=0, defmember=full : ALL;
  vlan9=0x9, ipoib, sl=0, defmember=full : ALL;
  vlan10=0xa, ipoib, sl=0, defmember=full : ALL;

在 /etc/opensm/opensm.conf 中更改以下内容

  allow_both_pkeys TRUE


重新启动 openSM

  #/etc/init.d/opensmd restart

OpenSM 配置 - 有 UFM

1. 确保 UFM 已安装并连接到您的织物。

2. 编辑 /opt/ufm/conf/opensm/opensm.conf 并更改以下值

a) 将 allow_both_pkeys 设置为 TRUE(默认情况下 allow_both_pkeys 为 FALSE)

  #Allow both full and limited membership on the same partition
  allow_both_pkeys TRUE

b) 将 sm_assign_guid_func 设置为 uniq_count(默认情况下 sm_assign_guid_func 为 base_port)

  #SM assigned Alias GUIDs algorithm
  sm_assign_guid_func uniq_count

3. 编辑 UFM 用户扩展 partitions.conf 以覆盖默认分区配置。

a) 编辑文件:/opt/ufm/conf/partitions.conf.user_ext(在 UFM 新鲜安装后应为空)

b) 将以下行添加到文件,以启用完全和有限管理 pkey

  management=0xffff,ipoib, sl=0, defmember=both : ALL, ALL_SWITCHES=full,SELF=full;

c) 添加与特定设置相关的其他 pkey 定义 - 例如

  vlan1=0x1, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan2=0x2, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan3=0x3, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan4=0x4, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan5=0x5, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan6=0x6, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan7=0x7, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan8=0x8, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan9=0x9, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan10=0xa, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan10=0xb, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan10=0xc, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan10=0xd, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan10=0xe, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan10=0xf, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan10=0x10, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan10=0x11, ipoib, sl=0, defmember=full : ALL_CAS;
  vlan10=0x12, ipoib, sl=0, defmember=full : ALL_CAS;

4. 重新启动 UFM

独立

  /etc/init.d/ufmd restart

高可用性

  /etc/init.d/ufmha restart

Neutron 服务器节点

SR-IOV

SR-IOV 是一种直通模式。在文件 /etc/neutron/plugins/mlnx/mlnx_conf.ini 中更改以下内容

  tenant_network_type = ib
  vnic_type = hostdev
  network_vlan_ranges = default:1:10 
  (sql_connection and reconnect_interval  can be configured as described above)

VLAN 和 PKEY 之间的映射如下:VLAN X = PKEY 0x8000 + X。例如:vlan 2 是 pkey 0x8002

准虚拟化

在控制器上,配置文件 /etc/neutron/plugins/mlnx/mlnx_conf.ini

  tenant_network_type = ib
  vnic_type = bridge

计算节点

SR-IOV

SR-IOV 是一种直通模式。执行以下更改

创建文件 /etc/modprobe.d/mlx4_ib.conf 并放入

   options mlx4_ib sm_guid_assign=0

在文件 /etc/neutron/plugins/mlnx/mlnx_conf.ini 中

   physical_interface_mapping = default:autoib

应将 Tenant_network_type、vnic_type 和 network_vlan_ranges 参数配置为控制器。

autoib 可以替换为 PF 的名称。

更改文件 /etc/eswitchd/eswitchd.conf

  fabrics  = default:autoib (or default:ib0)

应重新启动驱动程序

   /etc/init.d/openibd restart

应启动 eswitchd,然后启动 Neutron 代理

  /etc/init.d/eswitchd restart
  /etc/init.d/neutron-mlnx-agent restart

验证 /etc/nova/nova.conf 中是否配置了 Mellanox VIF 驱动程序

  libvirt_vif_driver=mlnxvif.vif.MlxEthVIFDriver

重新启动 nova

  #/etc/init.d/openstack-nova-compute restart

准虚拟化

这里我们使用 Linux Bridge 插件。

eIPoIB 模块应启动并配置。在 /etc/infiniband/openib.conf 中

E_IPOIB_LOAD=yes

并重新启动 openibd

#/etc/init.d/openibd restart

请参阅 Mellanox OFED 用户手册中的 eIPoIB 配置

一旦我们拥有 eIPoIB 接口,我们就在 linux bridge 代理配置中使用它

例如:假设 eth1 是 eIPoIB 接口

要检查接口类型是 eIPoIB,请运行命令(验证驱动程序是否为“eth_ipoib”)

  #ethtool -i <interface> 
  driver: eth_ipoib
  version: 1.0.0
  firmware-version: 1 
  bus-info: ib0
  supports-statistics: yes
  supports-test: no
  supports-eeprom-access: no
  supports-register-dump: no
  supports-priv-flags: no

更改文件 /etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini

  [linux_bridge] 
  physical_interface_mappings =  default:eth1   

在 /etc/nova/nova.conf 中配置 Linux Bridge VIF 驱动程序

  #libvirt_vif_driver=nova.virt.libvirt.vif.NeutronLinuxBridgeVIFDriver

重新启动 nova

  #/etc/init.d/openstack-nova-compute restart

配置完成后,应重新启动 Linux Bridge 代理。

  #/etc/init.d/neutron-linuxbridge-agent restart

网络节点

如上文 InfiniBand 准虚拟化部分所述,配置 Linux bridge 插件。

DHCP 服务器

对于 DHCP 支持 - 网络节点应将 Mellanox Dnsmasq 驱动程序用作 DHCP 驱动程序。

   # yum install mlnx-dnsmasq

在 /etc/neutron/dhcp_agent.ini 中更改以下内容

  dhcp_driver = mlnx_dhcp.MlnxDnsmasq

复制 ipoibd 并覆盖 /sbin/ipoibd

  #wget http://www.mellanox.com/downloads/solutions/openstack/havana/ipoibd
  #cp ipoibd /sbin/ipoibd
  Note: If you have OFED >= 2.1 the above step is not needed

下载并应用 Linux Bridge Agent 的补丁

  #wget http://www.mellanox.com/downloads/solutions/openstack/havana/patches/linuxbridge_neutron_agent.py.patch
  #cd /usr/lib/python2.6/site-packages/neutron/plugins/linuxbridge/agent
  #patch -p1 < linux_bridge_agent.py.patch 

重新启动 openibd

  #/etc/init.d/openibd restart

启动 linux bridge 代理

  /etc/init.d/neutron-linuxbridge-agent restart

启动 dhcp 服务器

  /etc/init.d/neutron-dhcp-agent restart

使用示例

已知问题和故障排除

有关已知问题和故障排除选项,请参阅 Mellanox OpenStack 故障排除

参考文献

1. http://www.mellanox.com/openstack/

2. 源代码仓库

3. Mellanox OFED

4. Mellanox OpenStack 解决方案参考架构

5. Mellanox OpenStack 故障排除

有关更多详细信息,请将您的问题发送至 openstack@mellanox.com

返回到 Mellanox-OpenStack wiki 页面。