making inspector object singleton again by assigning to the base pollster class

Change-Id: I1afc02d595273f7b699afac9c12fcb17a777b4a8
Closes-Bug: #1819562
This commit is contained in:
Supreeth Shivanand 2019-03-12 14:06:44 -07:00
parent 062e02c612
commit ab73c911dd
1 changed files with 5 additions and 5 deletions

View File

@ -47,21 +47,21 @@ class GenericComputePollster(plugin_base.PollsterBase):
def setup_environment(self):
super(GenericComputePollster, self).setup_environment()
self.inspector = self._get_inspector(self.conf)
self.inspector = GenericComputePollster._get_inspector(self.conf)
@staticmethod
def aggregate_method(stats):
# Don't aggregate anything by default
return stats
@classmethod
def _get_inspector(cls, conf):
@staticmethod
def _get_inspector(conf):
# FIXME(sileht): This doesn't looks threadsafe...
try:
inspector = cls._inspector
inspector = GenericComputePollster._inspector
except AttributeError:
inspector = virt_inspector.get_hypervisor_inspector(conf)
cls._inspector = inspector
GenericComputePollster._inspector = inspector
return inspector
@property