安装

本节描述如何安装和配置 networking-baremetal 插件和 ironic-neutron-agent

ironic-neutron-agent 是一个 neutron 代理,用于在 neutron 中填充主机到物理网络映射,用于裸机节点。Neutron 使用此信息来计算 segment 到主机的映射信息。

安装 networking-baremetal 插件和代理

在命令行

$ pip install networking-baremetal

或者,如果 neutron 安装在虚拟环境中,将 networking-baremetal 插件安装到相同的虚拟环境中

$ . <path-to-neutron-venv>/bin/activate
$ pip install networking-baremetal

或者,使用您的发行版中的软件包。对于 RHEL7/CentOS7

$ yum install python2-networking-baremetal python2-ironic-neutron-agent

在 Networking 服务中启用 baremetal 机制驱动程序

要启用 ML2 插件中的机制驱动程序,请编辑 /etc/neutron/plugins/ml2/ml2_conf.ini 配置文件。例如,这将启用 openvswitchbaremetal 机制驱动程序

[ml2]
mechanism_drivers = openvswitch,baremetal

添加设备(交换机)进行管理

baremetal 机制 ML2 插件提供设备驱动程序插件接口。如果存在交换机型号的设备驱动程序,则可以配置 baremetal ML2 插件来管理交换机配置,添加租户 VLAN 并设置交换机端口 VLAN 配置等。

要添加要管理的设备,请编辑 /etc/neutron/plugins/ml2/ml2_conf.ini 配置文件。以下示例启用了设备:device_a.example.netdevice_b.example.net。示例中的两个设备都使用 netconf-openconfig 设备驱动程序。对于每个设备,配置中的一个单独的部分定义了设备和驱动程序特定的配置。

[networking_baremetal]
enabled_devices = device_a.example.net,device_b.example.net

[device_a.example.net]
driver = netconf-openconfig
switch_info = device_a
switch_id = 00:53:00:0a:0a:0a
host = device_a.example.net
username = user
key_filename = /etc/neutron/ssh_keys/device_a_sshkey
hostkey_verify = false

[device_b.example.net]
driver = netconf-openconfig
switch_info = device_b
switch_id = 00:53:00:0b:0b:0b
host = device_a.example.net
username = user
key_filename = /etc/neutron/ssh_keys/device_a_sshkey
hostkey_verify = false

配置 ironic-neutron-agent

要配置 baremetal neutron 代理,请编辑 neutron 配置文件 /etc/neutron/plugins/ml2/ironic_neutron_agent.ini 文件。添加一个 [ironic] 部分。例如

[ironic]
project_domain_name = Default
project_name = service
user_domain_name = Default
password = password
username = ironic
auth_url = http://identity-server.example.com/identity
auth_type = password
os_region = RegionOne

启动 ironic-neutron-agent 服务

要启动代理,您可以像下面的示例一样从命令行运行它,或者将其添加到 init 系统。

$ ironic-neutron-agent \
    --config-dir /etc/neutron \
    --config-file /etc/neutron/plugins/ml2/ironic_neutron_agent.ini \
    --log-file /var/log/neutron/ironic_neutron_agent.log

您可以为基于 systemd 的发行版创建 systemd 服务文件 /etc/systemd/system/ironic-neutron-agent.service 用于 ironic-neutron-agent。例如

[Unit]
Description=OpenStack Ironic Neutron Agent
After=syslog.target network.target

[Service]
Type=simple
User=neutron
PermissionsStartOnly=true
TimeoutStartSec=0
Restart=on-failure
ExecStart=/usr/bin/ironic-neutron-agent --config-dir /etc/neutron --config-file /etc/neutron/plugins/ml2/ironic_neutron_agent.ini --log-file /var/log/neutron/ironic-neutron-agent.log
PrivateTmp=true
KillMode=process

[Install]
WantedBy=multi-user.target

注意

如果您是从 Linux 发行版发布的软件包安装,则 systemd 服务文件可能已经可用。

启用并启动 ironic-neutron-agent 服务

$ sudo systemctl enable ironic-neutron-agent.service
$ sudo systemctl start ironic-neutron-agent.service