From 34c76ffec50d9d4e85a33859b5694bc8c01e304d Mon Sep 17 00:00:00 2001 From: Vinit Agnihotri Date: Thu, 26 Oct 2023 23:03:01 -0700 Subject: [PATCH] ctdb-doc: Factor out grace period function Signed-off-by: Vinit Agnihotri Reviewed-by: Martin Schwenke Reviewed-by: Volker Lendecke --- ctdb/doc/examples/nfs-ganesha-callout | 31 ++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/ctdb/doc/examples/nfs-ganesha-callout b/ctdb/doc/examples/nfs-ganesha-callout index aac301df5d4..1605202c77b 100755 --- a/ctdb/doc/examples/nfs-ganesha-callout +++ b/ctdb/doc/examples/nfs-ganesha-callout @@ -254,31 +254,38 @@ service_check () #------------------------------------------------- -nfs_releaseip () +grace_period() { + _arg="$1" + if [ -x "/usr/bin/grace_period" ]; then - /usr/bin/grace_period "2:${2}" + /usr/bin/grace_period "$_arg" else dbus-send --print-reply --system --dest=org.ganesha.nfsd \ - /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace \ - string:"2:${2}" + /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace \ + string:"$_arg" fi } +nfs_releaseip() +{ + _ip="$2" + + # NFS-Ganesha recovery code only processes items matching $_ip + grace_period "2:${_ip}" +} + nfs_takeip () { + _ip="$2" + case $state_fs in glusterfs) - check_ln "$NODESTATEDIR" "${GANSTATEDIR}/${2}" + check_ln "$NODESTATEDIR" "${GANSTATEDIR}/${_ip}" ;; esac - if [ -x "/usr/bin/grace_period" ]; then - /usr/bin/grace_period "5:${2}" - else - dbus-send --print-reply --system --dest=org.ganesha.nfsd \ - /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.grace \ - string:"5:${2}" - fi + + grace_period "5:${_ip}" } ##################################################