From: Sage Weil Date: Fri, 29 Jan 2021 16:40:44 +0000 (-0600) Subject: mgr/devicehealth: make CLI commands error when pool doesn't exist X-Git-Tag: v16.2.0~162^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7dca1c1ff80d1dd6f30a2ee57ed2fe0a46f8a454;p=ceph.git 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 (cherry picked from commit db31d09efa60fad98429b1ec7e0d30188f355035) --- diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py index 4983a22404cd..5009820b6150 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -321,7 +321,7 @@ class Module(MgrModule): def scrape_daemon(self, daemon_type, daemon_id): 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(): @@ -336,7 +336,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']: @@ -370,7 +370,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: