目前,Neutron有一个QoS的proposal(https://wiki.openstack.org/wiki/Neutron/QoS#Documents),但是只有Ciscso和NVP插件实现了QoS功能,其他插件还未实现。因而,如果想在Neutron中来做网络QoS,还需要额外费些力。

一、基于OVS实现网络QoS

前面的proposal设计和接口都有了,完全可以自己来实现QoS功能:

1. 创建QoS-Rules数据库,写入QoS规则,主键qos_id
2. 创建QoS-Port-Binding数据库,记录port_id 与 qos_id绑定关系。
3. 创建虚拟机时,nova调用Quantum暴露出来的API,将绑定关系写入数据库。
4. ovs-agent通过远程调用函数(参数port_id)向ovs-plugin取得QoS规则。

5. ovs-agent将规则施行于Interface上。

比如,OVS的QoS可以用下面这个命令来实现

       def set_interface_qos(self, interface, rate, burst):  

           ingress_policing_rate  = "ingress_policing_rate=%s" % rate
ingress_policing_burst = "ingress_policing_burst=%s" % burst args = ["set", "interface", interface, ingress_policing_rate, ingress_policing_burst] self.run_vsctl(args) def clear_interface_qos(self, interface):
ingress_policing_rate = "ingress_policing_rate=0"
ingress_policing_burst = "ingress_policing_burst=0"
args = ["set", "interface", interface, ingress_policing_rate, ingress_policing_burst] self.run_vsctl(args)

具体实现见下面几篇文章:

http://blog.csdn.net/spch2008/article/details/9279445

http://blog.csdn.net/spch2008/article/details/9281947

http://blog.csdn.net/spch2008/article/details/9281779

http://blog.csdn.net/spch2008/article/details/9283561

http://blog.csdn.net/spch2008/article/details/9283627

http://blog.csdn.net/spch2008/article/details/9283927

http://blog.csdn.net/spch2008/article/details/9287311

二、使用Instance Resource Quota

How to set Server CPU,disk IO,Bandwidth consumption limit for instances using the new feature of nova. By using cgroup,libvirt can set the per instance CPU time consumption percent. and the instances's read_iops,read_byteps, write_iops,write_byteps.also libvirt support limit the instances in/out bandwidth. (https://wiki.openstack.org/wiki/InstanceResourceQuota)

bandwidth params :vif_inbound_average,vif_inbound_peak,vif_inbound_burst,vif_outbound_average,vif_outbound_peak,vif_outbound_burst

Incoming and outgoing traffic can be shaped independently. The bandwidth element can have at most one inbound and at most one outbound child elements. Leaving any of these children element out result in no QoS applied on that traffic direction. So, when you want to shape only network's incoming traffic, use inbound only, and vice versa. Each of these elements have one mandatory attribute average. It specifies average bit rate on interface being shaped. Then there are two optional attributes: peak, which specifies maximum rate at which bridge can send data, and burst, amount of bytes that can be burst at peak speed. Accepted values for attributes are integer numbers, The units for average and peak attributes are kilobytes per second, and for the burst just kilobytes. The rate is shared equally within domains connected to the network.

Config Bandwidth limit for instance network traffic

nova-manage flavor set_key --name m1.small  --key quota:vif_inbound_average --value 10240
nova-manage flavor set_key --name m1.small --key quota:vif_outbound_average --value 10240 or using python-novaclient with admin credentials nova flavor-key m1.small set quota:vif_inbound_average=10240
nova flavor-key m1.small set quota:vif_outbound_average=10240

这儿的网络QoS是直接使用libvirt提供的参数来实现的:(http://www.libvirt.org/formatnetwork.html)
...
<forward mode='nat' dev='eth0'/>
<bandwidth>
<inbound average='1000' peak='5000' burst='5120'/>
<outbound average='128' peak='256' burst='256'/>
</bandwidth>

...

The <bandwidth> element allows setting quality of service for a particular network (since 0.9.4). Setting bandwidth for a network is supported only for networks with a <forward> mode of route, nat, or no mode at all (i.e. an "isolated" network). Setting bandwidth is not supported for forward modes of bridge, passthrough, private, or hostdev. Attempts to do this will lead to a failure to define the network or to create a transient network.

The <bandwidth> element can only be a subelement of a domain's <interface>, a subelement of a <network>, or a subelement of a <portgroup> in a <network>.

As a subelement of a domain's <interface>, the bandwidth only applies to that one interface of the domain. As a subelement of a <network>, the bandwidth is a total aggregate bandwidth to/from all guest interfaces attached to that network, not to each guest interface individually. If a domain's <interface> has <bandwidth> element values higher than the aggregate for the entire network, then the aggregate bandwidth for the <network> takes precedence. This is because the two choke points are independent of each other where the domain's <interface> bandwidth control is applied on the interface's tap device, while the <network> bandwidth control is applied on the interface part of the bridge device created for that network.

As a subelement of a <portgroup> in a <network>, if a domain's <interface> has a portgroup attribute in its <source> element and if the <interface> itself has no <bandwidth> element, then the <bandwidth> element of the portgroup will be applied individually to each guest interface defined to be a member of that portgroup. Any <bandwidth> element in the domain's <interface> definition will override the setting in the portgroup (since 1.0.1).

Incoming and outgoing traffic can be shaped independently. The bandwidth element can have at most one inbound and at most one outbound child element. Leaving either of these children elements out results in no QoS applied for that traffic direction. So, when you want to shape only incoming traffic, use inbound only, and vice versa. Each of these elements have one mandatory attribute - average (or floor as described below). The attributes are as follows, where accepted values for each attribute is an integer number.

average
Specifies the desired average bit rate for the interface being shaped (in kilobytes/second).
peak
Optional attribute which specifies the maximum rate at which the bridge can send data (in kilobytes/second). Note the limitation of implementation: this attribute in the outbound element is ignored (as Linux ingress filters don't know it yet).
burst
Optional attribute which specifies the amount of kilobytes that can be transmitted in a single burst at peak speed.
floor
Optional attribute available only for the inbound element. This attribute guarantees minimal throughput for shaped interfaces. This, however, requires that all traffic goes through one point where QoS decisions can take place, hence why this attribute works only for virtual networks for now (that is <interface type='network'/> with a forward type of route, nat, or no forward at all). Moreover, the virtual network the interface is connected to is required to have at least inbound QoS set (average at least). If using the floor attribute users don't need to specify average. However, peak and burst attributes still require average. Currently, the Linux kernel doesn't allow ingress qdiscs to have any classes therefore floor can be applied only on inbound and not outbound.

Attributes average, peak, and burst are available since 0.9.4, while the floor attribute is available since 1.0.1.

而libvirt中的网络QoS实际上是基于tc来实现的,使用 tc -s -d qdisc 很容易就查到最终的tc配置。

该方法要求虚拟机是基于libvirt的,并且虚拟机和网络相关的服务器上的操作系统要支持Linux Advanced Routing & Traffic Control。

三、基于tc实现网络QoS

这种方法其实是上面两种方法的结合,即还是在neutron中对外开放设置QoS接口,但把OVS的ingress_policing_rate等换成tc来实现。

关于tc的使用可以看看http://lartc.org/lartc.html,很详细。

该方法要求虚拟机和网络相关的服务器上的操作系统要支持Linux Advanced Routing & Traffic Control。

Neutron Networking QoS的更多相关文章

  1. neutron qos Quality of Service

    Quality of Service advanced service is designed as a service plugin. The service is decoupled from t ...

  2. Networking in too much detail

    The players This document describes the architecture that results from a particular OpenStack config ...

  3. 理解 neutron

    之前大师发个结构图. understanding_neutron.pdf 自己走读了代码: 1.  get_extensions_path() # 在/opt/stack/neutron/neutro ...

  4. 使用Devstack部署neutron网络节点

    本文为minxihou的翻译文章,转载请注明出处Bob Hou: http://blog.csdn.net/minxihou JmilkFan:minxihou的技术博文方向是 算法&Open ...

  5. OpenStack Q版本新功能以及各核心组件功能对比

    OpenStack Q版本已经发布了一段时间了.今天, 小编来总结一下OpenStack Q版本核心组件的各项主要新功能, 再来汇总一下最近2年来OpenStack N.O.P.Q各版本核心组件的主要 ...

  6. 乐视云计算基于OpenStack的IaaS实践

    本文作者岳龙广,现在就职于乐视云计算有限公司,负责IaaS部门的工作. 从开始工作就混在开源世界里,在虚拟化方面做过CloudStack/Ovirt开发,现在是做以OpenStack为基础的乐视云平台 ...

  7. [Openstack]使用devstack自己主动化安装

    os环境为: ubuntu14.04 安装步骤: 更新系统软件包: sudo apt-get dist-upgrade #出现无法訪问到ubuntu官网的错误. 安装git: sudo apt-get ...

  8. Openstack REST API

    There are some high quality resources that already cover the OpenStack API, so this is a YEA (yet an ...

  9. OpenStack及其构成简介

    新的一年新的开始,突然想学习下Openstack,之前了解过很多,但是想系统的学习一下,第一次写博客,只想把学到的东西记录下来加深印象,如有写的不好的地方请多多见谅.下面开门见山. 1.What is ...

随机推荐

  1. 世纪互联运营的Microsoft Azure正式支持FreeBSD虚拟机镜像

    自2012年开始,微软云计算与企业事业部和Citrix思杰,NetApp达成合作,共同开发出第一版针对Hyper-V虚拟设备驱动以及相关的用户态程序,并将此称之为集成服务(Integration Se ...

  2. JQuery onload、ready概念介绍及使用方法

    页面加载完成有两种事件,一是ready,表示文档结构已经加载完成,onload,ready概念容易混淆,下面为大家详细介绍下   页面加载完成有两种事件,一是ready,表示文档结构已经加载完成(不包 ...

  3. 怎么设置session无响应超时时间并且自动返回登陆页面

    ------解决方案--------------------看下我的 session.setAttribute(UserInfo.USERINFO, userinfo); session.setMax ...

  4. 关于freemarker标签+Spring3.0 V层学习

    import标签 就是把其他的ftl页面引用进来 <#import "/common/ui.ftl" as ui> 使用时 <@ui.message/>,m ...

  5. 准备开始自己搞企业管理软件,从openerp入手

    公司运行了半年多,人还比较少,只用了一些即时通讯工具,还有svn等基本的工具 记账用的是gnucash 其他的管理急需相应的软件,找了很长时间也没有合适的 想了想,还是从开源的openerp odoo ...

  6. hihoCoder #1040 (判断是否为矩形)

    题目大意:给四条线段,问能否构成一个矩形? 题目分析:先判断能否构成四边形,然后选一条边,看另外三条边中是否为一条与他平行,两条垂直. 代码如下: # include<iostream> ...

  7. PHP 安装 eaccelerator

    安装开发工具包: yum groupinstall -y "Development Tools" 查看本机php版本: rpm -qi php 下载rpm包: wget http: ...

  8. poj1456 结构体排序+贪心

    题意:给出很多商品,每个商品有价值和出售期限,只能在期限内出售才能获取利润,每一个单位时间只能出售一种商品,问最多能获得多少利润. 只需要按照优先价值大的,其次时间长的排序所有物品,然后贪心选择,从它 ...

  9. 附录三 嵌入式C程序的编译与调试

    课程回顾 C语言库的特性和发展 C语言库的常用库函数 标准库函数的特色应用 git@github.com:Kevin-Dfg/Data-Structures-and-Algorithm-Analysi ...

  10. 如何更新Android SDK和Build Tool

    1. 运行命令 android 2. 勾选并安装需要的版本 3. 完成!