Blame SOURCES/bz1940363-1-galera-redis-use-output-as.patch

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