]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: add `set_health_warning` and `remove_health_warning` helpers in module.py
authorMelissa Li <li.melissa.kun@gmail.com>
Tue, 3 Aug 2021 17:28:40 +0000 (13:28 -0400)
committerSebastian Wagner <sewagner@redhat.com>
Tue, 2 Nov 2021 09:01:20 +0000 (10:01 +0100)
Fixes: https://tracker.ceph.com/issues/44414
Signed-off-by: Melissa Li <li.melissa.kun@gmail.com>
(cherry picked from commit 6044afb2cead4d54c19cb6052c90afd56c28e0d0)

src/pybind/mgr/cephadm/module.py

index 6295c029e2d8dc7e60c389c7e56aa4343c9668eb..2a215ac548a103f589e760e87b46572abf25cd8f 100644 (file)
@@ -2374,6 +2374,20 @@ Then run the following:
 
         return self._apply_service_spec(cast(ServiceSpec, spec))
 
+    def set_health_warning(self, name: str, summary: str, count: int, detail: List[str]) -> None:
+        self.health_checks[name] = {
+            'severity': 'warning',
+            'summary': summary,
+            'count': count,
+            'detail': detail,
+        }
+        self.set_health_checks(self.health_checks)
+
+    def remove_health_warning(self, name: str) -> None:
+        if name in self.health_checks:
+            del self.health_checks[name]
+            self.set_health_checks(self.health_checks)
+
     def _plan(self, spec: ServiceSpec) -> dict:
         if spec.service_type == 'osd':
             return {'service_name': spec.service_name(),