通常在测试过程中,会有PORT,TAP设备等概念,记录一下从Neutron和OpenvSwitch的角度分析的结果
首先,neutron接口查看一个普通的port
$ neutron port-show 198173a6-f20c-4d84-af4c-e07ad3508544
+-----------------------+-------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+-------------------------------------------------------------------------------------+
| admin_state_up | True |
| allowed_address_pairs | |
| binding:capabilities | {"port_filter": true} |
| binding:host_id | 10-80-0-49 |
| binding:profile | {} |
| binding:vif_type | ovs |
| device_id | 3e87528b-fe40-40df-8550-0dd3bfaba166 |
| device_owner | compute:pub.pub1 |
| extra_dhcp_opts | |
| filtered_ports | |
| fixed_ips | {"subnet_id": "bc9fc957-2fdf-4663-9189-65fc9b0a559d", "ip_address": "10.80.80.36"} |
| id | 198173a6-f20c-4d84-af4c-e07ad3508544 |
| ingress_max_rate | |
| mac_address | fa:16:3e:d3:e1:69 |
| max_rate | |
| name | |
| network_id | f00eff19-afd5-4be6-ae16-dcb51c0455f7 |
| port_security_enabled | |
| prefer_rate | |
| status | ACTIVE |
| support_azs | pub |
| tenant_id | 10e5051a1cee4f8ebb0e8b5d877de581 |
+-----------------------+-------------------------------------------------------------------------------------+
这里可以看到所在节点NODE以及挂载的虚拟机UUID,也就是device_id,binding在ovs上,那么就直接去所在的节点机查看这个设备
其实根据PORT的UUID就可以得到TAP设备的Name,第一个-加后两位,前面加一个tap即可,也就是:tap198173a6-f2
直接NODE上通过virsh也可以确认一下tap设备名
$ sudo virsh dumpxml 3e87528b-fe40-40df-8550-0dd3bfaba166 | grep tap
target dev='tap198173a6-f2'
target dev='tap23e1c38f-4b
可以看到这个VM绑定了两个PORT,其中有一个和上面预期的一样
那么接下来通过ovs查询设备
$sudo ovs-vsctl show | less
Port "tap23e1c38f-4b"
tag: 21
Interface "tap23e1c38f-4b"
这样就能够在ovs上查询到该设备,最终看下这里和neutron接口查询的信息的相关性
$ sudo ovs-vsctl list interface tap198173a6-f2
_uuid : ea5eb70c-7ccf-46e8-9f5b-09f947ea9a6c
admin_state : up
bfd : {}
bfd_status : {}
cfm_fault : []
cfm_fault_status : []
cfm_flap_count : []
cfm_health : []
cfm_mpid : []
cfm_remote_mpids : []
cfm_remote_opstate : []
duplex : full
error : []
external_ids : {attached-mac="fa:16:3e:d3:e1:69", iface-id="198173a6-f20c-4d84-af4c-e07ad3508544", iface-status=active, vm-id="3e87528b-fe40-40df-8550-0dd3bfaba166"}
ifindex : 304
ingress_policing_burst: 0
ingress_policing_rate: 0
lacp_current : []
link_resets : 1
link_speed : 10000000
link_state : up
lldp : {}
mac : []
mac_in_use : "fe:16:3e:d3:e1:69"
mtu : 1500
name : "tap198173a6-f2"
ofport : 197
ofport_request : []
省略……
看到external_ids这个字段,attached-mac为mac地址,iface-id为port uuid,vm-id为挂载的虚拟机uuid,对比neutron port-show的结果,可以发现两者是一致的
