[SCM] CTDB repository - branch master updated - ctdb-1.0.105-66-g5fc297a

Ronnie Sahlberg sahlberg at samba.org
Thu Dec 3 20:48:28 MST 2009


The branch, master has been updated
       via  5fc297a6bd49d9366703eef3edb9bdf0fe8505cc (commit)
       via  9ea261f791ab919eb1ce5b37073b4f1d30694bb8 (commit)
       via  4c6e68ae942c05224c5f8b683fbc2dc1adced8ee (commit)
       via  3d55408cbbb3bb71670b80f3dad5639ea0be5b5b (commit)
      from  cc99c05c0c6484ad574039a454e6133852cb41fa (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5fc297a6bd49d9366703eef3edb9bdf0fe8505cc
Merge: cc99c05c0c6484ad574039a454e6133852cb41fa 9ea261f791ab919eb1ce5b37073b4f1d30694bb8
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Dec 4 14:44:46 2009 +1100

    Merge branch 'status-test-2'

commit 9ea261f791ab919eb1ce5b37073b4f1d30694bb8
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Dec 1 18:08:57 2009 +1100

    Eventscripts: Fix syntax error in 00.ctdb.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 4c6e68ae942c05224c5f8b683fbc2dc1adced8ee
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Dec 1 17:54:45 2009 +1100

    Eventscripts: Remove executable bit accidently set on some scripts.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 3d55408cbbb3bb71670b80f3dad5639ea0be5b5b
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Dec 1 17:43:47 2009 +1100

    Eventscript argument cleanups and introduction of ctdb_standard_event_handler.
    
    The functions file no longer causes a side-effect by doing a shift.
    It also doesn't set a convenience variable for $1.
    
    All eventscripts now explicitly use "$1" in their case statement, as
    does the initscript.  The absence of a shift means that the
    takeip/releaseip events now explicitly reference $2-$4 rather than
    $1-$3.
    
    New function ctdb_standard_event_handler handles the status and
    setstatus events, and exits for either of those events.  It is called
    via a default case in each eventscript, replacing an explicit status
    case where applicable.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

-----------------------------------------------------------------------

Summary of changes:
 config/ctdb.init              |    2 +-
 config/events.d/00.ctdb       |    7 ++++++-
 config/events.d/01.reclock    |    7 ++++---
 config/events.d/10.interface  |   22 +++++++++++-----------
 config/events.d/11.natgw      |    5 ++++-
 config/events.d/11.routing    |   10 ++++++----
 config/events.d/20.multipathd |   11 +++++++----
 config/events.d/31.clamd      |   12 ++++++------
 config/events.d/40.vsftpd     |   16 ++++++++--------
 config/events.d/41.httpd      |    6 +++---
 config/events.d/50.samba      |    7 +++----
 config/events.d/60.nfs        |   10 +++++-----
 config/events.d/61.nfstickle  |   10 ++++++----
 config/events.d/70.iscsi      |   13 ++++++-------
 config/events.d/91.lvs        |    5 ++++-
 config/events.d/99.timeout    |    7 ++++++-
 config/functions              |   33 ++++++++++++++++-----------------
 17 files changed, 102 insertions(+), 81 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/ctdb.init b/config/ctdb.init
index 4bd570d..67747fd 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -250,7 +250,7 @@ status() {
 }
 
 
-case "$cmd" in
+case "$1" in
     start)
   	start
 	;;
diff --git a/config/events.d/00.ctdb b/config/events.d/00.ctdb
index f2ec5e8..9e83d30 100755
--- a/config/events.d/00.ctdb
+++ b/config/events.d/00.ctdb
@@ -12,7 +12,7 @@
 . $CTDB_BASE/functions
 loadconfig
 
-case $cmd in 
+case "$1" in 
      startup)
         # make sure we have a blank state directory for the scripts to work with
 	/bin/rm -rf $CTDB_BASE/state
@@ -39,6 +39,11 @@ case $cmd in
 			ctdb shutdown
 		}
 	}
+	;;
+
+    *)
+	ctdb_standard_event_handler "$@"
+	;;
 esac
 
 # all OK
diff --git a/config/events.d/01.reclock b/config/events.d/01.reclock
index 1b6cbf0..919d296 100755
--- a/config/events.d/01.reclock
+++ b/config/events.d/01.reclock
@@ -4,7 +4,7 @@
 . $CTDB_BASE/functions
 loadconfig
 
-case $cmd in 
+case "$1" in 
     startup)
 	ctdb_counter_init
 	;;
@@ -37,8 +37,9 @@ case $cmd in
 
 	ctdb_check_counter_limit 3 quiet
 	;;
-    status)
-	ctdb_checkstatus || exit $?
+
+    *)
+	ctdb_standard_event_handler "$@"
 	;;
 esac
 
diff --git a/config/events.d/10.interface b/config/events.d/10.interface
index da6d903..e24cc36 100755
--- a/config/events.d/10.interface
+++ b/config/events.d/10.interface
@@ -17,7 +17,7 @@ loadconfig
 	exit 0
 }
 
-case $cmd in 
+case "$1" in 
      #############################
      # called when ctdbd starts up
      startup)
@@ -41,13 +41,13 @@ case $cmd in
      ################################################
      # called when ctdbd wants to claim an IP address
      takeip)
-	if [ $# != 3 ]; then
+	if [ $# != 4 ]; then
 	   echo "must supply interface, IP and maskbits"
 	   exit 1
 	fi
-	iface=$1
-	ip=$2
-	maskbits=$3
+	iface=$2
+	ip=$3
+	maskbits=$4
 
 	# we make sure the interface is up first
 	/sbin/ip link set $iface up || {
@@ -68,7 +68,7 @@ case $cmd in
      ##################################################
      # called when ctdbd wants to release an IP address
      releaseip)
-	if [ $# != 3 ]; then
+	if [ $# != 4 ]; then
 	   echo "must supply interface, IP and maskbits"
 	   exit 1
 	fi
@@ -83,9 +83,9 @@ case $cmd in
 	# 2) use netstat -tn to find existing connections, and kill them 
 	# 3) remove the IP from the interface
 	# 4) remove the firewall rule
-	iface=$1
-	ip=$2
-	maskbits=$3
+	iface=$2
+	ip=$3
+	maskbits=$4
 
 	failed=0
 	# we do an extra delete to cope with the script being killed
@@ -174,8 +174,8 @@ case $cmd in
 	    esac
 	done
 	;;
-    status)
-	ctdb_checkstatus || exit $?
+    *)
+	ctdb_standard_event_handler "$@"
 	;;
 esac
 
diff --git a/config/events.d/11.natgw b/config/events.d/11.natgw
index 3a35094..ee7b4f9 100644
--- a/config/events.d/11.natgw
+++ b/config/events.d/11.natgw
@@ -22,7 +22,7 @@ delete_all() {
 
 }
 
-case $cmd in 
+case "$1" in 
     startup)
 	# do not respond to ARPs that are for ip addresses with scope 'host'
 	echo 3 > /proc/sys/net/ipv4/conf/all/arp_ignore
@@ -70,6 +70,9 @@ case $cmd in
 	delete_all
 	;;
 
+    *)
+	ctdb_standard_event_handler "@"
+	;;
 esac
 
 exit 0
diff --git a/config/events.d/11.routing b/config/events.d/11.routing
index cb34e41..c265c38 100755
--- a/config/events.d/11.routing
+++ b/config/events.d/11.routing
@@ -19,15 +19,17 @@ loadconfig
     exit 0
 }
 
-case $cmd in 
-     takeip|releaseip)
-	iface=$1
+case "$1" in 
+    takeip|releaseip)
+	iface=$2
 	cat $CTDB_BASE/static-routes | egrep "^$iface " | while read IFACE DEST GW; do
 	    ip route add $DEST via $GW dev $IFACE >/dev/null 2>/dev/null
 	done
-
 	;;
 
+    *)
+	ctdb_standard_event_handler "$@"
+	;;
 esac
 
 exit 0
diff --git a/config/events.d/20.multipathd b/config/events.d/20.multipathd
index cf722d8..091a773 100644
--- a/config/events.d/20.multipathd
+++ b/config/events.d/20.multipathd
@@ -74,15 +74,15 @@ multipathd_check()
 	fi
 }
 
-case $cmd in
-     startup)
+case "$1" in
+    startup)
 	# create a state directory to keep/track the multipath device
 	# state
 	/bin/mkdir -p $CTDB_BASE/state/multipathd
 	exit 0
 	;;
 
-     monitor)
+    monitor)
 	multipathd_check
 	[ "$?" = "0" ] || {
 		echo 20.multipathd: monitoring of multipathing failed
@@ -90,7 +90,10 @@ case $cmd in
 	}
 	exit 0
 	;;
+
+    *)
+	ctdb_standard_event_handler "$@"
+	;;
 esac
 
-# ignore unknown commands
 exit 0
diff --git a/config/events.d/31.clamd b/config/events.d/31.clamd
index a6515a9..73454d7 100644
--- a/config/events.d/31.clamd
+++ b/config/events.d/31.clamd
@@ -25,21 +25,21 @@ ctdb_start_stop_service
 
 is_ctdb_managed_service || exit 0
 
-case $cmd in 
-     startup)
+case "$1" in 
+    startup)
 	ctdb_service_start
         ;;
 
-     shutdown)
+    shutdown)
         ctdb_service_stop
         ;;
 
-     monitor)
+    monitor)
         ctdb_check_unix_socket ${CTDB_CLAMD_SOCKET} || exit $?
         ;;
 
-    status)
-	ctdb_checkstatus || exit $?
+    *)
+	ctdb_standard_event_handler "$@"
 	;;
 esac
 
diff --git a/config/events.d/40.vsftpd b/config/events.d/40.vsftpd
index 582604a..7ca7ba8 100755
--- a/config/events.d/40.vsftpd
+++ b/config/events.d/40.vsftpd
@@ -17,20 +17,20 @@ ctdb_start_stop_service
 
 is_ctdb_managed_service || exit 0
 
-case $cmd in 
-     startup)
+case "$1" in 
+    startup)
 	ctdb_service_start
 	;;
 
-     shutdown)
+    shutdown)
 	ctdb_service_stop
 	;;
 
-     takeip|releaseip)
+    takeip|releaseip)
 	ctdb_service_set_reconfigure
 	;;
 
-     recovered)
+    recovered)
 	# if we have taken or released any ips we must 
 	# restart vsftpd to ensure that all tcp connections are reset
 	if ctdb_service_needs_reconfigure ; then
@@ -38,7 +38,7 @@ case $cmd in
 	fi
 	;;
 
-     monitor)
+    monitor)
 	if ctdb_service_needs_reconfigure ; then
 	    ctdb_service_reconfigure
 	    exit 0
@@ -55,8 +55,8 @@ case $cmd in
 	fi	
 	;;
 
-    status)
-	ctdb_checkstatus || exit $?
+    *)
+	ctdb_standard_event_handler "$@"
 	;;
 esac
 
diff --git a/config/events.d/41.httpd b/config/events.d/41.httpd
index 7f9ee23..15a35ea 100755
--- a/config/events.d/41.httpd
+++ b/config/events.d/41.httpd
@@ -37,7 +37,7 @@ ctdb_start_stop_service
 
 is_ctdb_managed_service || exit 0
 
-case $cmd in
+case "$1" in
     startup)
 	ctdb_service_start
 	;;
@@ -59,8 +59,8 @@ case $cmd in
 	fi
 	;;
 
-    status)
-	ctdb_checkstatus || exit $?
+    *)
+	ctdb_standard_event_handler "$@"
 	;;
 esac
 
diff --git a/config/events.d/50.samba b/config/events.d/50.samba
index 5b5aa1e..5c10b19 100755
--- a/config/events.d/50.samba
+++ b/config/events.d/50.samba
@@ -196,7 +196,7 @@ periodic_cleanup() {
     smbstatus -np > /dev/null 2>&1 &
 }
 
-case $cmd in 
+case "$1" in 
      startup)
 	ctdb_service_start
 	;;
@@ -251,10 +251,9 @@ case $cmd in
 	}
 	;;
 
-    status)
-	ctdb_checkstatus || exit $?
+    *)
+	ctdb_standard_event_handler "$@"
 	;;
 esac
 
-# ignore unknown commands
 exit 0
diff --git a/config/events.d/60.nfs b/config/events.d/60.nfs
index 44ea674..4d5494a 100755
--- a/config/events.d/60.nfs
+++ b/config/events.d/60.nfs
@@ -31,7 +31,7 @@ loadconfig
 
 ctdb_start_stop_service
 
-case $cmd in 
+case "$1" in 
      startup)
 	ctdb_service_start
 	;;
@@ -42,12 +42,12 @@ case $cmd in
 
      takeip)
 	ctdb_service_set_reconfigure
-	touch $CTDB_BASE/state/statd/ip/$2
+	touch $CTDB_BASE/state/statd/ip/$3
 	;;
 
      releaseip)
 	ctdb_service_set_reconfigure
-	/bin/rm -f $CTDB_BASE/state/statd/ip/$2
+	/bin/rm -f $CTDB_BASE/state/statd/ip/$3
 	;;
 
      recovered)
@@ -103,8 +103,8 @@ case $cmd in
 	}
        	;;
 
-    status)
-	ctdb_checkstatus || exit $?
+    *)
+	ctdb_standard_event_handler "$@"
 	;;
 esac
 
diff --git a/config/events.d/61.nfstickle b/config/events.d/61.nfstickle
index e2bde52..b717e2a 100755
--- a/config/events.d/61.nfstickle
+++ b/config/events.d/61.nfstickle
@@ -13,14 +13,14 @@ ctdb_start_stop_service
 
 [ -z "$NFS_TICKLE_SHARED_DIRECTORY" ] && exit 0
 
-case $cmd in 
+case "$1" in 
      startup)
 	ctdb_service_start
 	;;
 	
      takeip)
-	iface=$1
-	ip=$2
+	iface=$2
+	ip=$3
 	# first send a grat arp, to ensure the client knows the updated
 	# mac address for this IP
 	ctdb gratiousarp $ip $iface
@@ -48,7 +48,9 @@ case $cmd in
 		done
 	;;
 
+    *)
+	ctdb_standard_event_handler "$@"
+	;;
 esac
 
-# ignore unknown commands
 exit 0
diff --git a/config/events.d/70.iscsi b/config/events.d/70.iscsi
index 8cbf457..a3cf040 100755
--- a/config/events.d/70.iscsi
+++ b/config/events.d/70.iscsi
@@ -12,8 +12,8 @@ ctdb_start_stop_service
 	exit 0
 }
 
-case $cmd in 
-     recovered)
+case "$1" in 
+    recovered)
 	# block the iscsi port
 	iptables -I INPUT 1 -p tcp --dport 3260 -j DROP
 	
@@ -43,19 +43,18 @@ case $cmd in
 
 	;;
 
-     shutdown)
+    shutdown)
 	# shutdown iscsi when ctdb goes down
 	killall -9 tgtd >/dev/null 2>/dev/null
 	;;
 
-     monitor)
+    monitor)
 	ctdb_check_tcp_ports 3260 || exit $?
 	;;
 
-    status)
-	ctdb_checkstatus || exit $?
+    *)
+	ctdb_standard_event_handler "$@"
 	;;
 esac
 
-# ignore unknown commands
 exit 0
diff --git a/config/events.d/91.lvs b/config/events.d/91.lvs
index 3bc316f..3fbc57d 100755
--- a/config/events.d/91.lvs
+++ b/config/events.d/91.lvs
@@ -13,7 +13,7 @@ loadconfig ctdb
     exit 0
 }
 
-case $cmd in 
+case "$1" in 
      startup)
 	ipvsadm -D -t $CTDB_LVS_PUBLIC_IP:0
 	ipvsadm -D -u $CTDB_LVS_PUBLIC_IP:0
@@ -78,6 +78,9 @@ case $cmd in
 	echo 1 > /proc/sys/net/ipv4/route/flush
 	;;
 
+    *)
+	ctdb_standard_event_handler "$@"
+	;;
 esac
 
 exit 0
diff --git a/config/events.d/99.timeout b/config/events.d/99.timeout
index a1201bf..7a47c8d 100755
--- a/config/events.d/99.timeout
+++ b/config/events.d/99.timeout
@@ -9,12 +9,17 @@ loadconfig ctdb
 
 [ "$CTDB_RUN_TIMEOUT_MONITOR" = "yes" ] || exit 0
 
-case $cmd in
+case "$1" in
     monitor)
 	TIMEOUT=$(ctdb listvars | awk '$1 == "EventScriptTimeout" {print $3}')
 	echo "sleeping for $((TIMEOUT * 2)) seconds..."
 	sleep $((TIMEOUT * 2))
 	;;
+
+
+    *)
+	ctdb_standard_event_handler "$@"
+	;;
 esac
 
 exit 0


-- 
CTDB repository


More information about the samba-cvs mailing list