在OpenStack云网络的一些验证工作的时候,经常会有一些临界值相关的,对性能影响极大
最近就有这样一种场景,在一个计算节点上,flat网络没有任何PORT,此时重启OpenvSwitch服务,再来创建该网络下的PORT,可以发现其网络使能性能十分缓慢,往往在用户使用的时候容易感知,当FIX了之后,验证需要测试这种场景,那么需要找一个PORT相对较少的计算节点,将它们都清空,然后来进行重启,验证,那么确认节点上PORT数目可以通过下列ovs方法来获取
首先查看流表
~$ sudo ovs-ofctl dump-flows br-wan NXST_FLOW reply (xid=0x4): cookie=0x0, duration=106040.399s, table=0, n_packets=1049448, n_bytes=72689437, idle_age=0, hard_age=65534, priority=1 actions=NORMAL cookie=0x0, duration=106040.387s, table=0, n_packets=21204322, n_bytes=1144254528, idle_age=0, hard_age=65534, priority=2,in_port=2 actions=drop cookie=0x0, duration=106040.387s, table=0, n_packets=76137, n_bytes=10994149, idle_age=1, hard_age=65534, priority=4,in_port=2,dl_vlan=81 actions=strip_vlan,NORMAL
然后查看tag为81的tap设备,可以列出来
~$ sudo ovs-vsctl find port tag=81
_uuid : e02ab133-5f48-4175-90ac-e2b995312f86
bond_downdelay : 0
bond_fake_iface : false
bond_mode : []
bond_updelay : 0
external_ids : {}
fake_bridge : false
interfaces : [c5c0e730-4455-4a3f-8101-17d2106c4beb]
lacp : []
mac : []
name : "tap15092468-9d"
other_config : {}
qos : []
statistics : {}
status : {}
tag : 81
trunks : []
vlan_mode : []
_uuid : eb9b79f1-f644-4b9f-9265-f79c45e50dad
bond_downdelay : 0
bond_fake_iface : false
bond_mode : []
bond_updelay : 0
external_ids : {}
fake_bridge : false
interfaces : [0045e131-ec88-4c9a-bd3a-74cddd79093a]
lacp : []
mac : []
name : "tapc5effc77-39"
other_config : {}
qos : []
statistics : {}
status : {}
tag : 81
trunks : []
vlan_mode : []
_uuid : e2f4ded3-3116-4e3c-bc73-c3bf6e9338fe
bond_downdelay : 0
bond_fake_iface : false
bond_mode : []
bond_updelay : 0
external_ids : {}
fake_bridge : false
interfaces : [c95c2a3b-e062-4215-9863-ca34f1b3aff7]
lacp : []
mac : []
name : "tap45cb5822-19"
other_config : {}
qos : []
statistics : {}
status : {}
tag : 81
trunks : []
vlan_mode : []
看到这里,其实直接grep tap就可以得到对应的tap设备,即可看到port数目
~$ sudo ovs-vsctl find port tag=81 | grep tap name : "tap15092468-9d" name : "tapc5effc77-39” name : "tap45cb5822-19"
这样就能查到某个计算节点的某个网络PORT的数目,这样在重启服务等,对于规则的刷新时间大概也心中有数
继续,假如查下tap设备
~$ sudo ovs-vsctl list interface tap45cb5822-19
_uuid : c95c2a3b-e062-4215-9863-ca34f1b3aff7
admin_state : down
bfd : {}
bfd_status : {}
cfm_fault : []
cfm_fault_status : []
cfm_flap_count : []
cfm_health : []
cfm_mpid : []
cfm_remote_mpids : []
cfm_remote_opstate : []
duplex : []
external_ids : {attached-mac="fa:16:3e:dc:9b:11", iface-id="45cb5822-1950-4548-b4d1-edba53c19326", iface-status=active}
ifindex : 0
ingress_policing_burst: 0
ingress_policing_rate: 0
lacp_current : []
link_resets : 0
link_speed : []
link_state : down
mac : []
mac_in_use : []
mtu : []
name : "tap45cb5822-19"
ofport : 3274
ofport_request : []
options : {}
other_config : {}
statistics : {collisions=0, rx_bytes=211858, rx_crc_err=0, rx_dropped=0, rx_errors=0, rx_frame_err=0, rx_over_err=0, rx_packets=2337, tx_bytes=338711484815, tx_dropped=17862, tx_errors=0, tx_packets=1281899341}
status : {driver_name=openvswitch}
type : internal
调用neutron接口来查看该PORT
$ neutron port-show 45cb5822-1950-4548-b4d1-edba53c19326
+-----------------------+----------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+----------------------------------------------------------------------------------------+
| admin_state_up | True |
| allowed_address_pairs | |
| binding:capabilities | {"port_filter": true} |
| binding:host_id | xx-xx-xx-xx |
| binding:profile | {} |
| binding:vif_type | ovs |
| device_id | dhcp0911f353-41ef-5c9b-94fd-200156120418-1da481ca-1533-4888-8cf4-73e99696b499 |
| device_owner | network:dhcp |
| extra_dhcp_opts | |
| filtered_ports | |
| fixed_ips | {"subnet_id": "7cc17d73-af73-46a0-880a-9aadcde3bc66", "ip_address": "115.236.127.205"} |
| id | 45cb5822-1950-4548-b4d1-edba53c19326 |
| ingress_max_rate | |
| mac_address | fa:16:3e:dc:9b:11 |
| max_rate | |
| name | |
| network_id | 1da481ca-1533-4888-8cf4-73e99696b499 |
| port_security_enabled | |
| prefer_rate | |
| status | ACTIVE |
| support_azs | yanlian1 |
| tenant_id | ef8ac74777e149f3934e575e91197552 |
+-----------------------+----------------------------------------------------------------------------------------+
可以发现这是一个DHCP interface,是无法直接清理掉的,因此需要将所在的网络解绑DHCP Agent,然后才进行删除即可
