From: Moshe Levi Date: Mon, 10 Aug 2015 07:06:00 +0000 (+0300) Subject: SR-IOV: fixed singletion behavior for ESwitchManager X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=09dd8848d3ae309ddfbe9fa7cd1f9abf4442ec7d;p=openstack-build%2Fneutron-build.git SR-IOV: fixed singletion behavior for ESwitchManager __init__ is called for any __call__ on a class, no matter whether it is a singleton. Meaning, client was reinitialized every time a caller instantiated the ESwitchManager which break the SR-IOV agent when working with agent qos extension. Partially-Implements: blueprint ml2-sriov-qos-with-bwlimiting Change-Id: I31f59e1ee3bbd6bdb039cd149d7a335c692d538d --- 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 ada37b2de..0bfb0e0f8 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py @@ -207,17 +207,10 @@ class ESwitchManager(object): # make it a singleton if not hasattr(cls, '_instance'): cls._instance = super(ESwitchManager, cls).__new__(cls) + cls.emb_switches_map = {} + cls.pci_slot_map = {} return cls._instance - def __init__(self): - """Constructor. - - Create Embedded Switch logical entities for all given device mappings, - using exclude devices. - """ - self.emb_switches_map = {} - self.pci_slot_map = {} - def device_exists(self, device_mac, pci_slot): """Verify if device exists.