neutron/neutron/tests
Rodolfo Alonso Hernandez cdff281f64 [SR-IOV] Fix QoS extension to set min/max values
"ip link" commands allow to define VF rates independently.
That means, first "rate" (max BW) can be set and in a second
command "min" (min BW) (check LP bug description).

However Pyroute2 command to set the VF rates requires to set both.
If one value is missing ("min_tx_rate", "max_tx_rate"), the library
sets this value to 0; in other words, the value is deleted.

The Pyroute2 structures are built depending on the parameter names.
In this case, {'vf': {'rate': ...}} will create a "vf_rate" [1]
nla structure, that requires "min_tx_rate" and "max_tx_rate".
This is part of the full structure passed to the "iproute" library
[2].

This is an example of code that only sets the "max_tx_rate" for
the 15th VF of "enp196s0f0":
  $ from neutron.plugins.ml2.drivers.mech_sriov.agent import pci_lib
    pci = pci_lib.PciDeviceIPWrapper("enp196s0f0")
    pci.set_vf_rate(15, {'max_tx_rate': 10})

The "msg" [3] (structure passed to "iproute" library) is this:
https://paste.opendev.org/show/b2FZBOebGOCHMrYhPr6X/. The
"min_tx_rate" is set to the default value 0.

This patch reads first the existing rates ("min_tx_rate",
"max_tx_rate") and populates the command parameters accordingly.

[1]a9564dff8e/pyroute2.core/pr2modules/netlink/rtnl/ifinfmsg/__init__.py (L712-L717)
[2]c8d9d92544/ip/ipaddress.c (L454-L470)
[3]a9564dff8e/pyroute2.core/pr2modules/iproute/linux.py (L1499)

Closes-Bug: #1962844
Change-Id: Ibbb6d938355440c42850812e368224b76b1fce19
2022-03-04 11:43:08 +00:00
..
common Make sure "dead vlan" ports cannot transmit packets 2022-02-04 16:43:03 +03:00
contrib Add "quota-check-limit" extension to OVN extension list 2021-11-26 09:50:26 +00:00
etc Convert policy.json into policy-in-code 2018-12-13 20:37:53 +00:00
fullstack Revert "[Fullstack] Mark security groups test as unstable" 2022-02-24 10:51:57 +05:30
functional Merge "Refactor session "is_active" handling for sqlalchemy-20" 2022-02-24 17:41:24 +00:00
unit [SR-IOV] Fix QoS extension to set min/max values 2022-03-04 11:43:08 +00:00
var
__init__.py
base.py Revert "Cache default security group IDs in memory" 2021-04-12 15:24:42 +00:00
post_mortem_debug.py
tools.py Add API extension for QoS minimum pps rule 2021-09-29 12:27:30 +02:00