使用RDO源安装的L版,All in One。主要目的是弄清Neutron的运作。
从系统组成上看,neutron由mq、controller和compute三部分组成:
+-------------+
| controller |
| |
+-------------+
+------------------------+
| rabbit mq |
+------------------------+
+-------------+ +-------------+ +-------------+
| compute1 | | compute2 | | compute3 |
| | | | | |
+-------------+ +-------------+ +-------------+
从程序上看:
master:
neutron-server
neutron-openvswitch-agent or neutron-linuxbridge-agent (根据ml2插件而定)
neutron-dhcp-agent
neutron-metadata-agent
neutron-l3-agent
compute:
neutron-openvswitch-agent or neutron-linuxbridge-agent (根据ml2插件而定)
#vs-vsctl show
54989d7c-4bb4-4115-9c4f-bfb00ed28479
Bridge br-tun
fail_mode: secure
Port br-tun
Interface br-tun
type: internal
Port patch-int
Interface patch-int
type: patch
options: {peer=patch-tun} <-----------+
Bridge br-ex |
Port br-ex |
Interface br-ex |
type: internal |
Port "qg-02f773ec-8e" <-----+ |
Interface "qg-02f773ec-8e" | |
type: internal | |
Bridge br-int | |
fail_mode: secure | |Peer
Port "tape681f6a4-44" | |
tag: 1 | |
Interface "tape681f6a4-44" | |
type: internal | |
Port "tap517721f1-73" | |
tag: 2 | |
Interface "tap517721f1-73" | |
type: internal | |
Port patch-tun | |
Interface patch-tun | |
type: patch | |
options: {peer=patch-int} | <-----+
Port "qr-ce762447-ba" |
tag: 1 |
Interface "qr-ce762447-ba" <----+---- qroute namespace
type: internal
Port br-int
Interface br-int
type: internal
ovs_version: "2.4.0"
从上面可以看到ovs中所有bridge和port,以及port绑定的网卡,接下来,在不同的namspace中找到这些网卡:
Bridge Port Interface Namespace
---------------------------------------------------------------
br-tun br-tun br-tun Default
br-ex br-ex br-ex Default
br-ex qg-02f773ec-8e qg-02f773ec-8e qrouter-37a14bab-47b6-49f8-ac0a-65b5df428c3d
br-int br-tin br-int Default
br-int tape681f6a4-44 tape681f6a4-44 qdhcp-726699dc-e478-4d61-b8c3-02f501b1e700
br-int tap517721f1-73 tap517721f1-73 qdhcp-5dfd342d-2298-4d63-bfe3-bc228d3d944f
br-int qr-ce762447-ba qr-ce762447-ba qrouter-37a14bab-47b6-49f8-ac0a-65b5df428c3d
直接可以看到的网卡:
#ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 08:00:27:7e:b6:d0 brd ff:ff:ff:ff:ff:ff
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 08:00:27:bc:74:90 brd ff:ff:ff:ff:ff:ff
4: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT
link/ether 8e:23:d2:13:61:98 brd ff:ff:ff:ff:ff:ff
5: br-int: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
link/ether ee:f8:8d:d7:78:45 brd ff:ff:ff:ff:ff:ff
6: br-tun: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT
link/ether 6e:a8:20:46:81:4e brd ff:ff:ff:ff:ff:ff
7: br-ex: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT
link/ether ca:20:3d:56:d6:4d brd ff:ff:ff:ff:ff:ff
查看namespace:
#ls /var/run/netns/
qdhcp-5dfd342d-2298-4d63-bfe3-bc228d3d944f
qdhcp-726699dc-e478-4d61-b8c3-02f501b1e700
qrouter-37a14bab-47b6-49f8-ac0a-65b5df428c3d
注意:这里有两个qdhcp-XX,是因为系统中有两个子网,每个子网有自己的qdhcp
分别在每个namespace中的网卡:
#ip netns exec qrouter-37a14bab-47b6-49f8-ac0a-65b5df428c3d ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
13: qr-ce762447-ba: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
link/ether fa:16:3e:16:db:92 brd ff:ff:ff:ff:ff:ff
14: qg-02f773ec-8e: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
link/ether fa:16:3e:08:00:1f brd ff:ff:ff:ff:ff:ff
#ip netns exec qdhcp-5dfd342d-2298-4d63-bfe3-bc228d3d944f ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
12: tap517721f1-73: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
link/ether fa:16:3e:49:96:eb brd ff:ff:ff:ff:ff:ff
#ip netns exec qdhcp-726699dc-e478-4d61-b8c3-02f501b1e700 ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
11: tape681f6a4-44: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
link/ether fa:16:3e:8a:4a:08 brd ff:ff:ff:ff:ff:ff
qrouter中的路由表:
#ip netns exec qrouter-37a14bab-47b6-49f8-ac0a-65b5df428c3d route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 0 0 0 qg-02f773ec-8e
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 qr-ce762447-ba
172.24.4.224 0.0.0.0 255.255.255.240 U 0 0 0 qg-02f773ec-8e