Hi Ulrich, On Tue, Sep 09, 2014 at 04:20:47PM +0200, Ulrich Windl wrote: > Hi! > > Here's my patch I did today to the ping RA of pacemaker (current version fro > mSLES11 SP3). Basically I wanted the RA to use ping even if fping is found on > the system. Anyway, here it is (edited, because ist on of 14 patches, all > tabs expanded to spaces through copy from PuTTY and paste to Windows):
Ugh :-/ > --- > From 63f5d42d316f562a8c8ebc4bed6dff4859a9fc57 Mon Sep 17 00:00:00 2001 > From: Ulrich Windl <[email protected]> > Date: Tue, 9 Sep 2014 15:26:33 +0200 > Subject: [PATCH 1/1] Changed ping from pacemaker (SLES11 SP3) > > Change ping: The following should be split into three patches: > Parameter "pidfile" is "unique" now. Improve description of > "dampen" parameter. Indicate the correct default for "multiplier" and > "attempts". Fix output of ping_usage(). 1. meta-data and usage fixes > Add parameter "flavor" to select ping or fping. 2. Add the "flavor" option > Use options also for fping. 3. Options apply to fping too. Could you do that? Then you can either post the patches here or, preferable, open a pull request at github.com. If former, I'll open a pull request for you. Nowadays people tend to look only at github for patches :-| Many thanks for the contribution! Cheers, Dejan > --- > ping | 27 +- > > diff --git a/ping b/ping > index b9a69b8..adb7682 100755 > --- a/ping > +++ b/ping > @@ -40,7 +40,7 @@ meta_data() { > <?xml version="1.0"?> > <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd"> > <resource-agent name="ping"> > -<version>1.0</version> > +<version>1.1</version> > > <longdesc lang="en"> > Every time the monitor action is run, this resource agent records (in the > CIB) the current number of ping nodes the host can connect to. > @@ -50,7 +50,7 @@ It is essentially the same as pingd except that it uses the > system ping tool to > > <parameters> > > -<parameter name="pidfile" unique="0"> > +<parameter name="pidfile" unique="1"> > <longdesc lang="en">PID file</longdesc> > <shortdesc lang="en">PID file</shortdesc> > <content type="string" default="$HA_VARRUN/ping-${OCF_RESOURCE_INSTANCE}" /> > @@ -58,7 +58,7 @@ It is essentially the same as pingd except that it uses the > system ping tool to > > <parameter name="dampen" unique="0"> > <longdesc lang="en"> > -The time to wait (dampening) further changes occur > +The time to wait for further changes to occur > </longdesc> > <shortdesc lang="en">Dampening interval</shortdesc> > <content type="integer" default="5s"/> > @@ -77,7 +77,7 @@ The name of the attributes to set. This is the name to be > used in the constrain > The number by which to multiply the number of connected ping nodes by > </longdesc> > <shortdesc lang="en">Value multiplier</shortdesc> > -<content type="integer" default=""/> > +<content type="integer" default="1"/> > </parameter> > > <parameter name="host_list" unique="0" required="1"> > @@ -93,7 +93,7 @@ The list of ping nodes to count. > Number of ping attempts, per host, before declaring it dead > </longdesc> > <shortdesc lang="en">no. of ping attempts</shortdesc> > -<content type="integer" default="2"/> > +<content type="integer" default="3"/> > </parameter> > > <parameter name="timeout" unique="0"> > @@ -104,6 +104,14 @@ How long, in seconds, to wait before declaring a ping > lost > <content type="integer" default="2"/> > </parameter> > > +<parameter name="flavor" unique="0"> > +<longdesc lang="en"> > +Decides which ping to use: ping or fping? If not set fping will be used if > found; otherwise ping will be used. > +</longdesc> > +<shortdesc lang="en">Which ping</shortdesc> > +<content type="string" default=""/> > +</parameter> > + > <parameter name="options" unique="0"> > <longdesc lang="en"> > A catch all for any other options that need to be passed to ping. > @@ -154,7 +162,7 @@ ping_conditional_log() { > > ping_usage() { > cat <<END > -usage: $0 {start|stop|monitor|migrate_to|migrate_from|validate-all|meta-data} > +usage: $0 {start|stop|reload|monitor|meta-data|validate-all} > > Expects to have a fully populated OCF RA-compliant environment set. > END > @@ -171,7 +179,7 @@ ping_start() { > > ping_stop() { > > - rm -f ${OCF_RESKEY_pidfile} > + rm -f ${OCF_RESKEY_pidfile} > > attrd_updater -D -n $OCF_RESKEY_name -d $OCF_RESKEY_dampen $attrd_options > > @@ -225,7 +233,7 @@ fping_check() { > n=$OCF_RESKEY_attempts > timeout=`expr $OCF_RESKEY_timeout \* 1000 / $OCF_RESKEY_attempts` > > - cmd="fping -r $OCF_RESKEY_attempts -t $timeout -B 1.0 > $OCF_RESKEY_host_list" > + cmd="fping -r $OCF_RESKEY_attempts -t $timeout -B 1.0 > $OCF_RESKEY_options $OCF_RESKEY_host_list" > $cmd>$f_out 2>$f_err; rc=$? > active=`grep alive $f_out|wc -l` > > @@ -274,7 +282,7 @@ ping_check() { > > ping_update() { > > - if have_binary fping; then > + if [ X"$OCF_RESKEY_flavor" != Xping ] && have_binary fping; then > fping_check > active=$? > else > @@ -373,4 +381,3 @@ usage|help) ping_usage > ;; > esac > exit $? > - > -- > 1.7.12.4 > --- > > Regards, > Ulrich > > _______________________________________________ > Linux-HA mailing list > [email protected] > http://lists.linux-ha.org/mailman/listinfo/linux-ha > See also: http://linux-ha.org/ReportingProblems _______________________________________________ Linux-HA mailing list [email protected] http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
