[SCM] CTDB repository - branch 1.2 updated - ctdb-1.9.1-255-gf5acdbc

Ronnie Sahlberg sahlberg at samba.org
Sun Dec 5 18:17:54 MST 2010


The branch, 1.2 has been updated
       via  f5acdbc1fa120446f870789bcfb44e3d6e30b479 (commit)
       via  2a060eed9a2d69c55bf5f4e1acffe4cdf62eee96 (commit)
       via  9906e4f6e2b72722fa72e65a1e519e2e8742b0c3 (commit)
      from  4ff998bf33cfa6d1222f7c8f8eba3aeec0f36e6e (commit)

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


- Log -----------------------------------------------------------------
commit f5acdbc1fa120446f870789bcfb44e3d6e30b479
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Dec 6 11:30:24 2010 +1100

    Add 60.ganesha to what gets installed by make install as well as by the RPM

commit 2a060eed9a2d69c55bf5f4e1acffe4cdf62eee96
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Dec 6 11:26:43 2010 +1100

    add a missing part of the import of the previous ganesha patch

commit 9906e4f6e2b72722fa72e65a1e519e2e8742b0c3
Author: Chandra Seetharaman <sekharan at us.ibm.com>
Date:   Fri Dec 3 15:26:22 2010 -0800

    make changes to ctdb event scripts to support NFS-Ganesha.
    
    make changes to ctdb event scripts to support NFS-Ganesha.
    
    Signed-off-by: Chandra Seetharaman <sekharan at us.ibm.com>
    Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>

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

Summary of changes:
 Makefile.in                |    1 +
 config/events.d/60.ganesha |  158 ++++++++++++++++++++++++++++++++++++++++++++
 config/events.d/60.nfs     |    2 +
 config/functions           |    1 +
 packaging/RPM/ctdb.spec.in |    1 +
 5 files changed, 163 insertions(+), 0 deletions(-)
 create mode 100644 config/events.d/60.ganesha


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 849d626..e5ef81f 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -243,6 +243,7 @@ install: all
 	${INSTALLCMD} -m 755 config/events.d/41.httpd $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/50.samba $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/60.nfs $(DESTDIR)$(etcdir)/ctdb/events.d
+	${INSTALLCMD} -m 644 config/events.d/60.ganesha $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/62.cnfs $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/70.iscsi $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/91.lvs $(DESTDIR)$(etcdir)/ctdb/events.d
diff --git a/config/events.d/60.ganesha b/config/events.d/60.ganesha
new file mode 100644
index 0000000..b7bc923
--- /dev/null
+++ b/config/events.d/60.ganesha
@@ -0,0 +1,158 @@
+#!/bin/sh
+# script to manage nfs in a clustered environment
+
+start_nfs() {
+       /bin/mkdir -p $CTDB_VARDIR/state/nfs
+       /bin/mkdir -p $CTDB_VARDIR/state/statd/ip
+       ctdb_service_stop
+       ctdb_service_start
+       echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
+}
+
+. $CTDB_BASE/functions
+
+loadconfig nfs
+
+[ "$NFS_SERVER_MODE" == "GANESHA" ] || exit 0
+
+service_name="nfs-ganesha-gpfs"
+
+ctdb_start_stop_service
+
+is_ctdb_managed_service || exit 0
+
+case "$1" in
+     init)
+       # read statd from persistent database
+       ;;
+     startup)
+       ctdb_service_start
+       mkdir -p $CTDB_VARDIR/state/statd
+       touch $CTDB_VARDIR/state/statd/update-trigger
+       ;;
+
+     shutdown)
+       ctdb_service_stop
+       ;;
+
+     takeip)
+       ctdb_service_set_reconfigure
+       ;;
+
+     releaseip)
+       ctdb_service_set_reconfigure
+       ;;
+
+      monitor)
+       if ctdb_service_needs_reconfigure ; then
+           ctdb_service_reconfigure
+           exit 0
+       fi
+
+       update_tickles 2049
+
+       # check that statd responds to rpc requests
+       # if statd is not running we try to restart it
+       if ctdb_check_rpc "STATD" status 1 >/dev/null ; then
+               (service_name="nfs_statd"; ctdb_counter_init)
+       else
+               p="rpc.statd" ; cmd="$p"
+               cmd="${cmd}${STATD_HOSTNAME:+ -n }${STATD_HOSTNAME}"
+               cmd="${cmd}${STATD_PORT:+ -p }${STATD_PORT}"
+               cmd="${cmd}${STATD_OUTGOING_PORT:+ -o }${STATD_OUTGOING_PORT}"
+               (
+                       service_name="nfs_statd"
+                       ctdb_counter_incr
+                       ctdb_check_counter_limit 10 quiet >/dev/null
+               ) || {
+                       echo "$ctdb_check_rpc_out"
+                       echo "Trying to restart STATD [$cmd]"
+               }
+               $cmd
+       fi
+
+       # check that NFS responds to rpc requests
+       [ "$CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK" = "yes" ] || {
+           if ctdb_check_rpc "NFS" nfs 3 >/dev/null ; then
+               (service_name="nfs_knfsd"; ctdb_counter_init)
+           else
+               (
+                       service_name="nfs_knfsd"
+                       ctdb_counter_incr
+
+                       ctdb_check_counter_equal 10 || {
+                               echo "Trying to restart NFS service"
+                               ctdb_service_stop
+                               ctdb_service_start
+                               exit 0
+                       }
+
+                       ctdb_check_counter_limit 15 quiet >/dev/null
+               ) || {
+                       echo "$ctdb_check_rpc_out"
+                       echo "Trying to restart NFS service"
+                       ctdb_service_stop
+                       ctdb_service_start
+                       exit 1
+               }
+           fi
+       }
+
+       # and that its directories are available
+       [ "$CTDB_NFS_SKIP_SHARE_CHECK" = "yes" ] || {
+           grep Path /etc/ganesha/gpfs.ganesha.exports.conf |
+           cut -f2 -d\" | ctdb_check_directories
+       } || exit $?
+
+       # check that lockd responds to rpc requests
+       ctdb_check_rpc "LOCKD" nlockmgr 4 || {
+               echo "Trying to restart lock manager service"
+               ctdb_service_stop
+               ctdb_service_start
+               exit 1
+       }
+
+       # check mounts responds to rpc requests
+       ctdb_check_rpc "MOUNTD" mountd 1 >/dev/null || {
+               echo "Trying to restart mountd service"
+               ctdb_service_stop
+               ctdb_service_start
+               exit 1
+       }
+
+       # rquotad needs special handling since it is sometimes not started
+       # correctly on RHEL5
+       # this is not a critical service so we dont flag the node as unhealthy
+       ctdb_check_rpc "RQUOTAD" rquotad 1 || {
+               p="rpc.rquotad"
+               cmd="${p}${RQUOTAD_PORT:+ -p }${RQUOTAD_PORT}"
+               echo "Trying to restart RQUOTAD [${cmd}]"
+               killall -q -9 $p
+               $cmd &
+       }
+
+       # once every 60 seconds, update the statd state database for which
+       # clients need notifications
+       LAST_UPDATE=`stat --printf="%Y" $CTDB_VARDIR/state/statd/update-trigger 2>/dev/null`
+       CURRENT_TIME=`date +"%s"`
+       [ $CURRENT_TIME -ge $(($LAST_UPDATE + 60)) ] && {
+           mkdir -p $CTDB_VARDIR/state/statd
+           touch $CTDB_VARDIR/state/statd/update-trigger
+           $CTDB_BASE/statd-callout updatelocal &
+           $CTDB_BASE/statd-callout updateremote &
+       }
+               ;;
+
+    ipreallocated)
+       # if the ips have been reallocated, we must restart the lockmanager
+       # across all nodes and ping all statd listeners
+       [ -x $CTDB_BASE/statd-callout ] && {
+               $CTDB_BASE/statd-callout notify &
+       } >/dev/null 2>&1
+       ;;
+    *)
+       ctdb_standard_event_handler "$@"
+       ;;
+esac
+
+exit 0
diff --git a/config/events.d/60.nfs b/config/events.d/60.nfs
index 23f22b7..a8fe243 100755
--- a/config/events.d/60.nfs
+++ b/config/events.d/60.nfs
@@ -17,6 +17,8 @@ service_stop="startstop_nfs stop"
 
 loadconfig
 
+[ "$NFS_SERVER_MODE" != "GANESHA" ] || exit 0
+
 ctdb_start_stop_service
 
 is_ctdb_managed_service || exit 0
diff --git a/config/functions b/config/functions
index ee38225..4dc645b 100755
--- a/config/functions
+++ b/config/functions
@@ -674,6 +674,7 @@ is_ctdb_managed_service ()
     ctdb_compat_managed_service "$CTDB_MANAGES_ISCSI"    "iscsi"
     ctdb_compat_managed_service "$CTDB_MANAGES_CLAMD"    "clamd"
     ctdb_compat_managed_service "$CTDB_MANAGES_NFS"      "nfs"
+    ctdb_compat_managed_service "$CTDB_MANAGES_NFS"      "nfs-ganesha-gpfs"
 
     # Returns 0 if "<space>$_service_name<space>" appears in $t
     [ "${t#* ${_service_name} }" != "${t}" ]
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 3b830f0..2b58e20 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -107,6 +107,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_sysconfdir}/ctdb/events.d/41.httpd
 %{_sysconfdir}/ctdb/events.d/50.samba
 %{_sysconfdir}/ctdb/events.d/60.nfs
+%{_sysconfdir}/ctdb/events.d/60.ganesha
 %{_sysconfdir}/ctdb/events.d/62.cnfs
 %{_sysconfdir}/ctdb/events.d/70.iscsi
 %{_sysconfdir}/ctdb/events.d/91.lvs


-- 
CTDB repository


More information about the samba-cvs mailing list