From: Melissa Li Date: Tue, 3 Aug 2021 17:28:40 +0000 (-0400) Subject: mgr/cephadm: add `set_health_warning` and `remove_health_warning` helpers in module.py X-Git-Tag: v16.2.7~67^2~40 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0e636de4d61afa41b0aad338cf6b25dc46f990e2;p=ceph.git mgr/cephadm: add `set_health_warning` and `remove_health_warning` helpers in module.py Fixes: https://tracker.ceph.com/issues/44414 Signed-off-by: Melissa Li (cherry picked from commit 6044afb2cead4d54c19cb6052c90afd56c28e0d0) --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 6295c029e2d8..2a215ac548a1 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -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(),