summaryrefslogtreecommitdiff
path: root/doc/source/admin/config-qos.rst
blob: b46273fc97ca3be7394e0730ee3748c07882c12f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
.. _config-qos:

========================
Quality of Service (QoS)
========================

QoS is defined as the ability to guarantee certain network requirements
like bandwidth, latency, jitter, and reliability in order to satisfy a
Service Level Agreement (SLA) between an application provider and end
users.

Network devices such as switches and routers can mark traffic so that it is
handled with a higher priority to fulfill the QoS conditions agreed under
the SLA. In other cases, certain network traffic such as Voice over IP (VoIP)
and video streaming needs to be transmitted with minimal bandwidth
constraints. On a system without network QoS management, all traffic will be
transmitted in a "best-effort" manner making it impossible to guarantee service
delivery to customers.

QoS is an advanced service plug-in. QoS is decoupled from the rest of the
OpenStack Networking code on multiple levels and it is available through the
ml2 extension driver.

Details about the DB models, API extension, and use cases are out of the scope
of this guide but can be found in the
`Neutron QoS specification <https://specs.openstack.org/openstack/neutron-specs/specs/liberty/qos-api-extension.html>`_.


Supported QoS rule types
~~~~~~~~~~~~~~~~~~~~~~~~

QoS supported rule types are now available as ``VALID_RULE_TYPES`` in `QoS rule types
<https://opendev.org/openstack/neutron-lib/src/branch/master/neutron_lib/services/qos/constants.py>`_:

* bandwidth_limit: Bandwidth limitations on networks, ports or floating IPs.

* packet_rate_limit: Packet rate limitations on certain types of traffic.

* dscp_marking: Marking network traffic with a DSCP value.

* minimum_bandwidth: Minimum bandwidth constraints on certain types of traffic.

* minimum_packet_rate: Minimum packet rate constraints on certain types of traffic.


Any QoS driver can claim support for some QoS rule types
by providing a driver property called
``supported_rules``, the QoS driver manager will recalculate rule types
dynamically that the QoS driver supports. In the most simple case, the
property can be represented by a simple Python list defined on the class.

The following table shows the Networking back ends, QoS supported rules, and
traffic directions (from the VM point of view).

.. table:: **Networking back ends, supported rules, and traffic direction**

    ====================  =============================  =======================  ===================  ===================
     Rule \\ back end      Open vSwitch                  SR-IOV                   Linux bridge         OVN
    ====================  =============================  =======================  ===================  ===================
     Bandwidth limit       Egress \\ Ingress             Egress (1)               Egress \\ Ingress    Egress \\ Ingress
     Packet rate limit     Egress \\ Ingress             -                        -                    -
     Minimum bandwidth     Egress \\ Ingress (2)         Egress \\ Ingress (2)    -                    -
     Minimum packet rate   -                             -                        -                    -
     DSCP marking          Egress                        -                        Egress               Egress
    ====================  =============================  =======================  ===================  ===================

.. note::

   (1) Max burst parameter is skipped because it is not supported by the
       IP tool.
   (2) Placement based enforcement works for both egress and ingress directions,
       but dataplane enforcement depends on the backend.

.. table:: **Neutron backends, supported directions and enforcement types for Minimum Bandwidth rule**

    ============================  ====================  ====================  ==============  =====
     Enforcement type \ Backend    Open vSwitch          SR-IOV                Linux Bridge    OVN
    ============================  ====================  ====================  ==============  =====
     Dataplane                     Egress (3)            Egress (1)            -               -
     Placement                     Egress/Ingress (2)    Egress/Ingress (2)    -               -
    ============================  ====================  ====================  ==============  =====

.. note::

    (1) Since Newton
    (2) Since Stein
    (3) Open vSwitch minimum bandwidth support is only implemented for egress
        direction and only for networks without tunneled traffic (only VLAN and
        flat network types).

.. note:: The SR-IOV agent does not support dataplane enforcement for ports
  with ``direct-physical`` vnic_type. However since Yoga the Placement
  enforcement is supported for this vnic_type too.

.. table:: **Neutron backends, supported directions and enforcement types for Minimum Packet Rate rule**

    ============================  ==========================  ====================  ==============  =====
     Enforcement type \ Backend    Open vSwitch                SR-IOV                Linux Bridge    OVN
    ============================  ==========================  ====================  ==============  =====
     Dataplane                     -                           -                     -               -
     Placement                     Any(1)/Egress/Ingress (2)   -                     -               -
    ============================  ==========================  ====================  ==============  =====

.. note::

    (1) Minimum packet rate rule supports ``any`` direction that can be used
        with non-hardware-offloaded OVS deployments, where packets processed
        from both ingress and egress directions are handled by the same set of
        CPU cores.
    (2) Since Yoga.

For an ml2 plug-in, the list of supported QoS rule types and parameters is
defined as a common subset of rules supported by all active mechanism drivers.
A QoS rule is always attached to a QoS policy. When a rule is created or
updated:

* The QoS plug-in will check if this rule and parameters are supported by any
  active mechanism driver if the QoS policy is not attached to any port or
  network.

* The QoS plug-in will check if this rule and parameters are supported by the
  mechanism drivers managing those ports if the QoS policy is attached to any
  port or network.


Valid DSCP Marks
----------------

Valid DSCP mark values are even numbers between 0 and 56, except 2-6, 42, and
50-54.  The full list of valid DSCP marks is:

0, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 44, 46,
48, 56


L3 QoS support
~~~~~~~~~~~~~~

The Neutron L3 services have implemented their own QoS extensions. Currently
only bandwidth limit QoS is provided. This is the L3 QoS extension list:

* Floating IP bandwidth limit: the rate limit is applied per floating IP
  address independently.

* Gateway IP bandwidth limit: the rate limit is applied in the router namespace
  gateway port (or in the SNAT namespace in case of DVR edge router). The rate
  limit applies to the gateway IP; that means all traffic using this gateway IP
  will be limited. This rate limit does not apply to the floating IP traffic.


L3 services that provide QoS extensions:

* L3 router: implements the rate limit using `Linux TC
  <https://man7.org/linux/man-pages/man8/tc.8.html>`_.

* OVN L3: implements the rate limit using the `OVN QoS metering rules
  <https://man7.org/linux/man-pages/man8/ovn-nbctl.8.html#LOGICAL_SWITCH_QOS_RULE_COMMANDS>`_.


The following table shows the L3 service, the QoS supported extension, and
traffic directions (from the VM point of view) for **bandwidth limiting**.

.. table:: **L3 service, supported extension, and traffic direction**

    ====================  ===================  ===================
     Rule \\ L3 service    L3 router            OVN L3
    ====================  ===================  ===================
     Floating IP           Egress \\ Ingress    Egress \\ Ingress
     Gateway IP            Egress \\ Ingress    Egress \\ Ingress
    ====================  ===================  ===================


Configuration
~~~~~~~~~~~~~

To enable the service on a cloud with the architecture described in
`Networking architecture <https://docs.openstack.org/security-guide/networking/architecture.html#openstack-networking-service-placement-on-physical-servers>`_,
follow the steps below:

On the controller nodes:

#. Add the QoS service to the ``service_plugins`` setting in
   ``/etc/neutron/neutron.conf``. For example:

   .. code-block:: none

      service_plugins = router,metering,qos

#. Optionally, set the needed ``notification_drivers`` in the ``[qos]``
   section in ``/etc/neutron/neutron.conf`` (``message_queue`` is the
   default).

#. Optionally, in order to enable the floating IP QoS extension ``qos-fip``,
   set the ``service_plugins`` option in ``/etc/neutron/neutron.conf`` to
   include both ``router`` and ``qos``. For example:

   .. code-block:: none

      service_plugins = router,qos

#. In ``/etc/neutron/plugins/ml2/ml2_conf.ini``, add ``qos`` to
   ``extension_drivers`` in the ``[ml2]`` section. For example:

   .. code-block:: ini

      [ml2]
      extension_drivers = port_security,qos

#. Edit the configuration file for the agent you are using and set the
   ``extensions`` to include ``qos`` in the ``[agent]`` section of the
   configuration file. The agent configuration file will reside in
   ``/etc/neutron/plugins/ml2/<agent_name>_agent.ini`` where ``agent_name``
   is the name of the agent being used (for example ``openvswitch``).
   For example:

   .. code-block:: ini

      [agent]
      extensions = qos

On the network and compute nodes:

#. Edit the configuration file for the agent you are using and set the
   ``extensions`` to include ``qos`` in the ``[agent]`` section of the
   configuration file. The agent configuration file will reside in
   ``/etc/neutron/plugins/ml2/<agent_name>_agent.ini`` where ``agent_name``
   is the name of the agent being used (for example ``openvswitch``).
   For example:

   .. code-block:: ini

      [agent]
      extensions = qos

#. Optionally, in order to enable QoS for floating IPs, set the ``extensions``
   option in the ``[agent]`` section of ``/etc/neutron/l3_agent.ini`` to
   include ``fip_qos``. If ``dvr`` is enabled, this has to be done for all the
   L3 agents. For example:

   .. code-block:: ini

      [agent]
      extensions = fip_qos

.. note::

   Floating IP associated to neutron port or to port forwarding
   can all have bandwidth limit since Stein release. These neutron server
   side and agent side extension configs will enable it once for all.

#. Optionally, in order to enable QoS for router gateway IPs, set the
   ``extensions`` option in the ``[agent]`` section of
   ``/etc/neutron/l3_agent.ini`` to include ``gateway_ip_qos``. Set this
   to all the ``dvr_snat`` or ``legacy`` L3 agents. For example:

   .. code-block:: ini

      [agent]
      extensions = gateway_ip_qos


   And ``gateway_ip_qos`` should work together with the ``fip_qos`` in L3
   agent for centralized routers, then all L3 IPs with binding QoS policy
   can be limited under the QoS bandwidth limit rules:

   .. code-block:: ini

      [agent]
      extensions = fip_qos, gateway_ip_qos


#. As rate limit doesn't work on Open vSwitch's ``internal`` ports,
   optionally, as a workaround, to make QoS bandwidth limit work on
   router's gateway ports, set ``ovs_use_veth`` to ``True`` in ``DEFAULT``
   section in ``/etc/neutron/l3_agent.ini``

  .. code-block:: ini

      [DEFAULT]
      ovs_use_veth = True

.. note::

   QoS currently works with ml2 only (SR-IOV, Open vSwitch, and linuxbridge
   are drivers enabled for QoS).

DSCP marking on outer header for overlay networks
-------------------------------------------------

When using overlay networks (e.g., VxLAN), the DSCP marking rule only
applies to the inner header, and during encapsulation, the DSCP mark is
not automatically copied to the outer header.

#. In order to set the DSCP value of the outer header, modify the ``dscp``
   configuration option in ``/etc/neutron/plugins/ml2/<agent_name>_agent.ini``
   where ``<agent_name>`` is the name of the agent being used
   (e.g., ``openvswitch``):

   .. code-block:: ini

      [agent]
      dscp = 8

#. In order to copy the DSCP field of the inner header to the outer header,
   change the ``dscp_inherit`` configuration option to true in
   ``/etc/neutron/plugins/ml2/<agent_name>_agent.ini`` where ``<agent_name>``
   is the name of the agent being used (e.g., ``openvswitch``):

   .. code-block:: ini

      [agent]
      dscp_inherit = true

   If the ``dscp_inherit`` option is set to true, the previous ``dscp`` option
   is overwritten.

Trusted projects policy.yaml configuration
------------------------------------------

If projects are trusted to administrate their own QoS policies in
your cloud, neutron's file ``policy.yaml`` can be modified to allow this.

Modify ``/etc/neutron/policy.yaml`` policy entries as follows:

.. code-block:: none

   "get_policy": "rule:regular_user",
   "create_policy": "rule:regular_user",
   "update_policy": "rule:regular_user",
   "delete_policy": "rule:regular_user",
   "get_rule_type": "rule:regular_user",

To enable bandwidth limit rule:

.. code-block:: none

   "get_policy_bandwidth_limit_rule": "rule:regular_user",
   "create_policy_bandwidth_limit_rule": "rule:regular_user",
   "delete_policy_bandwidth_limit_rule": "rule:regular_user",
   "update_policy_bandwidth_limit_rule": "rule:regular_user",

To enable DSCP marking rule:

.. code-block:: none

   "get_policy_dscp_marking_rule": "rule:regular_user",
   "create_policy_dscp_marking_rule": "rule:regular_user",
   "delete_policy_dscp_marking_rule": "rule:regular_user",
   "update_policy_dscp_marking_rule": "rule:regular_user",

To enable minimum bandwidth rule:

.. code-block:: none

    "get_policy_minimum_bandwidth_rule": "rule:regular_user",
    "create_policy_minimum_bandwidth_rule": "rule:regular_user",
    "delete_policy_minimum_bandwidth_rule": "rule:regular_user",
    "update_policy_minimum_bandwidth_rule": "rule:regular_user",

To enable minimum packet rate rule:

.. code-block:: none

    "get_policy_minimum_packet_rate_rule": "rule:regular_user",
    "create_policy_minimum_packet_rate_rule": "rule:regular_user",
    "delete_policy_minimum_packet_rate_rule": "rule:regular_user",
    "update_policy_minimum_packet_rate_rule": "rule:regular_user",

User workflow
~~~~~~~~~~~~~

QoS policies are only created by admins with the default ``policy.yaml``.
Therefore, you should have the cloud operator set them up on
behalf of the cloud projects.

If projects are trusted to create their own policies, check the trusted
projects ``policy.yaml`` configuration section.

First, create a QoS policy and its bandwidth limit rule:

.. code-block:: console

   $ openstack network qos policy create bw-limiter
   +-------------------+--------------------------------------+
   | Field             | Value                                |
   +-------------------+--------------------------------------+
   | description       |                                      |
   | id                | 5df855e9-a833-49a3-9c82-c0839a5f103f |
   | is_default        | False                                |
   | name              | bw-limiter                           |
   | project_id        | 4db7c1ed114a4a7fb0f077148155c500     |
   | rules             | []                                   |
   | shared            | False                                |
   +-------------------+--------------------------------------+


   $ openstack network qos rule create --type bandwidth-limit --max-kbps 3000 \
       --max-burst-kbits 2400 --egress bw-limiter
   +----------------+--------------------------------------+
   | Field          | Value                                |
   +----------------+--------------------------------------+
   | direction      | egress                               |
   | id             | 92ceb52f-170f-49d0-9528-976e2fee2d6f |
   | max_burst_kbps | 2400                                 |
   | max_kbps       | 3000                                 |
   | name           | None                                 |
   | project_id     |                                      |
   +----------------+--------------------------------------+


.. note::

   The QoS implementation requires a burst value to ensure proper behavior of
   bandwidth limit rules in the Open vSwitch and Linux bridge agents.
   Configuring the proper burst value is very important. If the burst value is
   set too low, bandwidth usage will be throttled even with a proper bandwidth
   limit setting. This issue is discussed in various documentation sources, for
   example in `Juniper's documentation
   <http://www.juniper.net/documentation/en_US/junos12.3/topics/concept/policer-mx-m120-m320-burstsize-determining.html>`_.
   For TCP traffic it is recommended to set burst value as 80% of desired bandwidth
   limit value. For example, if the bandwidth limit is set to 1000kbps then enough
   burst value will be 800kbit. If the configured burst value is too low,
   achieved bandwidth limit will be lower than expected. If the configured burst
   value is too high, too few packets could be limited and achieved bandwidth
   limit would be higher than expected.
   If you do not provide a value, it defaults to 80% of the bandwidth limit which
   works for typical TCP traffic.

Second, associate the created policy with an existing neutron port.
In order to do this, user extracts the port id to be associated to
the already created policy. In the next example, we will assign the
``bw-limiter`` policy to the VM with IP address ``192.0.2.1``.

.. code-block:: console

   $ openstack port list
   +--------------------------------------+-----------------------------------+
   | ID                                   | Fixed IP Addresses                |
   +--------------------------------------+-----------------------------------+
   | 0271d1d9-1b16-4410-bd74-82cdf6dcb5b3 | { ... , "ip_address": "192.0.2.1"}|
   | 88101e57-76fa-4d12-b0e0-4fc7634b874a | { ... , "ip_address": "192.0.2.3"}|
   | e04aab6a-5c6c-4bd9-a600-33333551a668 | { ... , "ip_address": "192.0.2.2"}|
   +--------------------------------------+-----------------------------------+

   $ openstack port set --qos-policy bw-limiter \
       88101e57-76fa-4d12-b0e0-4fc7634b874a

In order to detach a port from the QoS policy, simply update again the
port configuration.

.. code-block:: console

   $ openstack port unset --qos-policy 88101e57-76fa-4d12-b0e0-4fc7634b874a


Ports can be created with a policy attached to them too.

.. code-block:: console

   $ openstack port create --qos-policy bw-limiter --network private port1
   +-----------------------+--------------------------------------------------+
   | Field                 | Value                                            |
   +-----------------------+--------------------------------------------------+
   | admin_state_up        | UP                                               |
   | allowed_address_pairs |                                                  |
   | binding_host_id       |                                                  |
   | binding_profile       |                                                  |
   | binding_vif_details   |                                                  |
   | binding_vif_type      | unbound                                          |
   | binding_vnic_type     | normal                                           |
   | created_at            | 2017-05-15T08:43:00Z                             |
   | data_plane_status     | None                                             |
   | description           |                                                  |
   | device_id             |                                                  |
   | device_owner          |                                                  |
   | dns_assignment        | None                                             |
   | dns_name              | None                                             |
   | extra_dhcp_opts       |                                                  |
   | fixed_ips             | ip_address='10.0.10.4', subnet_id='292f8c1e-...' |
   | id                    | f51562ee-da8d-42de-9578-f6f5cb248226             |
   | ip_address            | None                                             |
   | mac_address           | fa:16:3e:d9:f2:ba                                |
   | name                  | port1                                            |
   | network_id            | 55dc2f70-0f92-4002-b343-ca34277b0234             |
   | option_name           | None                                             |
   | option_value          | None                                             |
   | port_security_enabled | False                                            |
   | project_id            | 4db7c1ed114a4a7fb0f077148155c500                 |
   | qos_policy_id         | 5df855e9-a833-49a3-9c82-c0839a5f103f             |
   | revision_number       | 6                                                |
   | security_group_ids    | 0531cc1a-19d1-4cc7-ada5-49f8b08245be             |
   | status                | DOWN                                             |
   | subnet_id             | None                                             |
   | tags                  | []                                               |
   | trunk_details         | None                                             |
   | updated_at            | 2017-05-15T08:43:00Z                             |
   +-----------------------+--------------------------------------------------+


You can attach networks to a QoS policy. The meaning of this is that
any compute port connected to the network will use the network policy by
default unless the port has a specific policy attached to it. Internal network
owned ports like DHCP and internal router ports are excluded from network
policy application.

In order to attach a QoS policy to a network, update an existing
network, or initially create the network attached to the policy.

.. code-block:: console

    $ openstack network set --qos-policy bw-limiter private

The created policy can be associated with an existing floating IP.
In order to do this, user extracts the floating IP id to be associated to
the already created policy. In the next example, we will assign the
``bw-limiter`` policy to the floating IP address ``172.16.100.18``.

.. code-block:: console

   $ openstack floating ip list
   +--------------------------------------+---------------------+------------------+------+-----+
   | ID                                   | Floating IP Address | Fixed IP Address | Port | ... |
   +--------------------------------------+---------------------+------------------+------+-----+
   | 1163d127-6df3-44bb-b69c-c0e916303eb3 | 172.16.100.9        | None             | None | ... |
   | d0ed7491-3eb7-4c4f-a0f0-df04f10a067c | 172.16.100.18       | None             | None | ... |
   | f5a9ed48-2e9f-411c-8787-2b6ecd640090 | 172.16.100.2        | None             | None | ... |
   +--------------------------------------+---------------------+------------------+------+-----+

.. code-block:: console

   $ openstack floating ip set --qos-policy bw-limiter d0ed7491-3eb7-4c4f-a0f0-df04f10a067c

In order to detach a floating IP from the QoS policy, simply update the
floating IP configuration.

.. code-block:: console

   $ openstack floating ip set --no-qos-policy d0ed7491-3eb7-4c4f-a0f0-df04f10a067c

Or use the ``unset`` action.

.. code-block:: console

   $ openstack floating ip unset --qos-policy d0ed7491-3eb7-4c4f-a0f0-df04f10a067c

Floating IPs can be created with a policy attached to them too.

.. code-block:: console

   $ openstack floating ip create --qos-policy bw-limiter public
   +---------------------+--------------------------------------+
   | Field               | Value                                |
   +---------------------+--------------------------------------+
   | created_at          | 2017-12-06T02:12:09Z                 |
   | description         |                                      |
   | fixed_ip_address    | None                                 |
   | floating_ip_address | 172.16.100.12                        |
   | floating_network_id | 4065eb05-cccb-4048-988c-e8c5480a746f |
   | id                  | 6a0efeef-462b-4312-b4ad-627cde8a20e6 |
   | name                | 172.16.100.12                        |
   | port_id             | None                                 |
   | project_id          | 916e39e8be52433ba040da3a3a6d0847     |
   | qos_policy_id       | 5df855e9-a833-49a3-9c82-c0839a5f103f |
   | revision_number     | 1                                    |
   | router_id           | None                                 |
   | status              | DOWN                                 |
   | updated_at          | 2017-12-06T02:12:09Z                 |
   +---------------------+--------------------------------------+

The QoS bandwidth limit rules attached to a floating IP will become
active when you associate the latter with a port. For example, to associate
the previously created floating IP ``172.16.100.12`` to the instance port with
uuid ``a7f25e73-4288-4a16-93b9-b71e6fd00862`` and fixed IP ``192.168.222.5``:

.. code-block:: console

   $ openstack floating ip set --port a7f25e73-4288-4a16-93b9-b71e6fd00862 \
       0eeb1f8a-de96-4cd9-a0f6-3f535c409558

.. note::

   The QoS policy attached to a floating IP is not applied to a port,
   it is applied to an associated floating IP only.
   Thus the ID of QoS policy attached to a floating IP will not be visible
   in a port's ``qos_policy_id`` field after asscoating a floating IP to
   the port. It is only visible in the floating IP attributes.

.. note::

   For now, the L3 agent floating IP QoS extension only supports
   ``bandwidth_limit`` rules. Other rule types (like DSCP marking) will be
   silently ignored for floating IPs. A QoS policy that does not contain any
   ``bandwidth_limit`` rules will have no effect when attached to a
   floating IP.

   If floating IP is bound to a port, and both have binding QoS bandwidth
   rules, the L3 agent floating IP QoS extension ignores the behavior of
   the port QoS, and installs the rules from the QoS policy associated to the
   floating IP on the appropriate device in the router namespace.

Each project can have at most one default QoS policy, although it is not
mandatory. If a default QoS policy is defined, all new networks created within
this project will have this policy assigned, as long as no other QoS policy is
explicitly attached during the creation process. If the default QoS policy is
unset, no change to existing networks will be made.

In order to set a QoS policy as default, the parameter ``--default`` must be
used. To unset this QoS policy as default, the parameter ``--no-default`` must
be used.

.. code-block:: console

    $ openstack network qos policy create --default bw-limiter
    +-------------------+--------------------------------------+
    | Field             | Value                                |
    +-------------------+--------------------------------------+
    | description       |                                      |
    | id                | 5df855e9-a833-49a3-9c82-c0839a5f103f |
    | is_default        | True                                 |
    | name              | bw-limiter                           |
    | project_id        | 4db7c1ed114a4a7fb0f077148155c500     |
    | rules             | []                                   |
    | shared            | False                                |
    +-------------------+--------------------------------------+

    $ openstack network qos policy set --no-default bw-limiter
    +-------------------+--------------------------------------+
    | Field             | Value                                |
    +-------------------+--------------------------------------+
    | description       |                                      |
    | id                | 5df855e9-a833-49a3-9c82-c0839a5f103f |
    | is_default        | False                                |
    | name              | bw-limiter                           |
    | project_id        | 4db7c1ed114a4a7fb0f077148155c500     |
    | rules             | []                                   |
    | shared            | False                                |
    +-------------------+--------------------------------------+

Create qos policy with packet rate limit rules:

.. code-block:: console

    $ openstack network qos policy create pps-limiter
    +-------------+--------------------------------------+
    | Field       | Value                                |
    +-------------+--------------------------------------+
    | description |                                      |
    | id          | 97f0ac37-7dd6-4579-8359-3bef0751a505 |
    | is_default  | False                                |
    | name        | pps-limiter                          |
    | project_id  | 1d70739f831b421fb38a27adb368fc17     |
    | rules       | []                                   |
    | shared      | False                                |
    | tags        | []                                   |
    +-------------+--------------------------------------+

    $ openstack network qos rule create --max-kpps 1000 --max-burst-kpps 100 --ingress --type packet-rate-limit pps-limiter
    +----------------+--------------------------------------+
    | Field          | Value                                |
    +----------------+--------------------------------------+
    | direction      | ingress                              |
    | id             | 4a1cb166-9661-48d7-bddb-00b7d75846cd |
    | max_burst_kpps | 100                                  |
    | max_kpps       | 1000                                 |
    | name           | None                                 |
    | project_id     |                                      |
    +----------------+--------------------------------------+

    $ openstack network qos rule create --max-kpps 1000 --max-burst-kpps 100 --egress --type packet-rate-limit pps-limiter
    +----------------+--------------------------------------+
    | Field          | Value                                |
    +----------------+--------------------------------------+
    | direction      | egress                               |
    | id             | 6abd67f7-0bde-4ad3-ac54-b0a6103b0449 |
    | max_burst_kpps | 100                                  |
    | max_kpps       | 1000                                 |
    | name           | None                                 |
    | project_id     |                                      |
    +----------------+--------------------------------------+

.. note:: The unit for the rate and burst is kilo (1000) packets per second.

Now apply the packet rate limit QoS policy to a Port:

.. code-block:: console

    $ openstack port set --qos-policy pps-limiter 251948bd-08e4-4569-a47f-ecbc1fd4af4d

.. note:: Packet rate limit is only supported by the ml2 ovs driver. And it leverages
          the meter actions of the ovs kernel datapath or the userspace ovs dpdk datapath.
          The meter action is only supported when the datapath is in user mode
          or ovs kernel datapath with kernerl version >= 4.15.

Administrator enforcement
-------------------------

Administrators are able to enforce policies on project ports or networks.
As long as the policy is not shared, the project is not be able to detach
any policy attached to a network or port.

If the policy is shared, the project is able to attach or detach such
policy from its own ports and networks.


Rule modification
-----------------
You can modify rules at runtime. Rule modifications will be propagated to any
attached port.

.. code-block:: console

    $ openstack network qos rule set --max-kbps 2000 --max-burst-kbits 1600 \
        --ingress bw-limiter 92ceb52f-170f-49d0-9528-976e2fee2d6f

    $ openstack network qos rule show \
        bw-limiter 92ceb52f-170f-49d0-9528-976e2fee2d6f
    +----------------+--------------------------------------+
    | Field          | Value                                |
    +----------------+--------------------------------------+
    | direction      | ingress                              |
    | id             | 92ceb52f-170f-49d0-9528-976e2fee2d6f |
    | max_burst_kbps | 1600                                 |
    | max_kbps       | 2000                                 |
    | name           | None                                 |
    | project_id     |                                      |
    +----------------+--------------------------------------+

Just like with bandwidth limiting, create a policy for DSCP marking rule:

.. code-block:: console

    $ openstack network qos policy create dscp-marking
    +-------------------+--------------------------------------+
    | Field             | Value                                |
    +-------------------+--------------------------------------+
    | description       |                                      |
    | id                | d1f90c76-fbe8-4d6f-bb87-a9aea997ed1e |
    | is_default        | False                                |
    | name              | dscp-marking                         |
    | project_id        | 4db7c1ed114a4a7fb0f077148155c500     |
    | rules             | []                                   |
    | shared            | False                                |
    +-------------------+--------------------------------------+

You can create, update, list, delete, and show DSCP markings
with the neutron client:

.. code-block:: console

    $ openstack network qos rule create --type dscp-marking --dscp-mark 26 \
        dscp-marking
    +----------------+--------------------------------------+
    | Field          | Value                                |
    +----------------+--------------------------------------+
    | dscp_mark      | 26                                   |
    | id             | 115e4f70-8034-4176-8fe9-2c47f8878a7d |
    | name           | None                                 |
    | project_id     |                                      |
    +----------------+--------------------------------------+

.. code-block:: console

    $ openstack network qos rule set --dscp-mark 22 \
        dscp-marking 115e4f70-8034-4176-8fe9-2c47f8878a7d

    $ openstack network qos rule list dscp-marking
    +--------------------------------------+----------------------------------+
    | ID                                   | DSCP Mark                        |
    +--------------------------------------+----------------------------------+
    | 115e4f70-8034-4176-8fe9-2c47f8878a7d | 22                               |
    +--------------------------------------+----------------------------------+

    $ openstack network qos rule show \
        dscp-marking 115e4f70-8034-4176-8fe9-2c47f8878a7d
    +----------------+--------------------------------------+
    | Field          | Value                                |
    +----------------+--------------------------------------+
    | dscp_mark      | 22                                   |
    | id             | 115e4f70-8034-4176-8fe9-2c47f8878a7d |
    | name           | None                                 |
    | project_id     |                                      |
    +----------------+--------------------------------------+

    $ openstack network qos rule delete \
        dscp-marking 115e4f70-8034-4176-8fe9-2c47f8878a7d

You can also include minimum bandwidth rules in your policy:

.. code-block:: console

    $ openstack network qos policy create bandwidth-control
    +-------------------+--------------------------------------+
    | Field             | Value                                |
    +-------------------+--------------------------------------+
    | description       |                                      |
    | id                | 8491547e-add1-4c6c-a50e-42121237256c |
    | is_default        | False                                |
    | name              | bandwidth-control                    |
    | project_id        | 7cc5a84e415d48e69d2b06aa67b317d8     |
    | revision_number   | 1                                    |
    | rules             | []                                   |
    | shared            | False                                |
    +-------------------+--------------------------------------+

    $ openstack network qos rule create \
      --type minimum-bandwidth --min-kbps 1000 --egress bandwidth-control
    +------------+--------------------------------------+
    | Field      | Value                                |
    +------------+--------------------------------------+
    | direction  | egress                               |
    | id         | da858b32-44bc-43c9-b92b-cf6e2fa836ab |
    | min_kbps   | 1000                                 |
    | name       | None                                 |
    | project_id |                                      |
    +------------+--------------------------------------+

A policy with a minimum bandwidth ensures best efforts are made to provide
no less than the specified bandwidth to each port on which the rule is
applied. However, as this feature is not yet integrated with the Compute
scheduler, minimum bandwidth cannot be guaranteed.

It is also possible to combine several rules in one policy, as long as the type
or direction of each rule is different. For example, You can specify two
``bandwidth-limit`` rules, one with ``egress`` and one with ``ingress``
direction.

.. code-block:: console

    $ openstack network qos rule create --type bandwidth-limit \
        --max-kbps 50000 --max-burst-kbits 50000 --egress bandwidth-control
    +----------------+--------------------------------------+
    | Field          | Value                                |
    +----------------+--------------------------------------+
    | direction      | egress                               |
    | id             | 0db48906-a762-4d32-8694-3f65214c34a6 |
    | max_burst_kbps | 50000                                |
    | max_kbps       | 50000                                |
    | name           | None                                 |
    | project_id     |                                      |
    +----------------+--------------------------------------+

    $ openstack network qos rule create --type bandwidth-limit \
        --max-kbps 10000 --max-burst-kbits 10000 --ingress bandwidth-control
    +----------------+--------------------------------------+
    | Field          | Value                                |
    +----------------+--------------------------------------+
    | direction      | ingress                              |
    | id             | faabef24-e23a-4fdf-8e92-f8cb66998834 |
    | max_burst_kbps | 10000                                |
    | max_kbps       | 10000                                |
    | name           | None                                 |
    | project_id     |                                      |
    +----------------+--------------------------------------+

    $ openstack network qos rule create --type minimum-bandwidth \
        --min-kbps 1000 --egress bandwidth-control
    +------------+--------------------------------------+
    | Field      | Value                                |
    +------------+--------------------------------------+
    | direction  | egress                               |
    | id         | da858b32-44bc-43c9-b92b-cf6e2fa836ab |
    | min_kbps   | 1000                                 |
    | name       | None                                 |
    | project_id |                                      |
    +------------+--------------------------------------+

    $ openstack network qos policy show bandwidth-control
    +-------------------+-------------------------------------------------------------------+
    | Field             | Value                                                             |
    +-------------------+-------------------------------------------------------------------+
    | description       |                                                                   |
    | id                | 8491547e-add1-4c6c-a50e-42121237256c                              |
    | is_default        | False                                                             |
    | name              | bandwidth-control                                                 |
    | project_id        | 7cc5a84e415d48e69d2b06aa67b317d8                                  |
    | revision_number   | 4                                                                 |
    | rules             | [{u'max_kbps': 50000, u'direction': u'egress',                    |
    |                   |   u'type': u'bandwidth_limit',                                    |
    |                   |   u'id': u'0db48906-a762-4d32-8694-3f65214c34a6',                 |
    |                   |   u'max_burst_kbps': 50000,                                       |
    |                   |   u'qos_policy_id': u'8491547e-add1-4c6c-a50e-42121237256c'},     |
    |                   | [{u'max_kbps': 10000, u'direction': u'ingress',                   |
    |                   |   u'type': u'bandwidth_limit',                                    |
    |                   |   u'id': u'faabef24-e23a-4fdf-8e92-f8cb66998834',                 |
    |                   |   u'max_burst_kbps': 10000,                                       |
    |                   |   u'qos_policy_id': u'8491547e-add1-4c6c-a50e-42121237256c'},     |
    |                   |  {u'direction':                                                   |
    |                   |   u'egress', u'min_kbps': 1000, u'type': u'minimum_bandwidth',    |
    |                   |   u'id': u'da858b32-44bc-43c9-b92b-cf6e2fa836ab',                 |
    |                   |   u'qos_policy_id': u'8491547e-add1-4c6c-a50e-42121237256c'}]     |
    | shared            | False                                                             |
    +-------------------+-------------------------------------------------------------------+