]> git.apps.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)
committerSage Weil <sage@newdream.net>
Tue, 16 Mar 2021 12:56:17 +0000 (07:56 -0500)
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>
(cherry picked from commit f3cf41f98955a2c3b8c31374981e5ecbf5d4eda9)

src/pybind/mgr/cephadm/module.py

index 9a09887a0896b2bb39b80f7dca5a5eea47884205..119fd12943d7a56ebaf2d9e544689a47bafd5d4b 100644 (file)
@@ -1126,6 +1126,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")