neutron中配置使用qos限制网络带宽

(文章来自作者维护的社区微信公众号【虚拟化云计算】)

qos基础
在Linux系统上,无论去使用怎样的工具,最终都要使用TC来做流量控制。TC利用队列规定建立处理数据包的队列,并定义队列中的数据包被发送的方式, 从而实现对流量的控制。Linux内核中支持的队列主要有:
TBF(Token Bucket Flow令牌桶过滤器)
pfifo_fast(Third Band First In First Out Queue先进先出队列)
SFQ(Stochastic Fairness Queueing随机公平队列)
HTB(Hierarchy Token Bucket分层令牌桶)等。


一。内容
OpenStack在L版中支持网络qos,这是一个非常实用的功能,以前的版本中,对于虚机网络流量qos,我们只能通过Flavor来设置qos,这需要去维护很多个Flavor来保证不同的qos需求,因此Flavor-qos非常不灵活。
Neutron中qos限制发送数据采用TBF队列。
以下是通过限制端口来达到限速目的,也就是将qos规则绑定在虚拟机网卡对应的tap设备上限速。主要设置两个参数,一个是rate带宽,一个是burst,neutron命令中分别对应max-kbps和max-burst-kbps


二。配置

1.修改neutron-server的neutron.conf配置
# vi /etc/neutron/neutron.conf
[DEFAULT]
service_plugins =neutron.services.qos.qos_plugin.QoSPlugin

2.修改neutron-server的ml2_conf.ini配置
# vi  /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
extension_drivers = qos

3.修改neutron-linuxbridge-agent的 linuxbridge_agent.ini配置
# vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[agent]
extensions = qos

三。规则
1.bandwidth limit rule
2.minimum bandwidth rule

四。使用
1.创建qos-policy,并给policy设置rule
neutron qos-policy-create bw-limiter
neutron qos-bandwidth-limit-rule-create bw-limiter --max-kbps 3000 --max-burst-kbps 300

2.给port或网络设置qos-policy
neutron port-create --qos-policy  bw-limiter
neutron port-update --qos-policy bw-limiter | --no-qos-policy

neutron net-create --qos-policy  bw-limiter
neutron net-update --qos-policy bw-limiter | --no-qos-policy

使用举例:
# tc -s qdisc show dev tap77f1557f-fd               
qdisc pfifo_fast 0: root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
Sent 91481254 bytes 69639 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
qdisc ingress ffff: parent ffff:fff1 ----------------
Sent 155682 bytes 2195 pkt (dropped 835, overlimits 0 requeues 0)
backlog 0b 0p requeues 0

# tc filter show dev  tap77f1557f-fd parent ffff:
filter protocol all pref 49 basic
filter protocol all pref 49 basic handle 0x1
police 0x5 rate 30Kbit burst 3Kb mtu 64Kb action drop overhead 0b
ref 1 bind 1



===============================================================
关注微信公众号【虚拟化 云计算】,阅读更多虚拟化 云计算知识,纯技术干货更新不停。

猜你喜欢

转载自blog.csdn.net/isclouder/article/details/79712299
今日推荐