From f510d8e78ce65736ca5a72bd8125d31dcb4ff621 Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Tue, 16 Jun 2020 13:32:18 +0200
Subject: [PATCH 1/2] galera/redis: use --output-as for crm_mon w/newer
Pacemaker, and prepare for Promoted role
---
heartbeat/galera | 9 ++++++++-
heartbeat/redis.in | 9 ++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/heartbeat/galera b/heartbeat/galera
index 4a313e24b..ba3de4b81 100755
--- a/heartbeat/galera
+++ b/heartbeat/galera
@@ -441,7 +441,14 @@ master_exists()
return 1
fi
# determine if a master instance is already up and is healthy
- crm_mon --as-xml | grep "resource.*id=\"${INSTANCE_ATTR_NAME}\".*role=\"Master\".*active=\"true\".*orphaned=\"false\".*failed=\"false\"" > /dev/null 2>&1
+ ocf_version_cmp "$OCF_RESKEY_crm_feature_set" "3.1.0"
+ res=$?
+ if [ -z "$OCF_RESKEY_crm_feature_set" ] || [ $res -eq 2 ]; then
+ XMLOPT="--output-as=xml"
+ else
+ XMLOPT="--as-xml"
+ fi
+ crm_mon -1 $XMLOPT | grep -q -i -E "resource.*id=\"${INSTANCE_ATTR_NAME}\".*role=\"(Promoted|Master)\".*active=\"true\".*orphaned=\"false\".*failed=\"false\""
return $?
}
diff --git a/heartbeat/redis.in b/heartbeat/redis.in
index da7230a49..7e534db4a 100755
--- a/heartbeat/redis.in
+++ b/heartbeat/redis.in
@@ -272,7 +272,14 @@ master_is_active()
{
if [ -z "$MASTER_ACTIVE_CACHED" ]; then
# determine if a master instance is already up and is healthy
- crm_mon --as-xml | grep "resource.*id=\"${OCF_RESOURCE_INSTANCE}\".*role=\"Master\".*active=\"true\".*orphaned=\"false\".*failed=\"false\"" > /dev/null 2>&1
+ ocf_version_cmp "$OCF_RESKEY_crm_feature_set" "3.1.0"
+ res=$?
+ if [ -z "$OCF_RESKEY_crm_feature_set" ] || [ $res -eq 2 ]; then
+ XMLOPT="--output-as=xml"
+ else
+ XMLOPT="--as-xml"
+ fi
+ crm_mon -1 $XMLOPT | grep -q -i -E "resource.*id=\"${OCF_RESOURCE_INSTANCE}\".* role=\"(Promoted|Master)\".* active=\"true\".* orphaned=\"false\".* failed=\"false\""
MASTER_ACTIVE=$?
MASTER_ACTIVE_CACHED="true"
fi
From 6f36172da222275124fb44736b4801ea884c3dd0 Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Fri, 31 Jul 2020 14:31:47 +0200
Subject: [PATCH 2/2] galera/redis: support RHEL 8.1 pacemaker
based on dfdb4e645638948cd4dafaba9d65ebddb2152b2c that solves this issue
in pgsql
---
heartbeat/galera | 7 +++++++
heartbeat/redis.in | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/heartbeat/galera b/heartbeat/galera
index ba3de4b81..69d75a854 100755
--- a/heartbeat/galera
+++ b/heartbeat/galera
@@ -445,6 +445,13 @@ master_exists()
res=$?
if [ -z "$OCF_RESKEY_crm_feature_set" ] || [ $res -eq 2 ]; then
XMLOPT="--output-as=xml"
+ ocf_version_cmp "$OCF_RESKEY_crm_feature_set" "3.2.0"
+ if [ $? -eq 1 ]; then
+ crm_mon -1 $XMLOPT >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ XMLOPT="--as-xml"
+ fi
+ fi
else
XMLOPT="--as-xml"
fi
diff --git a/heartbeat/redis.in b/heartbeat/redis.in
index 7e534db4a..8afdf08a9 100755
--- a/heartbeat/redis.in
+++ b/heartbeat/redis.in
@@ -276,6 +276,13 @@ master_is_active()
res=$?
if [ -z "$OCF_RESKEY_crm_feature_set" ] || [ $res -eq 2 ]; then
XMLOPT="--output-as=xml"
+ ocf_version_cmp "$OCF_RESKEY_crm_feature_set" "3.2.0"
+ if [ $? -eq 1 ]; then
+ crm_mon -1 $XMLOPT >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ XMLOPT="--as-xml"
+ fi
+ fi
else
XMLOPT="--as-xml"
fi