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

This commit is contained in:
Zuul 2019-04-03 01:20:43 +00:00 committed by Gerrit Code Review
commit e7b87bf825
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