From bcbe7e00e51872963397e17e1e85f9930fa161a0 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Wed, 17 Jun 2020 14:37:58 +0200 Subject: [PATCH] mgr/cephadm: config_notify now provides a hook reason is, we want to use this hook to schedule a ceph.conf update for all hosts. Signed-off-by: Sebastian Wagner (cherry picked from commit 1cd4d0f32380e7ad0fbaf365df5f45a343fcb458) --- src/pybind/mgr/cephadm/module.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 83f6814c89181..21442bc2c7576 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -141,7 +141,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): instance = None NATIVE_OPTIONS = [] # type: List[Any] - MODULE_OPTIONS = [ + MODULE_OPTIONS: List[dict] = [ { 'name': 'ssh_config_file', 'type': 'str', @@ -499,21 +499,34 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): def config_notify(self): """ This method is called whenever one of our config options is changed. + + TODO: this method should be moved into mgr_module.py """ + module_options_changed: List[str] = [] for opt in self.MODULE_OPTIONS: + old_val = getattr(self, opt['name'], None) + new_val = self.get_module_option(opt['name']) setattr(self, opt['name'], # type: ignore - self.get_module_option(opt['name'])) # type: ignore + new_val) # type: ignore self.log.debug(' mgr option %s = %s', opt['name'], getattr(self, opt['name'])) # type: ignore + if old_val != new_val: + module_options_changed.append(opt['name']) for opt in self.NATIVE_OPTIONS: setattr(self, opt, # type: ignore self.get_ceph_option(opt)) self.log.debug(' native option %s = %s', opt, getattr(self, opt)) # type: ignore + for what in module_options_changed: + self.config_notify_one(what) + self.event.set() + def config_notify_one(self, what): + pass + def notify(self, notify_type, notify_id): pass -- 2.39.5