cdff281f64
"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] |
||
---|---|---|
.. | ||
common | ||
ml2 | ||
__init__.py |