Mailing List Archive

Enhance to nfsserver RA
Hi all,

In the scenario that the nfsserver export through several IPs, we need to do the notification via all of these IPs.


The proposed patch extend the current nfs_ip to a list of IPs, and the RA can handle them in a loop.


Comments are welcome.


Thanks.
Re: Enhance to nfsserver RA [ In reply to ]
Hi,

On Mon, Nov 14, 2011 at 02:12:52AM -0700, Xinwei Hu wrote:
> Hi all,
>
> In the scenario that the nfsserver export through several IPs, we need to do the notification via all of these IPs.
>
>
> The proposed patch extend the current nfs_ip to a list of IPs, and the RA can handle them in a loop.
>
>
> Comments are welcome.
>
>
> Thanks.
>
>
>

> Index: heartbeat/nfsserver
> ===================================================================
> --- heartbeat.orig/nfsserver 2011-11-14 16:20:10.000000000 +0800
> +++ heartbeat/nfsserver 2011-11-14 16:28:37.000000000 +0800
> @@ -67,10 +67,10 @@
>
> <parameter name="nfs_ip" unique="0" required="1">
> <longdesc lang="en">
> -The floating IP address used to access the nfs service
> +Comma separated list of floating IP addresses used to access the nfs service
> </longdesc>
> <shortdesc lang="en">
> -IP address.
> +IP addresses.
> </shortdesc>
> <content type="string"/>
> </parameter>
> @@ -193,10 +193,16 @@
> #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="-v"
> + local opts="-df -v"

Are these extra options widely (enough) supported?

> echo $OCF_RESKEY_nfs_notify_cmd | grep -qws rpc.statd &&
> opts=""
> - ${OCF_RESKEY_nfs_notify_cmd} $opts $OCF_RESKEY_nfs_ip -P /var/lib/nfs/sm.ha
> + rm -rf /var/lib/nfs/sm.ha.save > /dev/null 2>&1
> + cp -rf /var/lib/nfs/sm.ha /var/lib/nfs/sm.ha.save > /dev/null 2>&1
> + for ip in ${OCF_RESKEY_nfs_ip//,/ }; do

Is this a bashism? If so, then better:

for ip in `echo ${OCF_RESKEY_nfs_ip} | sed 's/,/ /g'`; do

> + ${OCF_RESKEY_nfs_notify_cmd} $opts $ip -P /var/lib/nfs/sm.ha
> + rm -rf /var/lib/nfs/sm.ha > /dev/null 2>&1
> + cp -rf /var/lib/nfs/sm.ha.save /var/lib/nfs/sm.ha > /dev/null 2>&1
> + done
>
> ocf_log info "NFS server started"
> return $OCF_SUCCESS
> @@ -226,7 +232,7 @@
> check_binary ${OCF_RESKEY_nfs_init_script}
> check_binary ${OCF_RESKEY_nfs_notify_cmd}
>
> - if [ -z ${OCF_RESKEY_nfs_ip} ]; then
> + if [ x = x"${OCF_RESKEY_nfs_ip}" ]; then
> ocf_log err "nfs_ip not set"
> exit $OCF_ERR_CONFIGURED
> fi

Otherwise, I don't see any issues here. Good work!

Cheers,

Dejan

> _______________________________________________
> ha-wg-technical mailing list
> ha-wg-technical@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/ha-wg-technical

_______________________________________________
ha-wg-technical mailing list
ha-wg-technical@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/ha-wg-technical