[SCM] CTDB repository - branch 1.0.112 updated - ctdb-1.0.111-65-g5ba7028

Ronnie Sahlberg sahlberg at samba.org
Wed Apr 21 22:19:28 MDT 2010


The branch, 1.0.112 has been updated
       via  5ba7028ce62b747db84dfccea0c5168e5de16228 (commit)
       via  aec9aa904d01e6c7f2b62ee379e007e894cf220b (commit)
       via  2765400d4b01d68316b105e84e9436a0b57cb072 (commit)
      from  3f403ff374915a831b02d2f072bc61cf1ba9e77a (commit)

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


- Log -----------------------------------------------------------------
commit 5ba7028ce62b747db84dfccea0c5168e5de16228
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Apr 22 14:16:39 2010 +1000

    New version 1.0.112-16

commit aec9aa904d01e6c7f2b62ee379e007e894cf220b
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Apr 22 14:02:11 2010 +1000

    add an example script that can be called from crontab to cleanup
    and release public ip addresses if ctdbd is no longer running

commit 2765400d4b01d68316b105e84e9436a0b57cb072
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Apr 22 13:36:13 2010 +1000

    add a missing ||
    to make the 10.interface script not fail with a syntax error

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

Summary of changes:
 Makefile.in                  |    1 +
 config/ctdb-crash-cleanup.sh |   35 +++++++++++++++++++++++++++++++++++
 config/events.d/10.interface |    2 +-
 packaging/RPM/ctdb.spec.in   |    7 ++++++-
 4 files changed, 43 insertions(+), 2 deletions(-)
 create mode 100755 config/ctdb-crash-cleanup.sh


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 0684df3..054c1e0 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -233,6 +233,7 @@ install: all
 	if [ -f doc/ctdbd.1 ];then ${INSTALLCMD} -m 644 doc/ctdbd.1 $(DESTDIR)$(mandir)/man1; fi
 	if [ -f doc/onnode.1 ];then ${INSTALLCMD} -m 644 doc/onnode.1 $(DESTDIR)$(mandir)/man1; fi
 	if [ ! -f $(DESTDIR)$(etcdir)/ctdb/notify.sh ];then ${INSTALLCMD} -m 755 config/notify.sh $(DESTDIR)$(etcdir)/ctdb; fi
+	if [ ! -f $(DESTDIR)$(etcdir)/ctdb/ctdb-crash-cleanup.sh ];then ${INSTALLCMD} -m 755 config/ctdb-crash-cleanup.sh $(DESTDIR)$(etcdir)/ctdb; fi
 
 test: all
 	tests/run_tests.sh
diff --git a/config/ctdb-crash-cleanup.sh b/config/ctdb-crash-cleanup.sh
new file mode 100755
index 0000000..ca6a838
--- /dev/null
+++ b/config/ctdb-crash-cleanup.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# This script can be called from a cronjob to automatically drop/release
+# all public ip addresses if CTDBD has crashed or stopped running.
+#
+
+[ -z "$CTDB_BASE" ] && {
+    CTDB_BASE=/etc/ctdb
+}
+
+[ -z "$CTDB_PUBLIC_ADDRESSES" ] && {
+	CTDB_PUBLIC_ADDRESSES=$CTDB_BASE/public_addresses
+}
+
+[ ! -f "$CTDB_PUBLIC_ADDRESSES" ] && {
+	echo "No public addresses file found. Cant cleanup."
+	exit 1
+}
+
+# if ctdb is running, just return
+ctdb status 2>/dev/null && {
+    exit 0
+}
+
+cat "$CTDB_PUBLIC_ADDRESSES" | cut -d/ -f1 | while read _IP; do
+	_IP_HELD=`/sbin/ip addr show | grep "inet $_IP/"`
+	[ -z "$_IP_HELD" ] || {
+		_IFACE=`echo $_IP_HELD | sed -e "s/.*\s//"`
+		_NM=`echo $_IP_HELD | sed -e "s/.*$_IP\///" -e "s/\s.*//"`
+		logger "Removing public address $_IP/$_NM from device $_IFACE"
+		/sbin/ip addr del $_IP/$_NM dev $_IFACE
+	}
+done
+
+
diff --git a/config/events.d/10.interface b/config/events.d/10.interface
index 8cbe222..ab09b0d 100755
--- a/config/events.d/10.interface
+++ b/config/events.d/10.interface
@@ -193,7 +193,7 @@ case "$1" in
 		# we dont know how to test ib links
 		;;
 	    *)
-		[ -z "$IFACE" ] {
+		[ -z "$IFACE" ] || {
 		    [ "$(basename $(readlink /sys/class/net/$IFACE/device/driver))" = virtio_net ] ||
 		    ethtool $IFACE | grep -q 'Link detected: yes' || {
 			# On some systems, this is not successful when a
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 15d7a7b..04c8a07 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -5,7 +5,7 @@ Vendor: Samba Team
 Packager: Samba Team <samba at samba.org>
 Name: ctdb
 Version: 1.0.112
-Release: 15
+Release: 16
 Epoch: 0
 License: GNU GPL version 3
 Group: System Environment/Daemons
@@ -87,6 +87,7 @@ rm -rf $RPM_BUILD_ROOT
 
 %config(noreplace) %{_sysconfdir}/sysconfig/ctdb
 %config(noreplace) %{_sysconfdir}/ctdb/notify.sh
+%config(noreplace) %{_sysconfdir}/ctdb/ctdb-crash-cleanup.sh
 %config(noreplace) %{_sysconfdir}/ctdb/functions
 %attr(755,root,root) %{initdir}/ctdb
 
@@ -123,6 +124,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_docdir}/ctdb/tests/bin/ctdb_transaction
 
 %changelog
+* Thu Apr 22 2010 : Version 1.0.112-16
+ - Fix for a syntax error bug in 10.interfaces
+ - Add a ctdb-crash-cleanup-sh script that can be used
+   from a cronjob to release ip addresses if ctdb has stopped.
 * Wed Apr 21 2010 : Version 1.0.112-15
  - Change how we add/remove iptable rules during recovery to make 
    rules leaks less likey.


-- 
CTDB repository


More information about the samba-cvs mailing list