安装部署Liberty Neutron

最近在两台物理机环境中部署了OpenStack的Liberty版本,各个模块都遇到或多或少的问题,但尤以Neutron的问题最让人头疼。尽管OpenStack一直致力于简化Neutron的部署,但对于非网络技术人员来说依然存在着很大的挑战,根本原因还是由于网络自身的复杂性所导致的,因此想要成功部署Neutron还是需要网络基础的,但这并不意味着没有网络基础就不能成功部署Neutron并使其工作。本文将总结Neutron的安装部署步骤,并对遇到的问题进行详细的描述,旨在提供解决问题的思路或者给与一定的启示。

根据官方部署文档的说法,Neutron允许创建由其它OpenStack服务管理的接口设备,并将这样的设备附加到网络,可以实现各种插件或代理以适应不同的网络设备和软件,为OpenStack架构提供足够的灵活性。Neutron主要包括以下组件:

  • Neutron-server:接收并转发API请求到合适的Neutron插件,如linuxbridge-agent。
  • Neutron插件和代理:连接port,创建网络或子网,提供IP地址。根据云计算环境使用的厂商或者技术,这些插件和代理会有所区别。Neutron为思科的虚拟和物理交换机、NEC的OpenFlow产品、Open vSwitch(OVS)、Linux bridging和VMware的NSX产品提供了插件或代理。
  • 消息队列:Neutron使用消息队列在Neutron-server和各种代理之间路由消息,也存储特定插件的状态。主要的消息队列有RabbitMQ、Qpid和ZeroMQ。

Neutron将网络、子网和路由器抽象为对象,每个抽象对象都具有与其对应的物理概念或设备的功能,网络包含子网,路由器在不同的子网和网络之间路由消息。每个路由器有一个连接到网络的网关(Gateway)和许多连接子网的虚拟网卡,连接到相同路由器的子网可以互相访问。这和实际物理环境中路由器的功能是一致的。

无论以何种方式部署Neutron,在创建网络时至少需要创建一个external网络。与其它网络不同的是,external网络不仅仅是虚拟定义网络,它代表了物理的,OpenStack安装之外的外部网络的视图。External网络上的IP地址可以被外部物理网络访问,由于external网络仅仅表示外部网络的视图,因此在该网络总DHCP是禁用的。除了external网络,还要有一个或多个internal网络,VMs直接连接到这些软件定义网络。相同internal网络上的VMs可以互相访问,或连接到相同路由器上不同子网中的VMs也可以互相访问,比如主机A位于子网N1,主机B位于子网N2,N1和N2连接到相同的路由器,那么A和B之间是网络可达的。外部网络访问VMs或VMs访问外部网络的功能有路由器完成,路由器的网关连接external网络,internal网络连接路由器的接口,与实际的物理网络结构相似。可以为internal网络中的ports分配external网络中的IP地址,port指的是连接到子网的连接。通过将external网络中的IP与VMs的ports关联可以实现外部网络对VMs的访问。Neutron也支持安全组。安全组使管理员可以在组内定义防火墙规则,VM可以属于多个安全组,Neutron根据安全组的规则或策略阻塞或允许ports,或VMs允许的通信类型。

本次将Neutron部署在两台物理机controller和compute上,其中controller做为控制节点(网络节点),compute为计算节点,controller节点已经安装配置了Mysql、RabbitMQ和keystone。首先需要在mysql数据库中创建neutron对应的数据库:

MariaDB [(none)]> create database neutron;
Query OK, 1 row affected (0.04 sec)
MariaDB [(none)]> grant all privileges on neutron.* to 'neutron'@'localhost' identified by 'neutron';
Query OK, 0 rows affected (0.24 sec)
MariaDB [(none)]> grant all privileges on neutron.* to 'neutron'@'%' identified by 'neutron';         
Query OK, 0 rows affected (0.00 sec)
其次在keystone中创建neutron对应的用户、service和endpoint:

[opst@controller ~]$ source admin-openrc.sh
[root@controller opst]# openstack user create --domain default --password neutron neutron
+-----------+----------------------------------+
| Field     | Value                         |
+-----------+----------------------------------+
| domain_id | default                      |
| enabled   | True                          |
| id        | 24a20abcf4324cfca09484959244aaf7 |
| name      | neutron                      |
+-----------+------------------------------------+
 
[root@controller opst]# openstack role add --project service --user neutron admin
[root@controller opst]# openstack service create --name neutron --description 'The Networking Service' network
[root@controller opst]# openstack endpoint create --region RegionOne neutron public http://controller:9696
+--------------+----------------------------------+
| Field        | Value                         |
+--------------+----------------------------------+
| enabled      | True                         |
| id           | a7aae0431e2948ce8070ddf0a14bbdf8 |
| interface    | public                         |
| region       | RegionOne                   |
| region_id    | RegionOne                  |
| service_id   | ec4391191490440787799e973b54c816 |
| service_name | neutron                     |
| service_type | network                      |
| url          | http://controller:9696         |
+--------------+------------------------------------+
[root@controller opst]# openstack endpoint create --region RegionOne neutron internal http://controller:9696
+--------------+----------------------------------+
| Field        | Value                         |
+--------------+----------------------------------+
| enabled      | True                         |
| id           | 8599ab44484b4c3dbc12f8c945490cef |
| interface    | internal                       |
| region       | RegionOne                   |
| region_id    | RegionOne                  |
| service_id   | ec4391191490440787799e973b54c816 |
| service_name | neutron                     |
| service_type | network                      |
| url          | http://controller:9696         |
+--------------+-----------------------------------+
[root@controller opst]# openstack endpoint create --region RegionOne neutron admin http://controller:9696   
+--------------+----------------------------------+
| Field        | Value                         |
+--------------+----------------------------------+
| enabled      | True                         |
| id           | 66ef114548e84911873e83949ef76307 |
| interface    | admin                        |
| region       | RegionOne                   |
| region_id    | RegionOne                  |
| service_id   | ec4391191490440787799e973b54c816 |
| service_name | neutron                      |
| service_type | network                      |
| url          | http://controller:9696          |
+--------------+-------------------------------------+

完成上述基础服务的配置管理后,要决定Neutron部署架构,可以采用的架构有两种,Provider网络和Self-service网络。Provider网络可能是最简单的Neutron架构,仅支持为VM分配public(Provider)网络,没有自服务网络,路由器或者浮动IP,只有admin或者其他特权用户可以管理Provider网络。Self-service网络支持layer-3服务,允许VMs分配private网络,demo用户或其他非特权用户可以自行管理网络,比如连接self-service网络和provider网络的路由器。另外,浮动IP可以使外部网络,比如Internet,访问VMs。Self-service网络也支持VMs分配public(Provider)网络。

本次部署采用Self-service网络。在控制节点controller部署self-service网络相关安装包,根据操作系统是否已经安装了ebtables或ipset,最后两个安装包可做相应取舍。

[root@controller opst]# yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge python-neutronclient ebtables ipset

编辑/etc/neutron/neutron.conf:

[DEFAULT]
verbose = True
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True
rpc_backend=rabbit
auth_strategy = keystone
 
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
nova_url = http://controller:8774/v2
 
[database]
connection = mysql://neutron:neutron@controller/neutron
 
[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = opst
 
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = neutron
 
[nova]
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = nova
password = nova
 
[oslo_concurrency]
lock_path = /var/lib/tmp/neutron

编辑/etc/neutron/plugins/ml2/ml2_conf.ini:

[ml2]
type_drivers = flat,vlan,vxlan
tenant_network_types = vxlan
mechanism_drivers = linuxbridge,l2population
extension_drivers = port_security
 
[ml2_type_flat]
flat_networks = public
 
[ml2_type_vxlan]
vni_ranges = 1:1000
 
[securitygroup]
enable_ipset = True

编辑/etc/neutron/plugins/ml2/linuxbridge_agent.ini:

[linux_bridge]
physical_interface_mappings = public:eno1
 
[vxlan]
enable_vxlan = True
local_ip = 192.168.81.66
l2_population = True
 
[agent]
prevent_arp_spoofing = True
 
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDrive

编辑/etc/neutron/l3_agent.ini:

[DEFAULT]
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
external_network_bridge =
verbose = True

编辑/etc/neutron/dhcp_agent.ini:

[DEFAULT]
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
verbose = True
dnsmasq_config_file = /etc/neutron/dnsmasq-neutron.conf

创建/etc/neutron/dnsmasq-neutron.conf,并添加如下内容,启动DHCP的MTU选项(26),并将大小设置为1450字节。

dhcp-option-force=26,1450
编辑/etc/neutron/metadata_agent.ini:

[DEFAULT]
 
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_region = RegionOne
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = neutron
 
nova_metadata_ip = controller
metadata_proxy_shared_secret = Test(与nova.conf中[neutron]metadata_proxy_shared_secret的值相同)
verbose = True

编辑/etc/nova/nova.conf:

[neutron]
 
url = http://controller:9696
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron
 
service_metadata_proxy = True
metadata_proxy_shared_secret = METADATA_SECRET

Neutron的初始化脚本需要链接文件/etc/neutron/plugin.ini指向/etc/neutron/plugins/ml2/ml2_conf.ini:

[root@controller opst]# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

推送数据到MySQL数据库中:

[root@controller opst]#su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf  --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron

重启nova-api:

[root@controller opst]# systemctl restart openstack-nova-api.service

配置Neutron服务随系统启动(无论是Provider网络还是Self-service网络):

[root@controller opst]# systemctl enable neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service

启动Neutron服务(无论是Provider网络还是Self-service网络):

[root@controller opst]# systemctl start neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service 

如果是Self-service网络,则还需要启动neutron-l3-agent.service服务:

[root@controller opst]# systemctl enable neutron-l3-agent.service
[root@controller opst]# systemctl start neutron-l3-agent.service

在计算节点compute部署self-service网络相关安装包,根据操作系统是否已经安装了ebtables或ipset,最后两个安装包可做相应取舍:

[root@controller opst]# systemctl enable neutron-l3-agent.service
[root@controller opst]# systemctl start neutron-l3-agent.service

编辑/etc/neutron/plugins/ml2/linuxbridge_agent.in:

[linux_bridge]
physical_interface_mappings = public:eno1
 
[vxlan]
enable_vxlan = True
local_ip = 192.168.81.65(compute IP地址)
l2_population = True
 
[agent]
prevent_arp_spoofing = True
 
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDrive

编辑/etc/nova/nova.conf:

[neutron]
 
url = http://controller:9696
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron

重启nova:

[neutron]
 
url = http://controller:9696
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron

启动neutron:

[root@compute opst]# systemctl enable neutron-linuxbridge-agent.service
[root@compute opst]# systemctl start neutron-linuxbridge-agent.service

在控制节点验证Neutron的安装:

[opst@controller ~]$ neutron ext-list
+-----------------------+-----------------------------------------------+
| alias                 | name                                    |
+-----------------------+-----------------------------------------------+
| dns-integration       | DNS Integration                       |
| ext-gw-mode           | Neutron L3 Configurable external gateway mode |
| binding               | Port Binding                           |
| agent                 | agent                                   |
| subnet_allocation     | Subnet Allocation                     |
| l3_agent_scheduler   | L3 Agent Scheduler                   |
| external-net          | Neutron external network              |
| flavors               | Neutron Service Flavors                |
| net-mtu               | Network MTU                          |
| quotas                | Quota management support            |
| l3-ha                 | HA Router extension                    |
| provider              | Provider Network                        |
| multi-provider       | Multi Provider Network                  |
| extraroute           | Neutron Extra Route                      |
| router               | Neutron L3 Router                        |
| extra_dhcp_opt       | Neutron Extra DHCP opts              |
| security-group        | security-group                           |
| dhcp_agent_scheduler  | DHCP Agent Scheduler               |
| rbac-policies        | RBAC Policies                            |
| port-security         | Port Security                              |
| allowed-address-pairs | Allowed Address Pairs                  |
| dvr                   | Distributed Virtual Router                |
+-----------------------+--------------------------------------------------+

继续在控制节点执行下面的命令:

[opst@controller ~]$ neutron agent-list
+--------------------------------------+--------------------+------------+-------+----------------+---------------------------+
| id                                   | agent_type         | host       | alive | admin_state_up | binary                    |
+--------------------------------------+--------------------+------------+-------+----------------+---------------------------+
| 111e36b2-a1d6-4c86-90c3-e4e4725fa560 | L3 agent           | controller | :-)   | True           | neutron-l3-agent          |
| 7aaa5eca-0436-423f-af2f-fbae0ebc6fa1 | Linux bridge agent | compute    | :-)   | True           | neutron-linuxbridge-agent |
| 7e394c14-ce7e-45e0-9ac6-3f9250c04984 | Linux bridge agent | controller | :-)   | True           | neutron-linuxbridge-agent |
| a6ec9a47-e8f1-4948-9d9b-b172fd6757d6 | Metadata agent     | controller | :-)   | True           | neutron-metadata-agent    |
| f99f491b-79e1-4d5d-8c3f-9ecdcf11452c | DHCP agent         | controller | :-)   | True           | neutron-dhcp-agent        |
+--------------------------------------+--------------------+------------+-------+----------------+---------------------------+

这条命令的输出一是看相关服务是否已经全部部署成功,二是是否正常运行,可通过观察第四列的值来确定,:-) 为运行正常,xxxx则存在问题。在验证Neutron部署成功后,将创建虚拟网络。根据所选择的网络架构(Provider或者Self-service),需要执行不同的命令创建不同的网络。由于部署的是Self-service网络,因此既需要创建Public provider网络也需要创建private project网络,public网络用于通过layer-2连接实际的物理网络,private网络使用layer-3和NAT连接物理网络,并包含为VMs分配IP的DHCP,VMs能够访问Internet,如果想要外部网络访问VMs,则需要浮动IP地址与VM关联。

即使成功完成了上述步骤,并且解决了可能出现的问题,比如配置问题,在创建虚拟网络时依然存在着巨大的风险。尽管openstack致力于简化创建网络的工作,但对于新手来说依然困难重重,尤其是部署的环境和官方文档所推荐的环境不一致时。根据官方文档的说明,当部署Self-service网络时,在创建private网络之前必须先创建public网络,但在实际创建虚拟网络的过程中,发现即使先创建private网络再创建public网络,也并未影响网络创建成功与否,但为了与官方保持一致还是按照先创建public网络再创建private网络的顺序进行操作。

执行下面的命令创建public网络,其中--provider:physical_networkpublic中的public与flat_networks = public中保持一致:

[opst@controller ~]$ neutron net-create public --shared --router:external  --provider:physical_network public --provider:network_type flat
Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                           |
+---------------------------+--------------------------------------+
| admin_state_up            | True                         |
| id                        | a4b483a8-8331-4fd4-bfec-431e4df8b7ff |
| mtu                       | 0                                |
| name                      | public                          |
| port_security_enabled    | True                            |
| provider:network_type     | flat                            |
| provider:physical_network | public                         |
| provider:segmentation_id  |                                |
| router:external          | True                              |
| shared                    | True                             |
| status                    | ACTIVE                         |
| subnets                   |                                   |
| tenant_id                 | a242aca931bb49e08a49e5e942c8129d |
+---------------------------+----------------------------------------+

接下来创建子网,这条命令的执行结果将直接影响是否可以连通外部网络,在经过无数次失败的尝试后终于使Neutron可以连通外网。错误的原因在于错误的设置了192.168.81.0/24及start和end的值,上述值必须为实际的物理网络地址或范围,比如我的物理机仅有一块网卡,通过DHCP分配的IP地址为192.168.81.xxx,因此PUBLIC_NETWORK_CIDR就必须为192.168.81.0/24,而start和end则为未使用的192.168.81.xxx地址。

[opst@controller ~]$ neutron subnet-create public 192.168.81.0/24 --name public --allocation-pool start=192.168.81.100,end=192.168.81.200 --dns-nameserver 192.168.85.253 --gateway 192.168.81.254
Created a new subnet:
+-------------------+------------------------------------------------------+
| Field             | Value                                          |
+-------------------+------------------------------------------------------+
| allocation_pools  | {"start": "192.168.81.100", "end": "192.168.81.200"} |
| cidr              | 192.168.81.0/24                               |
| dns_nameservers   | 192.168.85.253                             |
| enable_dhcp       | True                                            |
| gateway_ip        | 192.168.81.254                                |
| host_routes       |                                                   |
| id                | da0ff1d1-35e5-4adb-90d6-9c45bc7864c8       |
| ip_version        | 4                                                 |
| ipv6_address_mode |                                                |
| ipv6_ra_mode      |                                                 |
| name             | public                                            |
| network_id        | a4b483a8-8331-4fd4-bfec-431e4df8b7ff      |
| subnetpool_id     |                                                  |
| tenant_id          | a242aca931bb49e08a49e5e942c8129d        |
+-------------------+----------------------------------------------------------+

创建完public网络后,接下来创建private网络。Private网络用于为VMs分配IP地址,使其之间可以互联访问。

[root@controller opst]# neutron net-create private
Created a new network:
+-----------------------+--------------------------------------+
| Field                 | Value                           |
+-----------------------+--------------------------------------+
| admin_state_up       | True                           |
| id                    | 23ec30de-c5dc-49b2-923c-3b7b83e1d9d1 |
| mtu                   | 0                                |
| name                 | private                          |
| port_security_enabled | True                           |
| router:external       | False                            |
| shared               | False                            |
| status                | ACTIVE                        |
| subnets               |                                  |
| tenant_id             | 25b21a1cd9aa474e95a8cfd8e175714c     |
+-----------------------+---------------------------------------+

在private网络上创建子网的命令如下,其中172.16.1.0/24为子网的CIDR,推荐值为10.0.0.0/8,172.16.0.0/12和192.168.0.0/16。

[root@controller opst]# neutron subnet-create private 172.16.1.0/24 --name private --dns-nameserver 192.168.85.253 --gateway 172.16.1.1
Created a new subnet:
+-------------------+------------------------------------------------+
| Field             | Value                                     |
+-------------------+------------------------------------------------+
| allocation_pools  | {"start": "172.16.1.2", "end": "172.16.1.254"} |
| cidr              | 172.16.1.0/24                            |
| dns_nameservers  | 192.168.85.253                        |
| enable_dhcp      | True                                     |
| gateway_ip        | 172.16.1.1                              |
| host_routes       |                                           |
| id                | dd9ee06a-fd00-41f5-93ba-82f3c0c1e052  |
| ip_version        | 4                                         |
| ipv6_address_mode |                                        |
| ipv6_ra_mode      |                                         |
| name              | private                                  |
| network_id        | 23ec30de-c5dc-49b2-923c-3b7b83e1d9d1  |
| subnetpool_id     |                                          |
| tenant_id         | 25b21a1cd9aa474e95a8cfd8e175714c  |
+-------------------+-------------------------------------------------+

创建完网络后,需要创建路由器以使private网络和public网络互连。创建路由器的命令及输出如下:

[opst@controller ~]$ neutron router-create router
Created a new router:
+-----------------------+--------------------------------------+
| Field                | Value                            |
+-----------------------+---------------------------------------+
| admin_state_up        | True                          |
| external_gateway_info |                               |
| id                    | 27512806-cac3-47f8-acff-b7bd847e2866 |
| name                  | router                          |
| routes                |                                  |
| status                | ACTIVE                        |
| tenant_id             | 25b21a1cd9aa474e95a8cfd8e175714c |
+-----------------------+--------------------------------------+

创建路由器后,需要为路由器添加内部网络的网卡,其中的private为内部网络子网的名称或ID:

[opst@controller ~]$ neutron router-interface-add router private
Added interface f8979659-e714-4298-90cb-57d2b156166c to router router

最后为路由器添加网关,其中public为external网络的名称或ID:

[opst@controller ~]$ neutron router-gateway-set router public
Set gateway for router router

完成上述步骤后,理论上Neutron的部署就成功了,但在未实际测试网络的连通性的情况下,并不能百分百确定网络是连通的。测定连通性最简单的方式是执行ping操作,如果ping的结果没有错误信息,则可以大致认为网络是连通的。那具体应该ping什么样的地址,建议测试虚拟路由器的external网络和internal网络的IP地址,这些信息通过执行下面的命令获得:

[opst@controller ~]$ neutron router-port-list router
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------------+
| id                                   | name | mac_address       | fixed_ips                                                                             |
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------------+
| 653e03b9-8e4a-41c7-97c9-f0a1fa4f086f |      | fa:16:3e:34:b6:5c | {"subnet_id": "da0ff1d1-35e5-4adb-90d6-9c45bc7864c8", "ip_address": "192.168.81.101"} |
| f8979659-e714-4298-90cb-57d2b156166c |      | fa:16:3e:9f:fb:83 | {"subnet_id": "dd9ee06a-fd00-41f5-93ba-82f3c0c1e052", "ip_address": "172.16.1.1"}     |
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------------+

通过ping 192.168.81.101.可以确定external网络是否连通,而要想确认internal网络是否连通则需要在路由器的网络命名空间下ping 172.16.1.1,网络命名空间通过执行下面的命令获得:

[opst@controller ~]$ ip netns
qrouter-27512806-cac3-47f8-acff-b7bd847e2866 (id: 2)
qdhcp-a4b483a8-8331-4fd4-bfec-431e4df8b7ff (id: 1)
qdhcp-23ec30de-c5dc-49b2-923c-3b7b83e1d9d1 (id: 0)

然后以root用户执行下面的命令:

ip netns exec qrouter-27512806-cac3-47f8-acff-b7bd847e2866 ping 172.16.1.1

如果上述命令的输出显示无错误,则基本可认为external网络和internal网络都是连通的,进而可以继续VM的创建,否则即使能够创建VM,也无法保证VM网络可用。

至此基本完成了Neutron的部署和虚拟网络的创建,但可能遇到的问题或需要注意的地方远远超过了这篇文章所能涵盖的。下面就几个可能出现的问题进行简单的总结。

如果internal网络类型为vxlan,也即参数tenant_network_types的值为vxlan,则需要宿主操作系统的内核为3.13或者更高版本。可以通过uname –r查看内核版本,而升级则可通过下面的命令进行:

[root@controller opst]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@controller opst]# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
[root@controller opst]# yum --enablerepo=elrepo-kernel install  kernel-ml-devel kernel-ml -y
[root@controller opst]# awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
CentOS Linux (4.5.0-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux (3.10.0-327.10.1.el7.x86_64) 7 (Core)
[root@controller opst]# grub2-set-default 0
reboot

另外一些问题在命令行中是否无法察觉的,也就是说,当执行了某条命令后,输出信息并不足以判断是否成功,直到测试网络连通性或者创建VMs时才发现某些步骤存在问题。应对类似问题的最好方法就是在创建虚拟网络及创建VMs时观察Neutron和Nova日志的输出,这样没执行一条命令就能确定是否成功,有助于问题的定位,同时不会浪费时间或精力。比如在Neutron的日志中常见的如下错误信息:

2016-04-06 17:12:51.605 3136 ERROR neutron.plugins.ml2.managers [req-0dc4b947-ebbe-47a9-823c-a4f9ead7df74 - - - - -] Failed to bind port 24191168-b2c0-47d8-aa81-c46ad9bcf7b6 on host controller
2016-04-06 17:12:51.605 3136 ERROR neutron.plugins.ml2.managers [req-0dc4b947-ebbe-47a9-823c-a4f9ead7df74 - - - - -] Failed to bind port 24191168-b2c0-47d8-aa81-c46ad9bcf7b6 on host controller
2016-04-06 17:12:51.623 3136 INFO neutron.plugins.ml2.plugin [req-0dc4b947-ebbe-47a9-823c-a4f9ead7df74 - - - - -] Attempt 2 to bind port 24191168-b2c0-47d8-aa81-c46ad9bcf7b6
2016-04-06 17:12:52.218 3136 WARNING neutron.plugins.ml2.rpc [req-8c5de5e4-288f-4f1a-a377-3b348c3ee13b - - - - -] Device tap24191168-b2 requested by agent lb0010c6b0ae66 on network 521f09b9-791e-482f-9403-5ddac2d047b4 not bound, vif_type: binding_failed

该问题有可能是因为内核版本低于3.13以至于不支持vxlan网络,另一个可能的原因是由于public子网的CIDR与所属的物理网段不一致。

以上两个问题,尤其是最后一个问题是在部署Neutron时遇到的最大关卡,其它问题,如配置文件的拼写错误,都是容易排查的。Neutron的功能及角色决定了其复杂性,涉及的内容不仅仅是网络知识,还包括操作系统、虚拟化等方面,因此要想更深入的理解掌握Neutron,需要在遇到不同的问题时,查阅相关资料进行深入学习,否则也仅仅是做到了部署。

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付 9.90元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值