From: Kefu Chai Date: Wed, 27 Jan 2021 06:58:01 +0000 (+0800) Subject: mgr/devicehealth: return -1 if prediction plugin is not available X-Git-Tag: v16.2.0~152^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=72aa680aa650b874e7db838cf606ce24e0594be8;p=ceph.git mgr/devicehealth: return -1 if prediction plugin is not available Signed-off-by: Kefu Chai (cherry picked from commit bb611c64ee5120272215683b4b5ac4397f9c5ea6) --- diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py index 052ccaf79bdf..830003859c8e 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -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'