Mellanox-Neutron-Grizzly
概述
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 插件。
先决条件
以下是 Mellanox Neutron 插件的先决条件
1. 必须安装软件包 python-zmq(github)。也可以使用 EPEL 仓库。
2. python-setuptools(使用“yum install python-setuptools”)
3. python-pip(使用“yum install python-pip”)
仅适用于计算服务器的先决条件
1. RH 6.3 或更高版本。
2. 计算节点应配备 Mellanox ConnectX®-3 网络适配器(链接)。
3. 安装了 Mellanox OFED 2.0.3。请联系 openstack@mellanox.com 以检索此版本。有关最新的 OFED 文档,请参阅 Mellanox 网站(链接)。
4. 在 ConnectX-3 卡上启用 SR-IOV。请参阅 Mellanox Community。
5. 必须安装软件包 iproute2 -(代码 文档)。仅需要在计算节点上安装。
6. 必须安装软件包 ethtool(代码)(版本 3.8 或更高版本)。仅需要在计算节点上安装。
7. oslo.config(使用“pip-python install oslo.config”)。仅需要在计算节点上安装。
python-ethtool 和 python-zmq 包
使用 Red Hat Enterprise Linux OpenStack Platform 进行安装
对于每个部分,请参阅“通过 RPM 安装”。除了 Red Hat Enterprise Linux OpenStack Platform 所需的先决条件外,无需其他先决条件。请参阅 https://access.redhat.com/products/Cloud/OpenStack/ 以获取有关此产品的更多信息。
代码结构
Mellanox Neutron 插件和 Nova VIF 驱动程序位于 Mellanox OpenStack RPM。
1. Neutron 插件包结构
quantum/etc/quantum/plugins/mlnx -plugin configuration mlnx_conf.ini - sample plugin configuration
quantum/quantum/plugins/mlnx - plugin code /agent - Agent code /common - common code /db - plugin persistency model and wrapping methods mlnx_plugin.py - Mellanox Openstack Plugin rpc_callbacks.py - RPC handler for received messages agent_notify_api.py - Agent RPC notify methods
Mellanox Neutron 插件位于 quantum/quantum/plugins/下。
2. Nova VIF 驱动程序包结构是
nova/nova/mlnx - nova vif driver code
Mellanox Nova VIF 驱动程序位于 nova/virt/libvirt/mlnx 下。
Mellanox Neutron 插件安装
在控制器节点上
在 /etc/nova/nova.conf 中,请确保有以下行
security_group_api=nova
如果已更改,请重新启动 nova 服务(例如,cd /etc/init.d && for i in $( ls nova-*); do service $i restart; done)
在 Neutron 服务器节点上
为 Neutron 服务器创建 MySQL 数据库
Neutron 服务器使用 MySQL 数据库。请确保您有正在运行的 MySQL 数据库用于 quantum。
如果 Neutron 服务器已在运行,则应停止它。
#/etc/init.d/quantum-server stop
如果您想使用已创建的数据库,则必须删除它并创建另一个数据库。例如
mysql -u root -ppassword <<EOF drop database if exists quantum; create database quantum; EOF
如果您想创建一个新的数据库
mysql -u root -ppassword <<EOF drop database if exists quantum; create database quantum; GRANT ALL PRIVILEGES ON quantum.* TO 'quantum'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON quantum.* TO 'quantum' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; EOF
通过 RPM 安装 - 适用于 RH6.3 及更高版本
注意:如果您使用的是 Red Hat Enterprise Linux OpenStack Platform,RH6.4 是最低要求
1. 下载 Mellanox OpenStack 仓库文件
#wget http://www.mellanox.com/downloads/solutions/openstack/grizzly/repo/mlnx-grizzly/mlnx-grizzly.repo -O /etc/yum.repos.d/mlnx-grizzly.repo
2. 安装 Neutron 服务器所需的 RPM
#yum install openstack-quantum-mlnx
3. 修改 /etc/quantum/quantum.conf 文件。
core_plugin = quantum.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin
4. 修改 /etc/quantum/plugins/mlnx/mlnx_conf.ini 文件以反映您的环境。单击 此处 以获取配置选项。
5. 更改指向插件配置文件的软链接(plugin.ini)
#unlink /etc/quantum/plugin.ini #ln -s /etc/quantum/plugins/mlnx/mlnx_conf.ini /etc/quantum/plugin.ini
6. 启动 Neutron 服务器
#/etc/init.d/quantum-server start
手动安装 - 适用于其他操作系统。
1. 确保 Neutron 服务器已安装并已停止
#/etc/init.d/quantum-server stop
2. 将 Mellanox OpenStack 插件复制到已安装的 Neutron 插件目录(通常为 /usr/lib/python2.7/dist-packages/quantum/plugins)。
#git clone https://github.com/mellanox-openstack/mellanox-quantum-plugin #cd mellanox-quantum-plugin #git checkout v0.4 #cp -a quantum/quantum/plugins/mlnx /usr/lib/python2.7/dist-packages/quantum/plugins
3. 修改 /etc/quantum/quantum.conf 文件。
core_plugin = quantum.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin
4. 复制 Mellanox 插件配置。
#mkdir -p /etc/quantum/plugins/mlnx #cp quantum/etc/quantum/plugins/mlnx/mlnx_conf.ini /etc/quantum/plugins/mlnx
5. 修改 /etc/quantum/plugins/mlnx/mlnx_conf.ini 文件以反映您的环境。单击 此处 以获取配置选项。
6. 如果您使用 init 脚本运行 Neutron 服务器,请更改 Neutron 服务器配置以指向 Mellanox Neutron 插件
例如,在 Ubuntu 中更改 /etc/default/quantum-server
QUANTUM_PLUGIN_CONFIG="/etc/quantum/plugins/mlnx/mlnx_conf.ini"
7. 运行服务器。
#quantum-server --config-file /etc/quantum/quantum.conf --config-file /etc/quantum/plugins/mlnx/mlnx_conf.ini
或者
#/etc/init.d/quantum-server start
在计算节点上
eswitchd 守护进程
1. 如果您没有下载 Mellanox OpenStack 仓库文件,请下载它
#wget http://www.mellanox.com/downloads/solutions/openstack/grizzly/repo/mlnx-grizzly/mlnx-grizzly.repo -O /etc/yum.repos.d/mlnx-grizzly.repo
2. 安装 eswitchd RPM
#yum install eswitchd
3. 如有需要,配置 /etc/eswitchd/eswitchd.conf
请参阅 Mellanox Community 以获取 eSwitchd 安装说明(单击 此处)
Nova-compute
1. 确保 nova 已安装在您的服务器上。
2. 下载并复制 Nova Mellanox VIF 驱动程序。
#git clone https://github.com/mellanox-openstack/mellanox-quantum-plugin #cd mellanox-quantum-plugin #git checkout v0.4 #cp -a nova/nova/virt/libvirt/mlnx /usr/lib/python2.6/site-packages/nova/virt/libvirt
或者
#wget https://github.com/mellanox-openstack/mellanox-quantum-plugin/archive/v0.4.tar.gz #tar zxvf v0.4 #cp –a mellanox-quantum-plugin-0.4/nova/nova/virt/libvirt/mlnx /usr/lib/python2.6/site-packages/nova/virt/libvirt
3. 修改 /etc/nova/nova.conf
compute_driver=nova.virt.libvirt.driver.LibvirtDriver libvirt_vif_driver=nova.virt.libvirt.mlnx.vif.MlxEthVIFDriver fabric=default - specifies physical network for vNICs (currently support one fabric per node) security_group_api=nova
4. 重新启动 Nova。
#/etc/init.d/openstack-nova-compute restart
Neutron Agent
通过 RPM 安装 - 适用于 RH6.3 及更高版本
1. 安装 Quantum agent 所需的 RPM
#yum install openstack-quantum-mlnx
3. 从 Neutron 服务器复制 /etc/quantum/quantum.conf 文件,并根据需要进行调整。
4. 修改 /etc/quantum/plugins/mlnx/mlnx_conf.ini 文件以反映您的环境。单击 此处 以获取配置选项。
5. 启动 eswitch 守护进程
#/etc/init.d/eswitchd start
6. 启动 quantum agent
#/etc/init.d/quantum-mlnx-agent start
注意:在启动 Neutron Agent 之前,应启动 eswitch 守护进程。
Mellanox Neutron 插件配置
Neutron 配置
1. 通过编辑 quantum.conf 并更改 core_plugin,使 Mellanox 插件成为当前的 Neutron 插件。
core_plugin = quantum.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin
2. 数据库配置:在中央服务器上安装 MySQL。创建一个名为“quantum”的数据库。
3. 插件配置:编辑配置文件:/etc/quantum/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://quantum:password@127.0.0.1:3306/quantum"
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] 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: 'direct' or 'hostdev' according to libvirt terminology.
hostdev: this is the traditional method of assigning any generic PCI device to a guest (SR-IOV).
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')
request_timeout - the number of milliseconds the agent will wait for response on request to daemon. (default=3000 msec)
有关插件配置文件示例(Grizzly),请参阅 Mellanox config *ini 文件。
Nova 配置(计算节点)
编辑 nova.conf 文件。1. 配置 vif 驱动程序和 libvirt/vif 类型
compute_driver=nova.virt.libvirt.driver.LibvirtDriver connection_type=libvirt libvirt_vif_driver=nova.virt.libvirt.mlnx.vif.MlxEthVIFDriver
2. 配置 vnic_type(“direct”或“hostdev”)。这将是在创建新的 vNIC 时的默认 vNIC 类型。(例如,当使用仪表板创建新的 vNIC 时,这将是默认类型。
vnic_type= direct
3. 定义嵌入式交换机管理的物理网络(当前节点上的单个织物)。
fabric=default - specifies physical network for vNICs
4. 启用 DHCP 服务器以允许 VM 获取 IP。
quantum_use_dhcp=true
网络节点
配备 Mellanox Connectx-3 适配器卡的网络节点应配置如下
1. 安装 Mellanox OFED。
2. 安装 Neutron linux bridge 插件和 Neutron dhcp l3-agent
#yum install openstack-quantum #yum install openstack-quantum-linuxbridge
3. 更改以下配置 /etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini 文件
physical_interface_mappings = default:eth2 (when eth2 is normally the name for Ethernet interface of Mellanox adapters)
4. 按照以下指南配置 DHCP 服务器
https://docs.openstack.org/trunk/openstack-network/admin/content/adv_cfg_dhcp_agent.html
5. 启动 DHCP 服务器
#/etc/init.d/quantum-dhcp-agent start #/etc/init.d/quantum-linuxbridge-agent start
InfiniBand 支持
Mellanox Neutron 插件使用 InfiniBand 分区(PKeys)来分隔网络。
配置分区
有两种配置 InfiniBand 分区的方法
1. 手动配置:所有 PKey 都应预先定义在 partitions.conf 文件(/etc/opensm/partitions.conf)中
2. 自动配置:(未来)
在 partitions.conf 文件中添加/更改以下内容
management=0xffff,ipoib, sl=0, defmember=both : ALL, ALL_SWITCHES=full,SELF=full;
对于您想在 Neutron 中配置的每个网络,您必须配置与该网络 VLAN 关联的 pkey(在 Neutron 中定义)。
net1=0x1, ipoib, sl=0, defmember=full : SELF;
例如:如果我们在 /etc/quantum/plugins/mlnx/mlnx_conf.ini 中有此配置
[MLNX] network_vlan_ranges = default:1:10
我们将得到 partitions.conf 文件的以下配置
management=0x7fff,ipoib, sl=0, defmember=full : ALL, ALL_SWITCHES=full,SELF=full; net1=0x1, ipoib, sl=0, defmember=full : ALL; net2=0x2, ipoib, sl=0, defmember=full : ALL; net3=0x3, ipoib, sl=0, defmember=full : ALL; net4=0x4, ipoib, sl=0, defmember=full : ALL; net5=0x5, ipoib, sl=0, defmember=full : ALL; net6=0x6, ipoib, sl=0, defmember=full : ALL; net7=0x7, ipoib, sl=0, defmember=full : ALL; net8=0x8, ipoib, sl=0, defmember=full : ALL; net9=0x9, ipoib, sl=0, defmember=full : ALL; net10=0xa, ipoib, sl=0, defmember=full : ALL;
更改 /etc/opensm/opensm.conf 中的以下内容
allow_both_pkeys TRUE
重新启动 openSM
#/etc/init.d/opensmd restart
配置 Quantum 服务器和计算节点
SR-IOV(直通模式)
在控制器上,更改文件 /etc/quantum/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/quantum/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)
应启动 eswitch,然后启动 Neutron agent
/etc/init.d/eswitchd restart /etc/init.d/quantum-mlnx-agent restart
验证 /etc/nova/nova.conf 中是否配置了 Mellanox VIF 驱动程序
libvirt_vif_driver=nova.virt.libvirt.mlnx.vif.MlxEthVIFDriver
重新启动 nova
#/etc/init.d/openstack-nova-compute restart
Para-Virtualized
在控制器上使用 Mellanox Neutron 插件,在计算节点上使用 Linux bridge 插件
在控制器上,配置文件 /etc/quantum/plugins/mlnx/mlnx_conf.ini
tenant_network_type = ib vnic_type = bridge
这里我们使用 Linux Bridge 插件。
应启动并配置 eIPoIB 模块。在 /etc/infiniband/openib.conf 中
E_IPOIB_LOAD=yes
并重新启动 openibd
#/etc/init.d/openibd restart
请参阅 Mellanox OFED 用户手册中的 eIPoIB 配置
配置 eIPoIB 接口后,我们在 linux bridge agent 配置中使用它
例如:假设 eth1 是 eIPoIB 接口
要检查接口类型是 eIPoIB,请运行命令(验证驱动程序是否为“eth_ipoib”)
#ethtool -i <interface>
更改文件 /etc/quantum/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.QuantumLinuxBridgeVIFDriver
重新启动 nova
#/etc/init.d/openstack-nova-compute restart
配置完成后,应重新启动 Linux Bridge agent。
#/etc/init.d/quantum-linuxbridge-agent restart
配置网络节点
如 InfiniBand Para-Virtualized 部分(上述)中所述配置 Linux bridge 插件。为了在半虚拟化模式下使用 DHCP(使用 Linux Bridge),您必须确保在实例 dhclient.conf 文件中配置了“bootp-broadcast-always”选项。
DHCP 服务器
对于 DHCP 支持 – 网络节点应使用 Mellanox Dnsmasq 驱动程序作为 DHCP 驱动程序。获取代码
#git clone https://github.com/mellanox-openstack/mellanox-quantum-plugin #cd mellanox-quantum-plugin #git checkout v0.4
复制 Mellanox Dnsmasq 驱动程序
#cp quantum/agent/linux/mlnx_dhcp.py /usr/lib/python2.6/site-packages/quantum/agent/linux (The path can be different if you are using other Distribution or other python version)
更改 /etc/quantum/dhcp_agent.ini 中的以下内容
dhcp_driver=quantum.agent.linux.mlnx_dhcp.MlnxDnsmasq
复制 ipoibd 并覆盖 /sbin/ipoibd
#wget http://www.mellanox.com/downloads/solutions/openstack/grizzly/0.4/ipoibd
重新启动 openibd
#/etc/init.d/openibd restart
启动 linux bridge agent
/etc/init.d/quantum-linuxbridge-agent restart
启动 dhcp 服务器
/etc/init.d/quantum-dhcp-agent restart
使用示例
- 要创建 SR-IOV 接口,请参阅 Mellanox OpenStack 解决方案文档“创建 SR-IOV 实例”章节
- 要创建 Para-Virtualized 接口,请参阅 Mellanox OpenStack 解决方案文档“创建 Para-Virtualized vNIC 实例”章节
参考文献
1. http://www.mellanox.com/openstack/
2. 源代码仓库
4. Mellanox OpenStack 解决方案参考架构
有关更多详细信息,请将您的问题发送至 openstack@mellanox.com
返回到 Mellanox-OpenStack wiki 页面。