From 91f00cdd03b874c52c5818f2b864da85fb6a7712 Mon Sep 17 00:00:00 2001 From: xin liang Date: Fri, 31 Oct 2025 11:06:21 +0800 Subject: [PATCH] Dev: ui_sbd: Check if crashdump is configured before purging crashdump options --- crmsh/ui_sbd.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crmsh/ui_sbd.py b/crmsh/ui_sbd.py index bbbc73a99..c9c74ef1e 100644 --- a/crmsh/ui_sbd.py +++ b/crmsh/ui_sbd.py @@ -376,6 +376,10 @@ def _set_crashdump_in_sysconfig(self, crashdump_watchdog_timeout=None, restore=F return update_dict + def _is_crashdump_configured(self) -> bool: + sbd_timeout_action_configured = sbd.SBDUtils.get_sbd_value_from_config("SBD_TIMEOUT_ACTION") + return sbd_timeout_action_configured and "crashdump" in sbd_timeout_action_configured + def _check_kdump_service(self): no_kdump = False for node in self.cluster_nodes: @@ -593,6 +597,9 @@ def do_purge(self, context, *args) -> bool: utils.check_all_nodes_reachable("purging SBD") if args and args[0] == "crashdump": + if not self._is_crashdump_configured(): + logger.error("SBD crashdump is not configured") + return False self._set_crashdump_option(delete=True) update_dict = self._set_crashdump_in_sysconfig(restore=True) if update_dict: