Change set_device_rate calls according to new signature
[1] changed the signature of set_device_rate to be alligned with how
pyroute2 expects rate parameters, some method which calls
set_device_rate needs to be changed also to use the new dict format for
calling it.
[1]: https://review.opendev.org/q/Ibbb6d938355440c42850812e368224b76b1fce19
Related-Bug: #1962844
Closes-Bug: #1968206
Change-Id: I7256747f45308b011edbb0f8c802439ea277423d
(cherry picked from commit 837fda7566
)
This commit is contained in:
parent
610b66581c
commit
13bb2554da
|
@ -379,7 +379,7 @@ class ESwitchManager(object):
|
|||
embedded_switch = self._get_emb_eswitch(device_mac, pci_slot)
|
||||
if embedded_switch:
|
||||
embedded_switch.set_device_rate(
|
||||
pci_slot, IP_LINK_CAPABILITY_RATE, max_kbps)
|
||||
pci_slot, {IP_LINK_CAPABILITY_RATE: max_kbps})
|
||||
|
||||
def set_device_min_tx_rate(self, device_mac, pci_slot, min_kbps):
|
||||
"""Set device min_tx_rate
|
||||
|
@ -392,7 +392,7 @@ class ESwitchManager(object):
|
|||
embedded_switch = self._get_emb_eswitch(device_mac, pci_slot)
|
||||
if embedded_switch:
|
||||
embedded_switch.set_device_rate(
|
||||
pci_slot, IP_LINK_CAPABILITY_MIN_TX_RATE, min_kbps)
|
||||
pci_slot, {IP_LINK_CAPABILITY_MIN_TX_RATE: min_kbps})
|
||||
|
||||
def set_device_state(self, device_mac, pci_slot, admin_state_up,
|
||||
propagate_uplink_state):
|
||||
|
@ -538,7 +538,7 @@ class ESwitchManager(object):
|
|||
# NOTE(Moshe Levi): check the pci_slot is not assigned to some
|
||||
# other port before resetting the rate.
|
||||
if embedded_switch.get_pci_device(pci_slot) is None:
|
||||
embedded_switch.set_device_rate(pci_slot, rate_type, 0)
|
||||
embedded_switch.set_device_rate(pci_slot, {rate_type: 0})
|
||||
else:
|
||||
LOG.warning("VF with PCI slot %(pci_slot)s is already "
|
||||
"assigned; skipping reset for '%(rate_type)s' "
|
||||
|
|
|
@ -216,7 +216,7 @@ class TestESwitchManagerApi(base.BaseTestCase):
|
|||
self.PCI_SLOT, 1000)
|
||||
get_pci_mock.assert_called_once_with(self.PCI_SLOT)
|
||||
set_device_rate_mock.assert_called_once_with(
|
||||
self.PCI_SLOT, self.MAX_RATE, 1000)
|
||||
self.PCI_SLOT, {self.MAX_RATE: 1000})
|
||||
|
||||
def test_set_device_min_tx_rate(self):
|
||||
with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
|
||||
|
@ -229,7 +229,7 @@ class TestESwitchManagerApi(base.BaseTestCase):
|
|||
self.PCI_SLOT, 1000)
|
||||
get_pci_mock.assert_called_once_with(self.PCI_SLOT)
|
||||
set_device_rate_mock.assert_called_once_with(
|
||||
self.PCI_SLOT, self.MIN_RATE, 1000)
|
||||
self.PCI_SLOT, {self.MIN_RATE: 1000})
|
||||
|
||||
def test_set_device_status_mismatch(self):
|
||||
with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
|
||||
|
@ -336,7 +336,8 @@ class TestESwitchManagerApi(base.BaseTestCase):
|
|||
return_value=True):
|
||||
self.eswitch_mgr._clear_rate(pci_slot, rate_type)
|
||||
if passed:
|
||||
set_rate_mock.assert_called_once_with(pci_slot, rate_type, 0)
|
||||
set_rate_mock.assert_called_once_with(pci_slot,
|
||||
{rate_type: 0})
|
||||
else:
|
||||
self.assertFalse(set_rate_mock.called)
|
||||
|
||||
|
|
Loading…
Reference in New Issue