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.
This commit is contained in:
jmsperu 2026-05-26 21:14:43 +03:00 committed by James Peru Mmbono
parent 4a8f0af96d
commit 5f46b1f653
1 changed files with 7 additions and 5 deletions

View File

@ -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 $?