Merge "Change set_device_rate calls according to new signature"

This commit is contained in:
Zuul 2022-04-08 10:21:54 +00:00 committed by Gerrit Code Review
commit 969a7217cc
2 changed files with 7 additions and 6 deletions

View File

@ -381,7 +381,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
@ -394,7 +394,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):
@ -540,7 +540,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' "

View File

@ -215,7 +215,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."
@ -228,7 +228,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."
@ -335,7 +335,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)