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 201c3c3..56f0d32 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import itertools import os import re @@ -270,9 +271,11 @@ class ESwitchManager(object): embedded_switch = self.emb_switches_map.get(phys_net, None) if not embedded_switch: return set() - eswitch_objects = [embedded_switch] + eswitch_objects = embedded_switch else: - eswitch_objects = self.emb_switches_map.values() + eswitch_objects = set( + itertools.chain.from_iterable( + six.itervalues(self.emb_switches_map))) assigned_devices = set() for embedded_switch in eswitch_objects: for device in embedded_switch.get_assigned_devices_info(): @@ -347,7 +350,7 @@ class ESwitchManager(object): def _create_emb_switch(self, phys_net, dev_name, exclude_devices): embedded_switch = EmbSwitch(phys_net, dev_name, exclude_devices) - self.emb_switches_map[phys_net] = embedded_switch + 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