Blame SOURCES/0006-Fix-make-syncing-of-pacemaker-resource-startup-confi.patch

f21030
From f4d38a073ce3bfa2078792f1cc85229457430292 Mon Sep 17 00:00:00 2001
f21030
From: Klaus Wenninger <klaus.wenninger@aon.at>
f21030
Date: Tue, 21 Jul 2020 18:30:30 +0200
f21030
Subject: [PATCH] Fix: make syncing of pacemaker resource startup configurable
f21030
f21030
---
f21030
 src/sbd-inquisitor.c | 20 ++++++++++++++++++++
f21030
 src/sbd-pacemaker.c  |  6 +++---
f21030
 src/sbd.h            |  1 +
f21030
 src/sbd.sysconfig    | 14 ++++++++++++++
f21030
 4 files changed, 38 insertions(+), 3 deletions(-)
f21030
f21030
diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c
f21030
index 52ede8a..962725e 100644
f21030
--- a/src/sbd-inquisitor.c
f21030
+++ b/src/sbd-inquisitor.c
f21030
@@ -35,6 +35,7 @@ bool do_flush = true;
f21030
 char timeout_sysrq_char = 'b';
f21030
 bool move_to_root_cgroup = true;
f21030
 bool enforce_moving_to_root_cgroup = false;
f21030
+bool sync_resource_startup = false;
f21030
 
f21030
 int parse_device_line(const char *line);
f21030
 
f21030
@@ -964,6 +965,25 @@ int main(int argc, char **argv, char **envp)
f21030
             }
f21030
         }
f21030
 
f21030
+        value = getenv("SBD_SYNC_RESOURCE_STARTUP");
f21030
+        if(value) {
f21030
+            sync_resource_startup = crm_is_true(value);
f21030
+        }
f21030
+#if !USE_PACEMAKERD_API
f21030
+        if (sync_resource_startup) {
f21030
+            fprintf(stderr, "Failed to sync resource-startup as "
f21030
+                "SBD was built against pacemaker not supporting pacemakerd-API.\n");
f21030
+            exit_status = -1;
f21030
+            goto out;
f21030
+        }
f21030
+#else
f21030
+        if (!sync_resource_startup) {
f21030
+            cl_log(LOG_WARNING, "SBD built against pacemaker supporting "
f21030
+                             "pacemakerd-API. Should think about enabling "
f21030
+                             "SBD_SYNC_RESOURCE_STARTUP.");
f21030
+        }
f21030
+#endif
f21030
+
f21030
 	while ((c = getopt(argc, argv, "czC:DPRTWZhvw:d:n:p:1:2:3:4:5:t:I:F:S:s:r:")) != -1) {
f21030
 		switch (c) {
f21030
 		case 'D':
f21030
diff --git a/src/sbd-pacemaker.c b/src/sbd-pacemaker.c
f21030
index 1243bfc..aa1fb57 100644
f21030
--- a/src/sbd-pacemaker.c
f21030
+++ b/src/sbd-pacemaker.c
f21030
@@ -190,12 +190,12 @@ mon_cib_connection_destroy(gpointer user_data)
f21030
 		/* retrigger as last one might have been skipped */
f21030
 		mon_refresh_state(NULL);
f21030
 
f21030
-#if !USE_PACEMAKERD_API
f21030
-		if (pcmk_clean_shutdown) {
f21030
+
f21030
+		if ((pcmk_clean_shutdown) && (!sync_resource_startup)) {
f21030
 			/* assume a graceful pacemaker-shutdown */
f21030
 			clean_up(EXIT_PCMK_SERVANT_GRACEFUL_SHUTDOWN);
f21030
 		}
f21030
-#endif
f21030
+
f21030
 		/* getting here we aren't sure about the pacemaker-state
f21030
 		   so try to use the timeout to reconnect and get
f21030
 		   everything sorted out again
f21030
diff --git a/src/sbd.h b/src/sbd.h
f21030
index 382e553..3b6647c 100644
f21030
--- a/src/sbd.h
f21030
+++ b/src/sbd.h
f21030
@@ -161,6 +161,7 @@ extern bool do_flush;
f21030
 extern char timeout_sysrq_char;
f21030
 extern bool move_to_root_cgroup;
f21030
 extern bool enforce_moving_to_root_cgroup;
f21030
+extern bool sync_resource_startup;
f21030
 
f21030
 /* Global, non-tunable variables: */
f21030
 extern int  sector_size;
f21030
diff --git a/src/sbd.sysconfig b/src/sbd.sysconfig
f21030
index 33b50d0..b32e826 100644
f21030
--- a/src/sbd.sysconfig
f21030
+++ b/src/sbd.sysconfig
f21030
@@ -106,6 +106,20 @@ SBD_TIMEOUT_ACTION=flush,reboot
f21030
 #
f21030
 SBD_MOVE_TO_ROOT_CGROUP=auto
f21030
 
f21030
+## Type: yesno
f21030
+## Default: no
f21030
+#
f21030
+# If resource startup syncing is enabled then pacemakerd is
f21030
+# gonna wait to be pinged via IPC before it starts resources.
f21030
+# On shutdown pacemakerd is going to wait in a state where it
f21030
+# has cleanly shutdown resources till sbd fetches that state.
f21030
+#
f21030
+# Default is 'no' to prevent pacemaker from waiting for a
f21030
+# ping that will never come when working together with an sbd
f21030
+# version that doesn't support the feature.
f21030
+#
f21030
+SBD_SYNC_RESOURCE_STARTUP=no
f21030
+
f21030
 ## Type: string
f21030
 ## Default: ""
f21030
 #
f21030
-- 
f21030
1.8.3.1
f21030