]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: fix prom reconfig loop when dashboard is disabled
authorSage Weil <sage@redhat.com>
Wed, 4 Mar 2020 20:21:10 +0000 (14:21 -0600)
committerSage Weil <sage@redhat.com>
Wed, 4 Mar 2020 20:25:31 +0000 (14:25 -0600)
We need to consider the mgrs a dep even if the prometheus module isn't
enabled, so that we are consistent with _calc_daemon_deps() and don't
reconfig prom in a loop.

Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/cephadm/module.py

index cf80d521ee34dd9c58506c707271cfcc252c91b9..9c0deaa97d6afe21388f6df5bf9178e85e1d1fac 100644 (file)
@@ -2397,6 +2397,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
         # scrape mgrs
         mgr_scrape_list = []
         mgr_map = self.get('mgr_map')
+        port = None
         t = mgr_map.get('services', {}).get('prometheus', None)
         if t:
             t = t.split('/')[2]
@@ -2404,16 +2405,20 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
             port = '9283'
             if ':' in t:
                 port = t.split(':')[1]
-            # get standbys too.  assume that they are all on the same port
-            # as the active.
-            for dd in self.cache.get_daemons_by_service('mgr'):
-                deps.append(dd.name())
-                if dd.daemon_id == self.get_mgr_id():
-                    continue
-                hi = self.inventory.get(dd.hostname, None)
-                if hi:
-                    addr = hi.get('addr', dd.hostname)
-                mgr_scrape_list.append(addr.split(':')[0] + ':' + port)
+        # scan all mgrs to generate deps and to get standbys too.
+        # assume that they are all on the same port as the active mgr.
+        for dd in self.cache.get_daemons_by_service('mgr'):
+            # we consider the mgr a dep even if the prometheus module is
+            # disabled in order to be consistent with _calc_daemon_deps().
+            deps.append(dd.name())
+            if not port:
+                continue
+            if dd.daemon_id == self.get_mgr_id():
+                continue
+            hi = self.inventory.get(dd.hostname, None)
+            if hi:
+                addr = hi.get('addr', dd.hostname)
+            mgr_scrape_list.append(addr.split(':')[0] + ':' + port)
 
         # scrape node exporters
         node_configs = ''