Merge pull request #43864 from yaarith/fix-config-notify

mgr/telemetry: fix waiting for mgr to warm up

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Yuri Weinstein 2021-12-13 15:20:11 -08:00 committed by GitHub
commit 6adb612eff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,6 +141,7 @@ class Module(MgrModule):
self.last_report: Dict[str, Any] = dict()
self.report_id: Optional[str] = None
self.salt: Optional[str] = None
self.config_update_module_option()
# for mypy which does not run the code
if TYPE_CHECKING:
self.url = ''
@ -156,12 +157,15 @@ class Module(MgrModule):
self.channel_device = True
self.channel_perf = False
def config_notify(self) -> None:
def config_update_module_option(self) -> None:
for opt in self.MODULE_OPTIONS:
setattr(self,
opt['name'],
self.get_module_option(opt['name']))
self.log.debug(' %s = %s', opt['name'], getattr(self, opt['name']))
def config_notify(self) -> None:
self.config_update_module_option()
# wake up serve() thread
self.event.set()
@ -1111,11 +1115,10 @@ Device report is generated separately. To see it run 'ceph telemetry show-device
def serve(self) -> None:
self.load()
self.config_notify()
self.run = True
self.log.debug('Waiting for mgr to warm up')
self.event.wait(10)
time.sleep(10)
while self.run:
self.event.clear()