]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm:Drop active healthcheck during a disable request
authorPaul Cuzner <pcuzner@redhat.com>
Fri, 19 Feb 2021 02:09:02 +0000 (15:09 +1300)
committerPaul Cuzner <pcuzner@redhat.com>
Mon, 1 Mar 2021 22:59:32 +0000 (11:59 +1300)
The healthcheck could already be active when the admin attempts
to disable it. This patch removes the related healthcheck if it's set
during a config-check disable request.

Signed-off-by: Paul Cuzner <pcuzner@redhat.com>
src/pybind/mgr/cephadm/module.py

index ed30a093f3f7300c4d5d0389a3f9b4f12752dff8..11c9301810914be49f9c5abd6340b4b10345043e 100644 (file)
@@ -1151,6 +1151,16 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
         err, msg = self._update_config_check(check_name, 'disabled')
         if err:
             return HandleCommandResult(retval=err, stderr=f"Failed to disable check '{check_name}': {msg}")
+        else:
+            # drop any outstanding raised healthcheck for this check
+            config_check = self.config_checker.lookup_check(check_name)
+            if config_check:
+                if config_check.healthcheck_name in self.health_checks:
+                    self.health_checks.pop(config_check.healthcheck_name, None)
+                    self.set_health_checks(self.health_checks)
+            else:
+                self.log.error(
+                    f"Unable to resolve a check name ({check_name}) to a healthcheck definition?")
 
         return HandleCommandResult(stdout="ok")