Merge "Remove unused phys_net parameter form EmbSwitch class"

This commit is contained in:
Jenkins 2017-04-04 22:23:31 +00:00 committed by Gerrit Code Review
commit d64458d81d
2 changed files with 5 additions and 8 deletions

View File

@ -115,14 +115,12 @@ class EmbSwitch(object):
@ivar pci_dev_wrapper: pci device wrapper
"""
def __init__(self, phys_net, dev_name, exclude_devices):
def __init__(self, dev_name, exclude_devices):
"""Constructor
@param phys_net: physical network
@param dev_name: network device name
@param exclude_devices: list of pci slots to exclude
"""
self.phys_net = phys_net
self.dev_name = dev_name
self.pci_slot_map = {}
self.pci_dev_wrapper = pci_lib.PciDeviceIPWrapper(dev_name)
@ -397,7 +395,7 @@ class ESwitchManager(object):
exclude_devices)
def _create_emb_switch(self, phys_net, dev_name, exclude_devices):
embedded_switch = EmbSwitch(phys_net, dev_name, exclude_devices)
embedded_switch = EmbSwitch(dev_name, exclude_devices)
self.emb_switches_map.setdefault(phys_net, []).append(embedded_switch)
for pci_slot in embedded_switch.get_pci_slot_list():
self.pci_slot_map[pci_slot] = embedded_switch

View File

@ -392,14 +392,13 @@ class TestEmbSwitch(base.BaseTestCase):
with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
"eswitch_manager.PciOsWrapper.scan_vf_devices",
return_value=self.SCANNED_DEVICES):
self.emb_switch = esm.EmbSwitch(self.PHYS_NET, self.DEV_NAME,
exclude_devices)
self.emb_switch = esm.EmbSwitch(self.DEV_NAME, exclude_devices)
@mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent."
"eswitch_manager.PciOsWrapper.scan_vf_devices",
return_value=[(PCI_SLOT, 0)])
def test_get_assigned_devices_info(self, *args):
emb_switch = esm.EmbSwitch(self.PHYS_NET, self.DEV_NAME, ())
emb_switch = esm.EmbSwitch(self.DEV_NAME, ())
with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent.pci_lib."
"PciDeviceIPWrapper.get_assigned_macs",
return_value={0: self.ASSIGNED_MAC}),\
@ -417,7 +416,7 @@ class TestEmbSwitch(base.BaseTestCase):
"eswitch_manager.PciOsWrapper.scan_vf_devices",
return_value=SCANNED_DEVICES)
def test_get_assigned_devices_info_multiple_slots(self, *args):
emb_switch = esm.EmbSwitch(self.PHYS_NET, self.DEV_NAME, ())
emb_switch = esm.EmbSwitch(self.DEV_NAME, ())
with mock.patch("neutron.plugins.ml2.drivers.mech_sriov.agent.pci_lib."
"PciDeviceIPWrapper.get_assigned_macs",
return_value=self.VF_TO_MAC_MAPPING),\