]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/prometheus: Use mgr.release_name for always on modules
authorBoris Ranto <branto@redhat.com>
Wed, 25 Nov 2020 09:27:25 +0000 (10:27 +0100)
committerBoris Ranto <branto@redhat.com>
Mon, 30 Nov 2020 10:37:20 +0000 (11:37 +0100)
The host_version is not populated properly in the early stages of ceph
mgr start up process. We can use mgr.release_name instead. It is more
stable and it provides the data even if mgr_map does not contain the
versions, yet.

Signed-off-by: Boris Ranto <branto@redhat.com>
(cherry picked from commit aa0650092da3cbf1a73151999874001352cfb9ef)

src/pybind/mgr/prometheus/module.py

index 3f2bafd8138dfca62c294413693fd10264ef7403..e58a9b8df2b1ee020880939b0f8387d2ce7b2233 100644 (file)
@@ -524,12 +524,10 @@ class Module(MgrModule):
 
         all_modules = {module.get('name'):module.get('can_run') for module in mgr_map['available_modules']}
 
-        ceph_release = None
         for mgr in all_mgrs:
             host_version = servers.get((mgr, 'mgr'), ('', ''))
             if mgr == active:
                 _state = 1
-                ceph_release = host_version[1].split()[-2] # e.g. nautilus
             else:
                 _state = 0
 
@@ -540,7 +538,7 @@ class Module(MgrModule):
             self.metrics['mgr_status'].set(_state, (
                 'mgr.{}'.format(mgr),
             ))
-        always_on_modules = mgr_map['always_on_modules'].get(ceph_release, [])
+        always_on_modules = mgr_map['always_on_modules'].get(self.release_name, [])
         active_modules = list(always_on_modules)
         active_modules.extend(mgr_map['modules'])