本文地址:http://blog.csdn.net/spch2008/article/details/9279445
起因:OpenStack源代码看有些日子了,于是想找点东西做做。发现NVP有QoS功能,但是是针对Port的,有些复杂,
就将其简化,做一个针对Interface的QoS功能。针对Interface的QoS只需要几条命令即可,做起来方便简单。
ovs-vsctl set interface vif0.0 ingress_policing_rate=1000 ovs-vsctl set interface vif0.0 ingress_policing_burst=100 ingress_policing_rate:最大发送速率(单位均为kbps) ingress_policing_burst:超过ingress_policing_rate的最大浮动值
过程:
1.首先通过命令创建QoS条目:
root@nova-network:~# quantum qos-create --name spch2008 --rate 1000 --burst 100 Created a new ovsqos: +-----------+--------------------------------------+ | Field | Value | +-----------+--------------------------------------+ | burst | 100 | | id | 41d1c686-3298-40bf-a114-b20e7c4e370c | | name | spch2008 | | rate | 1000 | | tenant_id | 9b320e2822da4461967232e938d92d18 | +-----------+--------------------------------------+2.启动虚拟机的时候,将qos参数传入
nova boot --flavor 1 --image 4d3175cf-9d82-44de-862b-f94bd6e71fb7 --key_name mykey instance003 --security_groups default --interface_qos 41d1c686-3298-40bf-a114-b20e7c4e370c
root@nova-compute1:~# ovs-vsctl list Interface _uuid : 2542b505-c895-4e16-9dfc-535c1a922109 admin_state : up cfm_fault : [] cfm_mpid : [] cfm_remote_mpids : [] duplex : full external_ids : {attached-mac="fa:16:3e:d8:e1:7e", iface-id="d92f45e9-9c41-424d-9410-2dc5bd82aeca", iface-status=active, vm-uuid="0062f57a-1fda-444b-a7a5-63dafa8b87d4"} ingress_policing_burst: 100 ingress_policing_rate: 1000 lacp_current : [] link_resets : 2 link_speed : 10000000000 link_state : up mac : [] mtu : 1500 name : "qvod92f45e9-9c" ofport : 8 options : {} other_config : {} statistics : {collisions=0, rx_bytes=1336, rx_crc_err=0, rx_dropped=0, rx_errors=0, rx_frame_err=0, rx_over_err=0, rx_packets=14, tx_bytes=0, tx_dropped=0, tx_errors=0, tx_packets=0} status : {driver_name=veth, driver_version="1.0", firmware_version="N/A"} type : ""
思路:
5. ovs-agent将规则施行于Interface上。
开发环境:
1. 采用OpenStack F版本进行开发
2. 一个控制节点nova-control, 一个网络节点nova-network,一个计算节点nova-compute