diff --git a/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py index 5a54f680c57..dd4c76b436c 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py @@ -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' " diff --git a/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_eswitch_manager.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_eswitch_manager.py index a0280b7cd12..e326efd1a64 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_eswitch_manager.py +++ b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_eswitch_manager.py @@ -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)