Ingress bw-limit with DPDK does not work
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Fix Released
|
Medium
|
Bence Romsics |
Bug Description
A colleague of mine working downstream found the following bug (his report follows with minor redactions of company-internal details). I'm going to push his proposed fix in a minute too.
In short, the inbound bandwidth limitation on vHost user ports doesn't seem to work. The value set with OpenStack QoS commands on the port isn't configured properly. The problem exists in OVS backend.
Creating a 1 Mbit/s limit rule:
openstack network qos rule create max_1_Mbps --type bandwidth-limit --max-kbps 1000 --max-burst-kbits 1000 --ingress
After applying to the port, you can query it on the compute:
compute-
_uuid : c326ed8b-
external_ids : {id=vhu84edf6c2-f0}
other_config : {cbs="125000.0", cir="125000.0"}
queues : {}
type : egress-policer
Note: the traffic is ingress from the VM point of view, and egress from OVS.
The values are not integers, they have a .0 at the end. In /var/log/
2021-07-
2021-07-
2021-07-
2021-07-
If you create a traffic between two VMs, the downloading one having the limitation applied on its port reports this:
root@bwtest2:~# nc 192.168.1.201 5555 | dd of=/dev/null status=progress
816316928 bytes (816 MB, 779 MiB) copied, 5 s, 163 MB/s^C
1863705+71 records in
1863738+0 records out
954233856 bytes (954 MB, 910 MiB) copied, 8.23046 s, 116 MB/s
The bandwidth is higher than the set 1 Mb/s.
It is possible to modify the OVS agent so it applies the bandwidth limit correctly. You have to find out where the Python scripts of the neutron_
/var/lib/
In the _update_
# cir and cbs should be set in bytes instead of bits
'cir': str(max_bw_in_bits / 8),
'cbs': str(max_
}
If you modify the code to this:
# cir and cbs should be set in bytes instead of bits
'cir': str(int(
'cbs': str(int(
}
the values passed to OVS will be integers. You can see the difference querying the new values after applying the limit on the ports again:
compute-
_uuid : b93b1165-
external_ids : {id=vhu84edf6c2-f0}
other_config : {cbs="125000", cir="125000"}
queues : {}
type : egress-policer
They don't have the .0 at the and anymore, and OVS doesn't complain in the logs about invalid arguments. The bandwidth limitation between the computes now works:
root@bwtest2:~# nc 192.168.1.201 5555 | dd of=/dev/null status=progress
4095488 bytes (4.1 MB, 3.9 MiB) copied, 33 s, 123 kB/s^C
7274+1382 records in
8051+0 records out
4122112 bytes (4.1 MB, 3.9 MiB) copied, 33.4033 s, 123 kB/s
125 kB/s translates to 1 Mb/s that we have applied with the rule, so it works now.
My guess is that this problem comes from the different behaviour between the division in Python2 and Python3:
user@debian:~$ python2
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 4/3
1
>>>
user@debian:~$ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 4/3
1.3333333333333333
>>>
Python3 doesn't round to integers, and OVS doesn't seem to accept floating point numbers.
I have seen this in multiple versions.
Changed in neutron: | |
importance: | Undecided → Medium |
Fix proposed to branch: master /review. opendev. org/c/openstack /neutron/ +/801310
Review: https:/