Mailing List Archive

A patch for resource-agents(nfsserver)
Hi Dejan,

I have a patch for nfsserver agent in resource-agents package.

sm-notify was invoked in nfsserver, with -d option, sm-notify doesn't fork, and without time limit, it tries to reach each client for 15 minutes, still spending this time in the startup procedure of the resource, so this option has been removed as fix for git commit ae83f2befdafdfae633afa1553f5d7c4f72d0196

I think it should be an option to set or unset the -d, and we can improve this even beter we could use the option -m to set the retrytime.

The patch added 2 parameters for nfsserver agent:

OCF_RESKEY_nfs_notify_foreground:
type: boolean
default 'false' ,
'false' to unset -d, 'true' to set -d

OCF_RESKEY_nfs_notify_retry_time:
type: integer
default '15'

Best regards,
John
Re: A patch for resource-agents(nfsserver) [ In reply to ]
Hi John,

On Thu, Dec 13, 2012 at 12:08:56AM -0700, John Shi wrote:
>
> Hi Dejan,
>
> I have a patch for nfsserver agent in resource-agents package.
>
> sm-notify was invoked in nfsserver, with -d option, sm-notify doesn't fork, and without time limit, it tries to reach each client for 15 minutes, still spending this time in the startup procedure of the resource, so this option has been removed as fix for git commit ae83f2befdafdfae633afa1553f5d7c4f72d0196
>
> I think it should be an option to set or unset the -d, and we can improve this even beter we could use the option -m to set the retrytime.

OK, I guess that there could be use cases where the failover
would wait until all clients get notified.

> The patch added 2 parameters for nfsserver agent:
>
> OCF_RESKEY_nfs_notify_foreground:
> type: boolean
> default 'false' ,
> 'false' to unset -d, 'true' to set -d
>
> OCF_RESKEY_nfs_notify_retry_time:
> type: integer
> default '15'
>
> Best regards,
> John
>
> From f98a19be89eff8cb3f46a8957c4d81be694a2921 Mon Sep 17 00:00:00 2001
> From: John Shi <jshi@suse.com>
> Date: Wed, 12 Dec 2012 15:50:39 +0800
> Subject: [PATCH] Medium: nfsserver: make the retry time for sm-notify in the
> nfsserver resource agent configurable

The two options are actually independent. So, they should be
either put into two patches or the description modified to
better reflect the change.

> ---
> heartbeat/nfsserver | 38 +++++++++++++++++++++++++++++++++++++-
> 1 file changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver
> index 6414e3a..974bff9 100755
> --- a/heartbeat/nfsserver
> +++ b/heartbeat/nfsserver
> @@ -14,6 +14,8 @@ fi
>
> DEFAULT_INIT_SCRIPT="/etc/init.d/nfsserver"
> DEFAULT_NOTIFY_CMD="/sbin/sm-notify"
> +DEFAULT_NOTIFY_FOREGROUND="false"
> +DEFAULT_NOTIFY_RETRY_TIME=15
> DEFAULT_RPCPIPEFS_DIR="/var/lib/nfs/rpc_pipefs"
>
> nfsserver_meta_data() {
> @@ -55,6 +57,28 @@ The tool to send out notification.
> <content type="string" default="$DEFAULT_NOTIFY_CMD" />
> </parameter>
>
> +<parameter name="nfs_notify_foreground" unique="0" required="0">
> +<longdesc lang="en">
> +Keeps sm-notify attached to its controlling terminal and running in the foreground.
> +</longdesc>
> +<shortdesc lang="en">
> +Keeps sm-notify running in the foreground.
> +</shortdesc>
> +<content type="boolean" default="$DEFAULT_NOTIFY_FOREGROUND" />
> +</parameter>
> +
> +<parameter name="nfs_notify_retry_time" unique="0" required="0">
> +<longdesc lang="en">
> +Specifies the length of sm-notify retry time, in minutes, to continue retrying notifications to unresponsive hosts.
> +If this option is not specified, sm-notify attempts to send notifications for 15 minutes. Specifying a value of 0
> +causes sm-notify to continue sending notifications to unresponsive peers until it is manually killed.
> +</longdesc>
> +<shortdesc lang="en">
> +Specifies the length of sm-notify retry time(minutes).
> +</shortdesc>
> +<content type="integer" default="$DEFAULT_NOTIFY_RETRY_TIME" />
> +</parameter>
> +
> <parameter name="nfs_shared_infodir" unique="0" required="1">
> <longdesc lang="en">
> The nfsserver resource agent will save nfs related information in this specific directory.
> @@ -129,6 +153,8 @@ esac
> fp="$OCF_RESKEY_nfs_shared_infodir"
> : ${OCF_RESKEY_nfs_init_script="$DEFAULT_INIT_SCRIPT"}
> : ${OCF_RESKEY_nfs_notify_cmd="$DEFAULT_NOTIFY_CMD"}
> +: ${OCF_RESKEY_nfs_notify_foreground="$DEFAULT_NOTIFY_FOREGROUND"}
> +: ${OCF_RESKEY_nfs_notify_retry_time="$DEFAULT_NOTIFY_RETRY_TIME"}
>
> if [ -z ${OCF_RESKEY_rpcpipefs_dir} ]; then
> rpcpipefs_make_dir=$fp/rpc_pipefs
> @@ -220,7 +246,17 @@ nfsserver_start ()
> #Notify the nfs server has been moved or rebooted
> #The init script do that already, but with the hostname, which may be ignored by client
> #we have to do it again with the nfs_ip
> - local opts="-f -v"
> + local opts
> +
> + if ! ocf_is_decimal "$OCF_RESKEY_nfs_notify_retry_time"; then
> + ocf_log err "Invalid OCF_RESKEY_nfs_notify_retry_time [$OCF_RESKEY_nfs_notify_retry_time]"
> + return $OCF_ERR_CONFIGURED
> + fi
> + if ocf_is_true "$OCF_RESKEY_nfs_notify_foreground"; then
> + opts="-d"
> + fi
> + opts="$opts -m $OCF_RESKEY_nfs_notify_retry_time -f -v"

This might be a bit better:

# set default options
local opts="-f -v"

# add option for notify_retry_time, if set
if [ -n "$OCF_RESKEY_nfs_notify_retry_time" ]; then
if ! ocf_is_decimal "$OCF_RESKEY_nfs_notify_retry_time"; then
ocf_log err "Invalid OCF_RESKEY_nfs_notify_retry_time [$OCF_RESKEY_nfs_notify_retry_time]"
return $OCF_ERR_CONFIGURED
fi
opts="$opts -m $OCF_RESKEY_nfs_notify_retry_time"
fi

# run in foreground, if requested
if ocf_is_true "$OCF_RESKEY_nfs_notify_foreground"; then
opts="$opts -d"
fi

What do you say?

Cheers,

Dejan
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/