]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
SR-IOV: fixed singletion behavior for ESwitchManager
authorMoshe Levi <moshele@mellanox.com>
Mon, 10 Aug 2015 07:06:00 +0000 (10:06 +0300)
committerIhar Hrachyshka <ihrachys@redhat.com>
Mon, 10 Aug 2015 07:42:41 +0000 (07:42 +0000)
__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

neutron/plugins/ml2/drivers/mech_sriov/agent/eswitch_manager.py

index ada37b2de3b1d655fc656395ce318cc37bb427c4..0bfb0e0f8bbfba4c8e6bea1da11022169f179040 100644 (file)
@@ -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.