From db31d09efa60fad98429b1ec7e0d30188f355035 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 29 Jan 2021 10:40:44 -0600 Subject: [PATCH] mgr/devicehealth: make CLI commands error when pool doesn't exist This is better than silently failing to do anything. Signed-off-by: Sage Weil --- src/pybind/mgr/devicehealth/module.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py index 36cb182f4f19..c1c04896c01d 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -330,7 +330,7 @@ class Module(MgrModule): def scrape_daemon(self, daemon_type: str, daemon_id: str) -> Tuple[int, str, str]: ioctx = self.open_connection() if not ioctx: - return 0, "", "" + return -errno.EAGAIN, "", "device_health_metrics pool not yet available" raw_smart_data = self.do_scrape_daemon(daemon_type, daemon_id) if raw_smart_data: for device, raw_data in raw_smart_data.items(): @@ -345,7 +345,7 @@ class Module(MgrModule): assert osdmap is not None ioctx = self.open_connection() if not ioctx: - return 0, "", "" + return -errno.EAGAIN, "", "device_health_metrics pool not yet available" did_device = {} ids = [] for osd in osdmap['osds']: @@ -379,7 +379,7 @@ class Module(MgrModule): (daemon_type, daemon_id) = daemons[0].split('.') ioctx = self.open_connection() if not ioctx: - return 0, "", "" + return -errno.EAGAIN, "", "device_health_metrics pool not yet available" raw_smart_data = self.do_scrape_daemon(daemon_type, daemon_id, devid=devid) if raw_smart_data: -- 2.47.3