diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-05-31 11:09:45 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2007-05-31 11:09:45 +1000 |
commit | c6d4478fdaf912a483424ac761e00781d6da3ba2 (patch) | |
tree | 9174dcffcbc5364424711974def2f05873df8693 | |
parent | cc87648933ab85140b1bff2853a61425e8887f11 (diff) | |
download | samba-c6d4478fdaf912a483424ac761e00781d6da3ba2.tar.gz samba-c6d4478fdaf912a483424ac761e00781d6da3ba2.tar.xz samba-c6d4478fdaf912a483424ac761e00781d6da3ba2.zip |
added hooks to make nfs statd behave correctly on failover
(This used to be ctdb commit a1ee84fc47892b6c18d417ccf714211fcb07952e)
-rw-r--r-- | ctdb/.bzrignore | 1 | ||||
-rw-r--r-- | ctdb/README | 3 | ||||
-rw-r--r-- | ctdb/packaging/RHEL/ctdb.spec | 3 | ||||
-rw-r--r-- | ctdb/packaging/RHEL/setup/ctdb.sysconfig | 5 | ||||
-rwxr-xr-x | ctdb/packaging/RHEL/setup/statd-callout | 44 | ||||
-rwxr-xr-x | ctdb/tools/events | 6 |
6 files changed, 58 insertions, 4 deletions
diff --git a/ctdb/.bzrignore b/ctdb/.bzrignore index 1f939f8271b..3b41315a2bd 100644 --- a/ctdb/.bzrignore +++ b/ctdb/.bzrignore @@ -15,3 +15,4 @@ ctdb-1 ctdb-2 ctdb-3 nodes.txt +TAGS diff --git a/ctdb/README b/ctdb/README deleted file mode 100644 index 094d1d9958e..00000000000 --- a/ctdb/README +++ /dev/null @@ -1,3 +0,0 @@ -To build this you need a recent copy of talloc, libreplace and tdb in -the directory above this directory. - diff --git a/ctdb/packaging/RHEL/ctdb.spec b/ctdb/packaging/RHEL/ctdb.spec index 9bba5683b15..65d47560657 100644 --- a/ctdb/packaging/RHEL/ctdb.spec +++ b/ctdb/packaging/RHEL/ctdb.spec @@ -66,6 +66,7 @@ make DESTDIR=$RPM_BUILD_ROOT install install -m644 setup/ctdb.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ctdb install -m755 setup/ctdb.init $RPM_BUILD_ROOT%{initdir}/ctdb install -m755 tools/events $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events +install -m755 tools/statd-callout $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/statd-callout install -m755 tools/onnode.ssh $RPM_BUILD_ROOT%{_bindir} install -m755 tools/onnode.rsh $RPM_BUILD_ROOT%{_bindir} ln -sf %{_bindir}/onnode.ssh $RPM_BUILD_ROOT%{_bindir}/onnode @@ -107,6 +108,7 @@ fi %attr(755,root,root) %config %{initdir}/ctdb %{_sysconfdir}/ctdb/events +%{_sysconfdir}/ctdb/statd-callout %{_sbindir}/ctdbd %{_bindir}/ctdb %{_bindir}/onnode.ssh @@ -114,4 +116,3 @@ fi %{_bindir}/onnode %{_includedir}/ctdb.h %{_includedir}/ctdb_private.h - diff --git a/ctdb/packaging/RHEL/setup/ctdb.sysconfig b/ctdb/packaging/RHEL/setup/ctdb.sysconfig index 13d83ce1abf..f6d13142d3b 100644 --- a/ctdb/packaging/RHEL/setup/ctdb.sysconfig +++ b/ctdb/packaging/RHEL/setup/ctdb.sysconfig @@ -47,6 +47,11 @@ # the default is not to wait for any local services # CTDB_WAIT_TCP_PORTS="445 139" +# the shared directory where you want to put statd information on +# which clients to notify on a NFS restart +# there is no default +# STATD_SHARED_DIRECTORY="/some/shared/directory" + # any other options you might want. Run ctdbd --help for a list # CTDB_OPTIONS= diff --git a/ctdb/packaging/RHEL/setup/statd-callout b/ctdb/packaging/RHEL/setup/statd-callout new file mode 100755 index 00000000000..5d2959aeeea --- /dev/null +++ b/ctdb/packaging/RHEL/setup/statd-callout @@ -0,0 +1,44 @@ +#!/bin/sh + +. /etc/sysconfig/ctdb + +[ -z "$STATD_SHARED_DIRECTORY" ] && exit 0 + +[ -d $STATD_SHARED_DIRECTORY ] || exit 0 + +case "$1" in + add-client) + for f in `/bin/ls /etc/ctdb/ip.*`; do + fname=`/bin/basename $f` + ip=`echo $fname | cut -d. -f2-` + [ -d $STATD_SHARED_DIRECTORY/$ip ] || /bin/mkdir $STATD_SHARED_DIRECTORY/$ip + /bin/touch $STATD_SHARED_DIRECTORY/$ip/$2 + done + ;; + del-client) + for f in `/bin/ls /etc/ctdb/ip.*`; do + fname=`/bin/basename $f` + ip=`echo $fname | cut -d. -f2-` + /bin/rm -f $STATD_SHARED_DIRECTORY/$ip/$2 + done + ;; + copy) + restart_needed=0 + for f in `/bin/ls /etc/ctdb/ip.*`; do + fname=`/bin/basename $f` + ip=`echo $fname | cut -d. -f2-` + [ -d $STATD_SHARED_DIRECTORY/$ip ] && { + /bin/mv $STATD_SHARED_DIRECTORY/$ip $STATD_SHARED_DIRECTORY/$ip.$$ + /bin/cp -a $STATD_SHARED_DIRECTORY/$ip.$$/. /var/lib/nfs/statd/sm/ + /bin/rm -rf $STATD_SHARED_DIRECTORY/$ip.$$ + restart_needed=1 + } + done + # restart lockd if necessary + [ $restart_needed -eq 1 ] && { + ( /sbin/service nfslock status > /dev/null 2>&1 && + /sbin/service nfslock restart > /dev/null 2>&1 ) & + } > /dev/null 2>&1 + ;; +esac + diff --git a/ctdb/tools/events b/ctdb/tools/events index 18d6fc9b2f3..f2508eafe74 100755 --- a/ctdb/tools/events +++ b/ctdb/tools/events @@ -43,6 +43,10 @@ case $cmd in } # if we have a local arp entry for this IP then remove it /sbin/arp -d $ip 2> /dev/null + + # having a list of what IPs we have allows statd to do the right + # thing via /etc/ctdb/statd-callout + /bin/touch /etc/ctdb/ip.$ip exit 0 ;; @@ -61,12 +65,14 @@ case $cmd in # if we have a local arp entry for this IP then remove it /sbin/arp -d $ip 2> /dev/null echo $ip >> /etc/ctdb/released_ips + /bin/rm -f /etc/ctdb/ip.$ip exit 0 ;; recovered) # restart any services as necessary, like NFS # + [ -x /etc/ctdb/statd-callout ] && /etc/ctdb/statd-callout copy [ -f /etc/ctdb/released_ips ] && { ( /sbin/service nfs status > /dev/null 2>&1 && /sbin/service nfs restart > /dev/null 2>&1 ) & |