Blame SOURCES/0003-Fix-sbd-pacemaker-handle-new-no_quorum_demote.patch

109362
From 3048119bf4a0ddb2da01d4ca827ae659a089b622 Mon Sep 17 00:00:00 2001
109362
From: Klaus Wenninger <klaus.wenninger@aon.at>
109362
Date: Wed, 24 Jun 2020 14:33:21 +0200
109362
Subject: [PATCH] Fix: sbd-pacemaker: handle new no_quorum_demote
109362
109362
and be robust against unknown no-quorum-policies handling them
109362
as would be done with no_quorum_suicide
109362
---
109362
 configure.ac        | 17 ++++++++++++++++-
109362
 src/sbd-pacemaker.c | 11 ++++++++++-
109362
 2 files changed, 26 insertions(+), 2 deletions(-)
109362
109362
diff --git a/configure.ac b/configure.ac
109362
index 02e2678..3391c5f 100644
109362
--- a/configure.ac
109362
+++ b/configure.ac
109362
@@ -89,7 +89,22 @@ AC_CHECK_LIB(cib, cib_apply_patch_event, , missing="yes")
109362
 
109362
 dnl pacemaker-2.0 removed support for corosync 1 cluster layer
109362
 AC_CHECK_DECLS([pcmk_cluster_classic_ais, pcmk_cluster_cman],,,
109362
-	       [#include <pacemaker/crm/cluster.h>])
109362
+               [#include <pacemaker/crm/cluster.h>])
109362
+
109362
+dnl check for additional no-quorum-policies
109362
+dnl AC_TEST_NO_QUORUM_POLICY(POLICY)
109362
+AC_DEFUN([AC_TEST_NO_QUORUM_POLICY],[
109362
+    AC_MSG_CHECKING([whether enum pe_quorum_policy defines value $1])
109362
+    AC_LANG_PUSH([C])
109362
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
109362
+        [#include <pacemaker/crm/pengine/pe_types.h>],
109362
+        [enum pe_quorum_policy policy = $1; return policy;])],
109362
+            AC_DEFINE_UNQUOTED(m4_toupper(HAVE_ENUM_$1), 1,
109362
+            [Does pe_types.h have $1 value in enum pe_quorum_policy?])
109362
+            AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]))
109362
+    AC_LANG_POP([C])
109362
+])
109362
+AC_TEST_NO_QUORUM_POLICY(no_quorum_demote)
109362
 
109362
 dnl check for new pe-API
109362
 AC_CHECK_FUNCS(pe_new_working_set)
109362
diff --git a/src/sbd-pacemaker.c b/src/sbd-pacemaker.c
109362
index 11e104d..6e53557 100644
109362
--- a/src/sbd-pacemaker.c
109362
+++ b/src/sbd-pacemaker.c
109362
@@ -321,13 +321,22 @@ compute_status(pe_working_set_t * data_set)
109362
             case no_quorum_freeze:
109362
                 set_servant_health(pcmk_health_transient, LOG_INFO, "Quorum lost: Freeze resources");
109362
                 break;
109362
+#if HAVE_ENUM_NO_QUORUM_DEMOTE
109362
+            case no_quorum_demote:
109362
+                set_servant_health(pcmk_health_transient, LOG_INFO,
109362
+                    "Quorum lost: Demote promotable resources and stop others");
109362
+                break;
109362
+#endif
109362
             case no_quorum_stop:
109362
                 set_servant_health(pcmk_health_transient, LOG_INFO, "Quorum lost: Stop ALL resources");
109362
                 break;
109362
             case no_quorum_ignore:
109362
                 set_servant_health(pcmk_health_transient, LOG_INFO, "Quorum lost: Ignore");
109362
                 break;
109362
-            case no_quorum_suicide:
109362
+            default:
109362
+                /* immediate reboot is the most excessive action we take
109362
+                   use for no_quorum_suicide and everything we don't know yet
109362
+                 */
109362
                 set_servant_health(pcmk_health_unclean, LOG_INFO, "Quorum lost: Self-fence");
109362
                 break;
109362
         }
109362
-- 
109362
1.8.3.1
109362