diff --git a/crmsh/crash_test/task.py b/crmsh/crash_test/task.py index 62c89c6f15..1c3e066c6c 100644 --- a/crmsh/crash_test/task.py +++ b/crmsh/crash_test/task.py @@ -108,6 +108,9 @@ def task_pre_check(self, need_fence=True): self.get_fence_info() if not self.fence_enabled: raise TaskError("Require stonith enabled") + if not self.fence_configured: + raise TaskError("Require stonith device configured and running") + def get_fence_info(self): """ @@ -115,6 +118,7 @@ def get_fence_info(self): """ fence_info_inst = utils.FenceInfo() self.fence_enabled = fence_info_inst.fence_enabled + self.fence_configured = fence_info_inst.fence_configured self.fence_action = fence_info_inst.fence_action self.fence_timeout = fence_info_inst.fence_timeout diff --git a/crmsh/crash_test/utils.py b/crmsh/crash_test/utils.py index 556d1dc6ed..d3ebb7f99a 100644 --- a/crmsh/crash_test/utils.py +++ b/crmsh/crash_test/utils.py @@ -110,6 +110,10 @@ def fence_enabled(self): return False return True + @property + def fence_configured(self): + return crmshutils.has_stonith_running() + @property def fence_action(self): action_result = crmshutils.get_property("stonith-action") diff --git a/crmsh/ui_node.py b/crmsh/ui_node.py index 658d86561d..3982af5281 100644 --- a/crmsh/ui_node.py +++ b/crmsh/ui_node.py @@ -484,6 +484,9 @@ def do_fence(self, context, node): 'usage: fence ' if not utils.is_name_sane(node): return False + if not utils.has_stonith_running(): + logger.error("fence command requires stonith device configured and running") + return False if not config.core.force and \ not utils.ask("Fencing %s will shut down the node and migrate any resources that are running on it! Do you want to fence %s?" % (node, node)): return False