You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.2 KiB

From b5d3f7347ff423868d3735df377c649c3e81a12a 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 c522699..63de315 100755
--- a/heartbeat/db2
+++ b/heartbeat/db2
@@ -650,7 +650,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; }'
}
@@ -680,7 +682,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
@@ -712,11 +714,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
;;
@@ -755,17 +757,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"
;;