]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: config_notify now provides a hook
authorSebastian Wagner <sebastian.wagner@suse.com>
Wed, 17 Jun 2020 12:37:58 +0000 (14:37 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Tue, 14 Jul 2020 09:39:06 +0000 (11:39 +0200)
reason is, we want to use this hook to schedule a
ceph.conf update for all hosts.

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
(cherry picked from commit 1cd4d0f32380e7ad0fbaf365df5f45a343fcb458)

src/pybind/mgr/cephadm/module.py

index 83f6814c8918120581fc51e6e6100231d8ab036c..21442bc2c75764bb34912d9318ed6778f583ba0c 100644 (file)
@@ -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