From 6044afb2cead4d54c19cb6052c90afd56c28e0d0 Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Tue, 3 Aug 2021 13:28:40 -0400 Subject: [PATCH] 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 --- src/pybind/mgr/cephadm/module.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index c7764d6a373be..2aeaedded1f68 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -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(), -- 2.47.3