# HG changeset patch
# User Holger Teutsch <[email protected]>
# Date 1288858439 -3600
# Node ID 0b48de2656249f9e5a5aab91ce643a3c7ed191bf
# Parent  2ff375ca321554cf146bcf5be197f73fcbe28975
Implement multi partition support. New instance param "dbpartitionnum" 
defaulting to 0.

diff -r 2ff375ca3215 -r 0b48de265624 heartbeat/db2
--- a/heartbeat/db2    Thu Nov 04 08:57:55 2010 +0100
+++ b/heartbeat/db2    Thu Nov 04 09:13:59 2010 +0100
@@ -79,6 +79,13 @@ The admin user of the instance.
 <shortdesc lang="en">admin</shortdesc>
 <content type="string" default="" />
 </parameter>
+<parameter name="dbpartitionnum" unique="0" required="0">
+<longdesc lang="en">
+The number of the partion (DBPARTITIONNUM) to be managed.
+</longdesc>
+<shortdesc lang="en">number of partion</shortdesc>
+<content type="string" default="0" />
+</parameter>
 </parameters>
 
 <actions>
@@ -123,7 +130,6 @@ db2info() {
 db2ctrl=$db2sql/ctrl
 db2bin=$db2sql/bin
 db2db2=$db2bin/db2
-    db2node=0 # single node instances are supported
 
 #    Let's make sure a few important things are there...
 if
@@ -172,10 +178,10 @@ logasdb2() {
 #
 db2_start() {
 if
-    output=`runasdb2 $db2adm/db2start`
+    output=`runasdb2 $db2db2 db2start dbpartitionnum $db2node`
 then
 : Hurray! DB2 started OK
-    ocf_log info "DB2 UDB instance $1 started: $output"
+    ocf_log info "DB2 UDB instance $1($db2node) started: $output"
 else
 case $output in
 SQL1026N*|*"is already active"*)
@@ -185,7 +191,7 @@ db2_start() {
 esac
 fi
 db2_status "$1" || {
-    ocf_log err "DB2 UDB instance $1 not active!"
+    ocf_log err "DB2 UDB instance $1($db2node) not active!"
 return $OCF_ERR_GENERIC
 }
 # db2jstrt has been deprecated since v8.x and doesn't exist
@@ -196,13 +202,17 @@ db2_start() {
 return $OCF_ERR_GENERIC
 }
 fi
+
+  [ $db2node = 0 ] || return 0
+  # activate DB only on node 0
+
 for DB in `db2_dblist`
 do
 if output=`runasdb2 $db2db2 activate database $DB`; then
 ocf_log info "DB2 UDB database $DB activated"
 else
 case $output in
-        SQL1490W*|SQL1494W*|*"already been activated"*)
+        SQL1490W*|SQL1494W*|SQL1497W*|*"already been activated"*)
 ocf_log info "DB2 UDB database $DB already activated: $output";;
 
 *) ocf_log err "DB2 UDB database $DB didn't activate: $output"; return 
$OCF_ERR_GENERIC;;
@@ -217,10 +227,10 @@ db2_stop_bg() {
 rc=$OCF_SUCCESS
 
 if
-    output=`runasdb2 $db2adm/db2stop force`
+    output=`runasdb2 $db2db2 db2stop force dbpartitionnum $db2node`
 then
 : DB2 stopped OK
-    ocf_log info "DB2 UDB instance $1 stopped: $output"
+    ocf_log info "DB2 UDB instance $1($db2node) stopped: $output"
 else
 case $output in
 
@@ -244,7 +254,7 @@ db2_stop() {
 rc=$OCF_SUCCESS
 
 db2_status || {
-    ocf_log info "DB2 UDB instance $1 already stopped"
+    ocf_log info "DB2 UDB instance $1($db2node) already stopped"
 return $rc
 }
 
@@ -285,7 +295,7 @@ db2_stop() {
 
 if [ $stoprc -ne 0 ]
 then
-      ocf_log warn "db2stop of $instance failed, using db2nkill"
+      ocf_log warn "db2stop of $instance($db2node) failed, using db2nkill"
 
 # db2nkill kills *all* partions on the node
 if [ -x $db2bin/db2nkill ]; then
@@ -299,10 +309,10 @@ db2_stop() {
 
 if db2_status
 then
-          ocf_log info "DB2 UDB instance $1 can not be killed with db2nkill"
+          ocf_log info "DB2 UDB instance $1($db2node) can not be killed with 
db2nkill"
 rc=$OCF_ERR_GENERIC
 else
-          ocf_log info "DB2 UDB instance $1 is now dead"
+          ocf_log info "DB2 UDB instance $1($db2node) is now dead"
 fi
 fi
 
@@ -342,6 +352,9 @@ db2_dblist() {
 # db2_monitor: Can the given db2 instance do anything useful?
 #
 db2_monitor() {
+  [ $db2node = 0 ] || return 0
+  # monitoring only for partition 0
+
 # We ignore the instance, the info we need is already in $vars
 for DB in `db2_dblist`
 do
@@ -404,6 +417,7 @@ fi
 
 instance=$OCF_RESKEY_instance
 db2admin=${OCF_RESKEY_admin:-$instance}
+db2node=${OCF_RESKEY_dbpartitionnum:-0}
 
 US=`id -u -n`
 US=`echo $US`
___________________________________________________________
Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to