]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/devicehealth: return -1 if prediction plugin is not available
authorKefu Chai <kchai@redhat.com>
Wed, 27 Jan 2021 06:58:01 +0000 (14:58 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 3 Mar 2021 07:34:15 +0000 (15:34 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit bb611c64ee5120272215683b4b5ac4397f9c5ea6)

src/pybind/mgr/devicehealth/module.py

index 052ccaf79bdfdfdbf62187a83d399131c4677a54..830003859c8e8c32d8c73e1a4692bd69b0322134 100644 (file)
@@ -660,6 +660,8 @@ class Module(MgrModule):
             can_run, _ = self.remote(plugin_name, 'can_run')
             if can_run:
                 return self.remote(plugin_name, 'predict_life_expectancy', devid=devid)
+            else:
+                return -1, '', f'{plugin_name} is not available'
         except:
             return -1, '', 'unable to invoke diskprediction local or remote plugin'
 
@@ -674,6 +676,8 @@ class Module(MgrModule):
             can_run, _ = self.remote(plugin_name, 'can_run')
             if can_run:
                 return self.remote(plugin_name, 'predict_all_devices')
+            else:
+                return -1, '', f'{plugin_name} is not available'
         except:
             return -1, '', 'unable to invoke diskprediction local or remote plugin'