Neutron QoS 使用
Neutron Liberty版已经支持openvswitch qos-rate-limiting: http://openvswitch.org/support/config-cookbooks/qos-rate-limiting/,下面我们通过简单的测试介绍其使用:
安装最新neutron和neutronclient
$ git clone https://github.com/openstack/neutron
$ cd neutron
$ sudo python setup.py install
$ cd ..
$ git clone https://github.com/openstack/python-neutronclient
$ cd python-neutronclient
$ sudo python setup.py install
打开qos plugin支持
Neutron Server 节点
/etc/neutron/neutron.conf, service_plugins加入qos如下:service_plugins = router,firewall,lbaas,vpnaas,metering,qos
/etc/neutron/plugins/ml2/ml2_conf.ini, extension_drivers加入qos如下:
[ml2]
extension_drivers = port_security,qosNeutron Agent 节点
/etc/neutron/plugins/ml2/ml2_conf.ini, extensions加入qos如下:[agent]
extensions = qos
安全组设置
我们通过scp来测试qos,所以需要打开安全组tcp 22端口:
$ neutron security-group-rule-create –direction ingress \
–protocol tcp \
–port-range-min 22 \
–port-range-max 22 \
default
创建虚拟机
$ nova boot –image cirros-0.3.4-x86_64-uec –flavor m1.tiny –nic net-id='net-id' --min-count 2 --max-count 2 test
$ nova list
+--------------------------------------+--------+----------------------------------+--------+------------+-------------+-----------------+
| ID | Name | Tenant ID | Status | Task State | Power State | Networks |
+--------------------------------------+--------+----------------------------------+--------+------------+-------------+-----------------+
| 9cb84a9d-07c7-4453-a01b-ba537dcccff9 | test-1 | 68041545c58c468fa48f9bb0361e536d | ACTIVE | - | Running | test=172.16.1.5 |
| 8c8d48b6-acd8-43cc-8767-b9e7bb4afa75 | test-2 | 68041545c58c468fa48f9bb0361e536d | ACTIVE | - | Running | test=172.16.1.6 |
+--------------------------------------+--------+----------------------------------+--------+------------+-------------+-----------------+
创建QoS规则
$ neutron qos-policy-create --shared test-policy
Created a new policy:
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| description | |
| id | 8c399fce-4398-4151-b29f-17d7e55c1670 |
| name | test-policy |
| rules | |
| shared | True |
| tenant_id | 037efa515b1e44c682fff1a337371962 |
+-------------+--------------------------------------+
$ neutron qos-bandwidth-limit-rule-create --max-kbps 1000 --max-burst-kbps 100 test-policy
Created a new bandwidth_limit_rule:
+----------------+--------------------------------------+
| Field | Value |
+----------------+--------------------------------------+
| id | ad919837-e4d8-4601-b512-e4b3dd1ee655 |
| max_burst_kbps | 100 |
| max_kbps | 1000 |
+----------------+--------------------------------------+
添加QoS规则至端口
$ neutron port-list|grep 172.16.1
| 784afa86-d61e-4f42-87fe-a9994897ea02 | | fa:16:3e:d5:f9:80 | {"subnet_id": "7e9bab79-b451-4c72-88ba-44d7e6f8306a", "ip_address": "172.16.1.1"} |
| 8c8b9944-c9e1-4343-89e5-03f77c2e058d | | fa:16:3e:58:5d:10 | {"subnet_id": "7e9bab79-b451-4c72-88ba-44d7e6f8306a", "ip_address": "172.16.1.5"} |
| d760f813-b3d9-4094-a09a-132d2dc58409 | | fa:16:3e:a7:7c:07 | {"subnet_id": "7e9bab79-b451-4c72-88ba-44d7e6f8306a", "ip_address": "172.16.1.6"} |
| f3bef01e-3667-4ee7-8f52-642f8783b212 | | fa:16:3e:92:e1:16 | {"subnet_id": "7e9bab79-b451-4c72-88ba-44d7e6f8306a", "ip_address": "172.16.1.2"} |
$ neutron qos-policy-list
+--------------------------------------+-------------+
| id | name |
+--------------------------------------+-------------+
| 8c399fce-4398-4151-b29f-17d7e55c1670 | test-policy |
+--------------------------------------+-------------+
$ neutron port-update --qos-policy 8c399fce-4398-4151-b29f-17d7e55c1670 8c8b9944-c9e1-4343-89e5-03f77c2e058d
Updated port: 8c8b9944-c9e1-4343-89e5-03f77c2e058d
测试
未完待续……