summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2016-06-06 14:03:47 +1000
committerAmitay Isaacs <amitay@samba.org>2016-06-08 10:33:19 +0200
commit48d1fd8299663cddabf63cb1d33a8c032d9b9b87 (patch)
tree7a28094eb287df119423c33646a77b384e8d8a06
parent6096233919528e2337fa9d3269caaf0a86becf9b (diff)
downloadsamba-48d1fd8299663cddabf63cb1d33a8c032d9b9b87.tar.gz
ctdb-scripts: Add eventscript 06.nfs
This generates takeip-pre and releaseip-pre call-out events. One use is to put NFS into grace before an IP is assigned to an interface. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
-rwxr-xr-xctdb/config/events.d/06.nfs39
-rwxr-xr-xctdb/config/nfs-linux-kernel-callout2
-rwxr-xr-xctdb/doc/examples/nfs-ganesha-callout2
-rw-r--r--ctdb/packaging/RPM/ctdb.spec.in1
4 files changed, 42 insertions, 2 deletions
diff --git a/ctdb/config/events.d/06.nfs b/ctdb/config/events.d/06.nfs
new file mode 100755
index 00000000000..2a069f33033
--- /dev/null
+++ b/ctdb/config/events.d/06.nfs
@@ -0,0 +1,39 @@
+#!/bin/sh
+# script to manage nfs in a clustered environment
+
+[ -n "$CTDB_BASE" ] || \
+ export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
+. $CTDB_BASE/functions
+
+service_name="nfs"
+loadconfig
+ctdb_setup_service_state_dir
+
+######################################################################
+
+nfs_callout_pre ()
+{
+ _event="$1"
+ shift
+
+ nfs_callout "${_event}-pre" "$@"
+}
+
+######################################################################
+
+nfs_callout_init
+
+ctdb_start_stop_service
+
+is_ctdb_managed_service || exit 0
+
+case "$1" in
+takeip)
+ nfs_callout_pre "$@"
+ ;;
+
+releaseip)
+ nfs_callout_pre "$@"
+ ;;
+esac
diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout
index 22151a67770..3b457be0ba6 100755
--- a/ctdb/config/nfs-linux-kernel-callout
+++ b/ctdb/config/nfs-linux-kernel-callout
@@ -242,7 +242,7 @@ case "$1" in
register)
nfs_register
;;
- monitor-pre|releaseip|takeip)
+ monitor-pre|releaseip|takeip|releaseip-pre|takeip-pre)
# Not required/implemented
:
;;
diff --git a/ctdb/doc/examples/nfs-ganesha-callout b/ctdb/doc/examples/nfs-ganesha-callout
index 34794c19ade..3e12b367958 100755
--- a/ctdb/doc/examples/nfs-ganesha-callout
+++ b/ctdb/doc/examples/nfs-ganesha-callout
@@ -335,7 +335,7 @@ case "$action" in
takeip) nfs_takeip "$@" ;;
monitor-list-shares) nfs_monitor_list_shares ;;
register) nfs_register ;;
- monitor-pre|monitor-post)
+ monitor-pre|monitor-post|releaseip-pre|takeip-pre)
# Not required/implemented
:
;;
diff --git a/ctdb/packaging/RPM/ctdb.spec.in b/ctdb/packaging/RPM/ctdb.spec.in
index 3bc9bebaf94..b7c881eea1f 100644
--- a/ctdb/packaging/RPM/ctdb.spec.in
+++ b/ctdb/packaging/RPM/ctdb.spec.in
@@ -171,6 +171,7 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/ctdb/events.d/00.ctdb
%{_sysconfdir}/ctdb/events.d/01.reclock
%{_sysconfdir}/ctdb/events.d/05.system
+%{_sysconfdir}/ctdb/events.d/06.nfs
%{_sysconfdir}/ctdb/events.d/10.interface
%{_sysconfdir}/ctdb/events.d/10.external
%{_sysconfdir}/ctdb/events.d/13.per_ip_routing