From 5f46b1f653a6463483e01372b6da1bf9616add26 Mon Sep 17 00:00:00 2001 From: jmsperu Date: Tue, 26 May 2026 21:14:43 +0300 Subject: [PATCH] kvmsmpheartbeat.sh: honour kvm.heartbeat.fence.action Per @weizhouapache's review on #13090, kvmsmpheartbeat.sh was still hard-coding the immediate-reboot fence action (echo b > /proc/sysrq-trigger) while kvmheartbeat.sh and kvmspheartbeat.sh delegate to kvmha-fence.sh. Source kvmha-fence.sh and call fence_action so this script picks up the same hard-reboot / graceful-reboot / restart-agent / log-only / custom behaviour from agent.properties. Default behaviour (no property set) remains hard-reboot via sysrq-trigger, so existing deployments are unaffected. --- scripts/vm/hypervisor/kvm/kvmsmpheartbeat.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/vm/hypervisor/kvm/kvmsmpheartbeat.sh b/scripts/vm/hypervisor/kvm/kvmsmpheartbeat.sh index b102a1a866b..25dfb596e38 100755 --- a/scripts/vm/hypervisor/kvm/kvmsmpheartbeat.sh +++ b/scripts/vm/hypervisor/kvm/kvmsmpheartbeat.sh @@ -207,11 +207,13 @@ then exit 0 elif [ "$cflag" == "1" ] then - /usr/bin/logger -t heartbeat "kvmsmpheartbeat.sh will reboot system because it was unable to write the heartbeat to the storage." - sync & - sleep 5 - echo b > /proc/sysrq-trigger - exit $? + # Delegate the fence action to the shared helper so this script honours the + # kvm.heartbeat.fence.action property (hard-reboot / graceful-reboot / + # restart-agent / log-only / custom) like kvmheartbeat.sh and kvmspheartbeat.sh. + # Default (no property set) remains hard-reboot via sysrq-trigger. + # shellcheck disable=SC1091 + . "$(dirname "$0")/kvmha-fence.sh" + fence_action "kvmsmpheartbeat.sh" else write_hbLog exit $?