]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: fix host maintenance health check update
authorSage Weil <sage@newdream.net>
Tue, 19 Jan 2021 22:31:25 +0000 (16:31 -0600)
committerJuan Miguel Olmo Martínez <jolmomar@redhat.com>
Mon, 25 Jan 2021 16:59:17 +0000 (17:59 +0100)
We need to update the self.health_checks dict and use that or else we
will clobber any other exising checks.

Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit 315f58bee20154a7e83cb65f301dce4e22f9c9f6)

src/pybind/mgr/cephadm/module.py

index f788f5ee623d277d3983339ad3e7ad76e92f5b54..01f5dd48d74cc2333265d9afdf437aa0529e9699 100644 (file)
@@ -1286,18 +1286,15 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
 
         in_maintenance = self.inventory.get_host_with_state("maintenance")
         if not in_maintenance:
-            self.set_health_checks({
-                "HOST_IN_MAINTENANCE": {}
-            })
+            del self.health_checks["HOST_IN_MAINTENANCE"]
         else:
             s = "host is" if len(in_maintenance) == 1 else "hosts are"
-            self.set_health_checks({
-                "HOST_IN_MAINTENANCE": {
-                    "severity": "warning",
-                    "summary": f"{len(in_maintenance)} {s} in maintenance mode",
-                    "detail": [f"{h} is in maintenance" for h in in_maintenance],
-                }
-            })
+            self.health_checks["HOST_IN_MAINTENANCE"] = {
+                "severity": "warning",
+                "summary": f"{len(in_maintenance)} {s} in maintenance mode",
+                "detail": [f"{h} is in maintenance" for h in in_maintenance],
+            }
+        self.set_health_checks(self.health_checks)
 
     @trivial_completion
     @host_exists()