neutron/neutron
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
..
agent Merge "Don't set HA ports down while L3 agent restart." 2022-03-02 02:30:03 +00:00
api Pass host parameter to the get_network_info method 2022-02-01 08:28:15 +01:00
cmd [OVN] Sync QoS policies 2022-02-02 19:21:21 +00:00
common Merge "Refactor session "is_active" handling for sqlalchemy-20" 2022-02-24 17:41:24 +00:00
conf Merge "Add ndp proxy policy rules" 2022-02-23 03:18:12 +00:00
core_extensions Revert "Set system_scope='all' in elevated context" 2021-06-15 10:29:20 +02:00
db Add port IDs in "RouterInUse" exception during router deletion 2022-02-25 18:31:08 +00:00
debug Remove rootwrap execution (2) 2021-02-06 16:23:03 +00:00
exceptions Add port-resource-request-groups extension 2021-10-21 14:30:07 +02:00
extensions Add qos-pps-minimum-rule-alias API extension 2022-02-07 11:52:46 +01:00
hacking Follow up for replacing assertItemsEqual 2021-06-03 16:04:07 +00:00
ipam Using 31-Bit and 32-Bit prefixes for IPv4 reasonably 2021-06-09 07:35:54 +00:00
locale Imported Translations from Zanata 2020-10-11 07:22:44 +00:00
notifiers Use a thread local variable to store the Nova Notifier enable flag 2022-02-02 08:03:38 +00:00
objects [Server Side] L3 router support ndp proxy 2022-02-03 10:07:46 +08:00
pecan_wsgi Execute the quota reservation removal in an isolated DB txn 2021-09-30 13:53:23 +00:00
plugins [SR-IOV] Fix QoS extension to set min/max values 2022-03-04 11:43:08 +00:00
privileged [SR-IOV] Fix QoS extension to set min/max values 2022-03-04 11:43:08 +00:00
profiling Remove "six" library 2020-07-28 16:55:52 +00:00
quota Execute the quota reservation removal in an isolated DB txn 2021-09-30 13:53:23 +00:00
scheduler Do not fail if the agent load is not bumped 2021-08-25 13:06:28 +00:00
server Re-use existing ProcessLauncher from wsgi in RPC workers 2020-02-07 14:51:06 +01:00
services Merge "Add new class for Logging API methods" 2022-02-28 10:25:34 +00:00
tests [SR-IOV] Fix QoS extension to set min/max values 2022-03-04 11:43:08 +00:00
__init__.py Remove usage of six.PY2 2020-05-22 12:59:01 -04:00
_i18n.py
auth.py Add fake_project_id middleware for noauth 2021-07-05 21:18:09 +05:30
manager.py Remove usage of six.add_metaclass 2020-05-21 14:41:18 -04:00
neutron_plugin_base_v2.py Remove usage of six.add_metaclass 2020-05-21 14:41:18 -04:00
opts.py Add missing DHCP opts for genconfig 2022-01-14 16:35:43 +08:00
policy.py [Policy] Set scope_types for BaseCheck rules 2021-09-06 12:16:47 +02:00
service.py Re-use existing ProcessLauncher from wsgi in RPC workers 2020-02-07 14:51:06 +01:00
version.py
worker.py
wsgi.py Disable tracebacks of eventlet.wsgi.server 2022-01-11 09:33:12 +01:00