]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/devicehealth: make CLI commands error when pool doesn't exist
authorSage Weil <sage@newdream.net>
Fri, 29 Jan 2021 16:40:44 +0000 (10:40 -0600)
committerSage Weil <sage@newdream.net>
Fri, 29 Jan 2021 16:40:44 +0000 (10:40 -0600)
This is better than silently failing to do anything.

Signed-off-by: Sage Weil <sage@newdream.net>
src/pybind/mgr/devicehealth/module.py

index 36cb182f4f1941efba977856e43e5763a0280deb..c1c04896c01d3fac5f906d611c9ff7c7eeb325d0 100644 (file)
@@ -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: