Skip to content

Dev: log an error when fencing node without stonith device configured and running #1425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crmsh/crash_test/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,17 @@
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")

Check warning on line 112 in crmsh/crash_test/task.py

View check run for this annotation

Codecov / codecov/patch

crmsh/crash_test/task.py#L111-L112

Added lines #L111 - L112 were not covered by tests


def get_fence_info(self):
"""
Get fence info
"""
fence_info_inst = utils.FenceInfo()
self.fence_enabled = fence_info_inst.fence_enabled
self.fence_configured = fence_info_inst.fence_configured

Check warning on line 121 in crmsh/crash_test/task.py

View check run for this annotation

Codecov / codecov/patch

crmsh/crash_test/task.py#L121

Added line #L121 was not covered by tests
self.fence_action = fence_info_inst.fence_action
self.fence_timeout = fence_info_inst.fence_timeout

Expand Down
4 changes: 4 additions & 0 deletions crmsh/crash_test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@
return False
return True

@property
def fence_configured(self):
return crmshutils.has_stonith_running()

Check warning on line 115 in crmsh/crash_test/utils.py

View check run for this annotation

Codecov / codecov/patch

crmsh/crash_test/utils.py#L113-L115

Added lines #L113 - L115 were not covered by tests

@property
def fence_action(self):
action_result = crmshutils.get_property("stonith-action")
Expand Down
3 changes: 3 additions & 0 deletions crmsh/ui_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,9 @@
'usage: fence <node>'
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

Check warning on line 489 in crmsh/ui_node.py

View check run for this annotation

Codecov / codecov/patch

crmsh/ui_node.py#L487-L489

Added lines #L487 - L489 were not covered by tests
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
Expand Down
Loading