[SCM] CTDB repository - branch master updated - ctdb-1.10-331-g6c28786

Ronnie Sahlberg sahlberg at samba.org
Tue Aug 9 23:36:52 MDT 2011


The branch, master has been updated
       via  6c287861e780ba985e7ae7a61c1ee462b925e09e (commit)
       via  8723b88b0b2bbeece38c74c77c50e8d8b3e2d5ca (commit)
       via  1b3f2dd62efb240f8486016fe0f8dfb73d6ccc66 (commit)
       via  a5ce2adaa39f077f56582072a97bb64d0eba4b4d (commit)
       via  28379ca0f747c5952d690a451834ce7421adfd34 (commit)
      from  abe67d6af1e0594641b98facc3534059263e1745 (commit)

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


- Log -----------------------------------------------------------------
commit 6c287861e780ba985e7ae7a61c1ee462b925e09e
Merge: abe67d6af1e0594641b98facc3534059263e1745 8723b88b0b2bbeece38c74c77c50e8d8b3e2d5ca
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed Aug 10 15:36:20 2011 +1000

    Merge remote branch 'martins/eventscript.00.ctdb'

commit 8723b88b0b2bbeece38c74c77c50e8d8b3e2d5ca
Merge: 1b3f2dd62efb240f8486016fe0f8dfb73d6ccc66 fb87fa9273db4f82e801a331b5d95059d64dfb8e
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Aug 10 15:32:58 2011 +1000

    Merge branch 'eventscript.20.multipathd' into eventscript.00.ctdb

commit 1b3f2dd62efb240f8486016fe0f8dfb73d6ccc66
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Dec 17 16:23:31 2010 +1100

    Eventscripts: fix dangerous rm -rf in 00.ctdb init event.
    
    Also remove some unnecessary absolute paths for commands, which were
    making the code slightly difficult to read.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit a5ce2adaa39f077f56582072a97bb64d0eba4b4d
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Dec 17 16:21:53 2010 +1100

    Eventscripts: 00.ctdb uses $service_state_dir, neaten update_config_from_tdb().
    
    This also fixes a bug where update_config_from_tdb() used an incorrect
    filename in one place.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 28379ca0f747c5952d690a451834ce7421adfd34
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Nov 19 14:32:28 2010 +1100

    00.ctdb eventscript removes all files from $ctdb_active_dir.
    
    Without this you can get into a situation where ctdbd can not start.
    If the active file for a service exists but the service is not
    running, then trying to stop the service may fail, causing the
    eventscript to exit from ctdb_start_stop_service().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

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

Summary of changes:
 config/events.d/00.ctdb |   37 ++++++++++++++++++++++---------------
 1 files changed, 22 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/00.ctdb b/config/events.d/00.ctdb
index 9df5af4..31f8fdc 100755
--- a/config/events.d/00.ctdb
+++ b/config/events.d/00.ctdb
@@ -12,28 +12,35 @@
 . $CTDB_BASE/functions
 loadconfig
 
+ctdb_setup_service_state_dir "ctdb"
+
+#
 update_config_from_tdb() {
-	# Pull optional ctdb configuration data out of config.tdb
-	PUBLICADDRESSESKEY='public_addresses:node#'`ctdb -t 1 xpnn|sed -e "s/.*://"`
-	rm -f $CTDB_VARDIR/state/public_addresses
-	ctdb pfetch config.tdb $PUBLICADDRESSESKEY $CTDB_VARDIR/state/public_addresses 2>/dev/null
-	[ "$?" = "0" ] && [ `stat --format="%s" /etc/ctdb/state/public_addresses` != "0" ] && [ ! -z "$CTDB_PUBLIC_ADDRESSES" ] && {
-		diff $CTDB_VARDIR/state/public_addresses $CTDB_PUBLIC_ADDRESSES >/dev/null 2>/dev/null
-		[ $? = "0" ] || {
-			echo CTDB public address configuration had been updated.
-			echo Extracting new configuration from database.
-			diff $CTDB_VARDIR/state/public_addresses $CTDB_PUBLIC_ADDRESSES
-			cp $CTDB_VARDIR/state/public_addresses $CTDB_PUBLIC_ADDRESSES
-			echo Restarting CTDB
-			service ctdb restart &
-		}
-	}
+
+    # Pull optional ctdb configuration data out of config.tdb
+    _key="public_addresses:node#$(ctdb -t 1 xpnn|sed -e 's/.*://')"
+    _t="$service_state_dir/public_addresses"
+    rm -f "$_t"
+
+    if ctdb pfetch config.tdb "$_key" "$_t" 2>/dev/null && \
+	[ -s "$_t" -a -n "$CTDB_PUBLIC_ADDRESSES"] && \
+	! cmp -s "$_t" "$CTDB_PUBLIC_ADDRESSES" ; then
+
+	echo "CTDB public address configuration has changed."
+	echo "Extracting new configuration from database."
+	diff "$_t" "$CTDB_PUBLIC_ADDRESSES"
+	cp "$_t" "$CTDB_PUBLIC_ADDRESSES"
+	echo "Restarting CTDB"
+	service ctdb restart &
+    fi
 }
 
 case "$1" in 
      init)
         # make sure we have a blank state directory for the scripts to work with
 	rm -rf $CTDB_VARDIR/state
+	# Look at the pattern - this should not be -rf!!!
+	rm -f $ctdb_managed_dir/*
 	mkdir -p $CTDB_VARDIR/state || {
 	    ret=$?
 	    echo "mkdir -p $CTDB_VARDIR/state - failed - $ret"


-- 
CTDB repository


More information about the samba-cvs mailing list