* Will raise NOT_FOUND_SYSTEM if no controller found.
Signed-off-by: Gris Ge <fge(a)redhat.com>
---
plugin/megaraid/megaraid.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/plugin/megaraid/megaraid.py b/plugin/megaraid/megaraid.py
index 4039486..29c9ff8 100644
--- a/plugin/megaraid/megaraid.py
+++ b/plugin/megaraid/megaraid.py
@@ -324,8 +324,13 @@ def _storcli_exec(self, storcli_cmds, flag_json=True):
return output
def _ctrl_count(self):
- return self._storcli_exec(
+ ctrl_count = self._storcli_exec(
["show", "ctrlcount"]).get("Controller Count")
+ if ctrl_count < 1:
+ raise LsmError(
+ ErrorNumber.NOT_FOUND_SYSTEM,
+ "No MegaRAID controller detected by %s" % self._storcli_bin)
+ return ctrl_count
def _lsm_status_of_ctrl(self, ctrl_show_all_output):
lsi_status_info = ctrl_show_all_output['Status']
--
1.8.3.1