From e316840a7e1d2a72e3089ee194334244c959905a Mon Sep 17 00:00:00 2001
From: Ken Gaillot <kgaillot@redhat.com>
Date: Wed, 19 Jan 2022 09:53:53 -0600
Subject: [PATCH] Fix: pacemakerd: tweak systemd unit respawn settings

If pacemaker exits immediately after starting, wait 1 second before trying to
respawn, since the default of 100ms is a bit aggressive for a Pacemaker
cluster.

Also, allow 5 attempts in 25 seconds before giving up.
---
 daemons/pacemakerd/pacemaker.service.in | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/daemons/pacemakerd/pacemaker.service.in b/daemons/pacemakerd/pacemaker.service.in
index 0363a2259c..3fd53d9ffb 100644
--- a/daemons/pacemakerd/pacemaker.service.in
+++ b/daemons/pacemakerd/pacemaker.service.in
@@ -31,6 +31,9 @@ After=rsyslog.service
 After=corosync.service
 Requires=corosync.service
 
+# If Pacemaker respawns repeatedly, give up after this many tries in this time
+StartLimitBurst=5
+StartLimitIntervalSec=25s
 
 [Install]
 WantedBy=multi-user.target
@@ -57,6 +60,9 @@ TasksMax=infinity
 # resource.  Sending -KILL will just get the node fenced
 SendSIGKILL=no
 
+# Systemd's default of respawning a failed service after 100ms is too aggressive
+RestartSec=1s
+
 # If we ever hit the StartLimitInterval/StartLimitBurst limit, and the
 # admin wants to stop the cluster while pacemakerd is not running, it
 # might be a good idea to enable the ExecStopPost directive below.
-- 
2.27.0

