From 42702fa770928535613ee92fab6e077f85c529b5 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 11 Feb 2008 09:52:09 +1100 Subject: [PATCH] add helpers to stop/start nfs lockmanager on different platforms (This used to be ctdb commit 3b797d851bd4bdb8ec2b3981061c668d2cf0f97c) --- ctdb/config/functions | 42 +++++++++++++++++++++++++++++++++++++++ ctdb/config/statd-callout | 4 ++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/ctdb/config/functions b/ctdb/config/functions index 3a5744f1081..2e79c3330a5 100644 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -268,3 +268,45 @@ startstop_nfs() { ;; esac } + +######################################################## +# start/stop the nfs lockmanager service on different platforms +######################################################## +startstop_nfslock() { + PLATFORM="unknown" + [ -x /etc/init.d/nfsserver ] && { + PLATFORM="sles" + } + [ -x /etc/init.d/nfslock ] && { + PLATFORM="rhel" + } + + case $PLATFORM in + sles) + # for sles there is no service for lockmanager + # so we instead just shutdown/restart nfs + case $1 in + start) + service nfsserver start + ;; + stop) + service nfsserver stop > /dev/null 2>&1 + ;; + esac + ;; + rhel) + case $1 in + start) + service nfslock start + ;; + stop) + service nfslock stop > /dev/null 2>&1 + ;; + esac + ;; + *) + echo "Unknown platform. NFS locking is not supported with ctdb" + exit 1 + ;; + esac +} diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout index 1e3168d151b..a18890bf000 100755 --- a/ctdb/config/statd-callout +++ b/ctdb/config/statd-callout @@ -81,7 +81,7 @@ case "$1" in # will respond "strangely" immediately after restarting it, which # causes clients to fail to reclaim the locks. # - service nfslock stop > /dev/null 2>&1 + startstop_nfslock stop > /dev/null 2>&1 sleep 2 # copy all monitored clients on this node to the local lockmanager @@ -96,7 +96,7 @@ case "$1" in done # now start lockmanager again with the new state directory. - service nfslock start > /dev/null 2>&1 + startstop_nfslock start > /dev/null 2>&1 # we now need to send out additional statd notifications to ensure # that clients understand that the lockmanager has restarted.