]> git-server-git.apps.pok.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)
committerDaniel Pivonka <dpivonka@redhat.com>
Thu, 30 Sep 2021 18:08:26 +0000 (14:08 -0400)
Fixes: https://tracker.ceph.com/issues/44414
Signed-off-by: Melissa Li <li.melissa.kun@gmail.com>
src/pybind/mgr/cephadm/module.py

index c7764d6a373be8ef738e28cdb18ae6e821b32a8a..2aeaedded1f6886c651eeb7f56db5221380adca3 100644 (file)
@@ -2271,6 +2271,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(),