QoS 包括南北向流量和东西向流量,南北向流量已在网络节点基于TC提供QoS服务,此处主要讲述关于OVN方案基于QoS服务。
原理
1.OVN提供设置Port的QoS接口
2.ovn-controller 处理local binding port时,本地维护local port的qos_map
3.基于overlay port的remote找到egress interface
4.创建egress interface的 linux_htb规则
测试
构建测试环境的脚本:
1 ovn-nbctl ls-add dmz 2 dmzDhcp="$(ovn-nbctl create DHCP_Options cidr=172.16.255.128/26 3 options=""server_id"="172.16.255.129" "server_mac"="02:ac:10:ff:01:29" 4 "lease_time"="3600" "router"="172.16.255.129"")" 5 6 ovn-nbctl lsp-add dmz dmz-vm10 7 ovn-nbctl lsp-set-addresses dmz-vm10 "02:ac:10:ff:01:10 172.16.255.130" 8 ovn-nbctl lsp-set-port-security dmz-vm10 "02:ac:10:ff:01:10 172.16.255.130" 9 ovn-nbctl lsp-set-dhcpv4-options dmz-vm10 $dmzDhcp 10 11 ovn-nbctl lsp-add dmz dmz-vm33 12 ovn-nbctl lsp-set-addresses dmz-vm33 "02:ac:10:ff:01:33 172.16.255.133" 13 ovn-nbctl lsp-set-port-security dmz-vm33 "02:ac:10:ff:01:33 172.16.255.133" 14 ovn-nbctl lsp-set-dhcpv4-options dmz-vm33 $dmzDhcp 15 16 ovn-nbctl set logical_switch_port dmz-vm10 options:qos_max_rate=1000000 17 ovn-nbctl set logical_switch_port dmz-vm10 options:qos_burst=1000000 18 19 # node1 20 ovs-vsctl add-port br-int vm10 -- set interface vm10 type=internal 21 ip link set vm10 address 02:ac:10:ff:01:10 22 ip netns add vm10 23 ip link set vm10 netns vm10 24 ovs-vsctl set Interface vm10 external_ids:iface-id=dmz-vm10 25 ip netns exec vm10 dhclient vm10 26 ip netns exec vm10 ip addr show vm10 27 ip netns exec vm10 ip route show 28 29 ip netns exec vm10 iperf -c 172.16.255.133 -i 3 -t 30 -p 1100 30 31 32 # node2 33 ovs-vsctl add-port br-int vm33 -- set interface vm33 type=internal 34 ip link set vm33 address 02:ac:10:ff:01:33 35 ip netns add vm33 36 ip link set vm33 netns vm33 37 ovs-vsctl set Interface vm33 external_ids:iface-id=dmz-vm33 38 ip netns exec vm33 dhclient vm33 39 ip netns exec vm33 ip addr show vm33 40 ip netns exec vm33 ip route show 41 42 ip netns exec vm33 iperf -s -i 10 -p 1100
缺点
- 仅支持限制出方向/跨主机的QoS
- QoS范围 1M <- -> 100M
建议
建议使用openvswitch的ingress_policing_burst/ingress_policing_rate支持云主机出方向的QoS。