Merge "Change set_device_rate calls according to new signature"
This commit is contained in:
commit
969a7217cc
@ -381,7 +381,7 @@ class ESwitchManager(object):
|
|||||||
embedded_switch = self._get_emb_eswitch(device_mac, pci_slot)
|
embedded_switch = self._get_emb_eswitch(device_mac, pci_slot)
|
||||||
if embedded_switch:
|
if embedded_switch:
|
||||||
embedded_switch.set_device_rate(
|
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):
|
def set_device_min_tx_rate(self, device_mac, pci_slot, min_kbps):
|
||||||
"""Set device min_tx_rate
|
"""Set device min_tx_rate
|
||||||
@ -394,7 +394,7 @@ class ESwitchManager(object):
|
|||||||
embedded_switch = self._get_emb_eswitch(device_mac, pci_slot)
|
embedded_switch = self._get_emb_eswitch(device_mac, pci_slot)
|
||||||
if embedded_switch:
|
if embedded_switch:
|
||||||
embedded_switch.set_device_rate(
|
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,
|
def set_device_state(self, device_mac, pci_slot, admin_state_up,
|
||||||
propagate_uplink_state):
|
propagate_uplink_state):
|
||||||
@ -540,7 +540,7 @@ class ESwitchManager(object):
|
|||||||
# NOTE(Moshe Levi): check the pci_slot is not assigned to some
|
# NOTE(Moshe Levi): check the pci_slot is not assigned to some
|
||||||
# other port before resetting the rate.
|
# other port before resetting the rate.
|
||||||
if embedded_switch.get_pci_device(pci_slot) is None:
|
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:
|
else:
|
||||||
LOG.warning("VF with PCI slot %(pci_slot)s is already "
|
LOG.warning("VF with PCI slot %(pci_slot)s is already "
|
||||||
"assigned; skipping reset for '%(rate_type)s' "
|
"assigned; skipping reset for '%(rate_type)s' "
|
||||||
|
@ -215,7 +215,7 @@ class TestESwitchManagerApi(base.BaseTestCase):
|
|||||||
self.PCI_SLOT, 1000)
|
self.PCI_SLOT, 1000)
|
||||||
get_pci_mock.assert_called_once_with(self.PCI_SLOT)
|
get_pci_mock.assert_called_once_with(self.PCI_SLOT)
|
||||||
set_device_rate_mock.assert_called_once_with(
|
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):
|
def test_set_device_min_tx_rate(self):
|
||||||
with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
|
with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
|
||||||
@ -228,7 +228,7 @@ class TestESwitchManagerApi(base.BaseTestCase):
|
|||||||
self.PCI_SLOT, 1000)
|
self.PCI_SLOT, 1000)
|
||||||
get_pci_mock.assert_called_once_with(self.PCI_SLOT)
|
get_pci_mock.assert_called_once_with(self.PCI_SLOT)
|
||||||
set_device_rate_mock.assert_called_once_with(
|
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):
|
def test_set_device_status_mismatch(self):
|
||||||
with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
|
with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
|
||||||
@ -335,7 +335,8 @@ class TestESwitchManagerApi(base.BaseTestCase):
|
|||||||
return_value=True):
|
return_value=True):
|
||||||
self.eswitch_mgr._clear_rate(pci_slot, rate_type)
|
self.eswitch_mgr._clear_rate(pci_slot, rate_type)
|
||||||
if passed:
|
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:
|
else:
|
||||||
self.assertFalse(set_rate_mock.called)
|
self.assertFalse(set_rate_mock.called)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user