sbd/SOURCES/0003-Fix-sbd-pacemaker-handle-new-no_quorum_demote.patch
2021-09-10 04:16:07 +00:00

72 lines
2.8 KiB
Diff

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