File 0018-DB2-fix-HADR-support-for-DB2-V98.patch of Package resource-agents.8843
From c7847823458b6e184cded518fa04491eacdbd541 Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Thu, 6 Apr 2017 11:36:44 +0200
Subject: [PATCH] DB2: fix HADR support for DB2 V98+
---
heartbeat/db2 | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/heartbeat/db2 b/heartbeat/db2
index fed2d860..e1754e2d 100755
--- a/heartbeat/db2
+++ b/heartbeat/db2
@@ -646,7 +646,9 @@ db2_hadr_status() {
fi
echo "$output" |
- awk '/^HADR is not active/ {print "Standard/Standalone"; exit; }
+ awk '/^\s+HADR_(ROLE|STATE) =/ {printf $3"/"}
+ /^\s+HADR_CONNECT_STATUS =/ {print $3; exit; }
+ /^HADR is not active/ {print "Standard/Standalone"; exit; }
/^Role *State */ {getline; printf "%s/%s\n", $1, $2; exit; }'
}
@@ -676,7 +678,7 @@ db2_monitor() {
# set master preference accordingly
case "$hadr" in
- Primary/*|Standard/*)
+ PRIMARY/*|Primary/*|Standard/*)
# perform a basic health check
CMD="if db2 connect to $db;
then
@@ -708,11 +710,11 @@ db2_monitor() {
ocf_is_ms && master_score -v 10000 -l reboot
;;
- Standby/*Peer)
+ STANDBY/PEER/*|Standby/*Peer)
master_score -v 8000 -l reboot
;;
- Standby/*)
+ STANDBY/*|Standby/*)
ocf_log warn "DB2 database $instance($db2node)/$db in status $hadr can never be promoted"
master_score -D -l reboot
;;
@@ -751,17 +753,17 @@ db2_promote() {
return $OCF_SUCCESS
;;
- Primary/Peer)
+ PRIMARY/PEER/*|PRIMARY/REMOTE_CATCHUP/*|Primary/Peer)
# nothing to do, only update pacemaker's view
echo MASTER > $STATE_FILE
return $OCF_SUCCESS
;;
- Standby/Peer)
+ STANDBY/PEER/CONNECTED|Standby/Peer)
# must take over
;;
- Standby/DisconnectedPeer)
+ STANDBY/PEER/DISCONNECTED|Standby/DisconnectedPeer)
# must take over forced
force="by force peer window only"
;;
--
2.13.1