[Linux-ha-dev] OCF RA for rsync daemon Active-Passive setup

Oza Dhairesh odhairesh at novell.com
Fri Oct 27 08:39:52 MDT 2006


Hi,

   Lars, David, Thomas thanks a lot for the comments. I was under the
naive impression that only 1 instance of rsync daemon can be started!
Lars' comment on other users being able to start it if port is greater
that 1024 made me see my error. So I totally agree with the comments in
this directions. I am working on the changes and have few doubts: 

>> +HA_VARRUNDIR=@localstatedir@/run/@HB_PKG@
>> +PIDFILE=$HA_VARRUNDIR/rsctmp/rsyncd.pid
> 
> The hard-  coded pidfile allows only for a single rsyncd instance to
be
> running on any given node. This isn't acceptable; you might as well
just
> use an LSB init script then.
> 
> Other snippets in the code also assume just one rsyncd process to be
> active, which isn't good. (I'll point them out below.)
> 
> When you look at man rsyncd.conf, you'll find that rsyncd has an
> _option_ for writing the pidfile itself -   you should extract this
file
> name from the conffile, and then use that, instead of trying to
generate
> a pid file yourself, which is likely to break.
> 

If the PID file is mentioned in the config file, I can pick it up from
there. But what should I do in case it is not mentioned?
a) edit the conf file in the RA script to add an entry (In which case,
on stopping I have to remove this line also)
b) don't edit the conf file, but create a pid file in the script, like
I did here, but the pid file can be unique by using
$OCF_RESOURCE_INSTANCE. (as Lars mentioned this is likely to break)
c) refuse to start and print an error stating that PID file entry is
mandatory for the RA to work. (also check this in validate-all) 

Any suggestions on this?

>> +rsyncd_validate_all()
>> +{
>> +	if [ -  n "$OCF_RESKEY_binpath" -  a -  f "$OCF_RESKEY_binpath"
] 
>> +	then
>> +		ocf_log err "Binary path $OCF_RESKEY_binpath does not
exist."
>> +		exit $OCF_ERR_ARGS
>> +	fi
> 
> You don't want just -  f, you want -  x.
> 
>> +	if [ -  n "$OCF_RESKEY_conffile" -  a -  f
"$OCF_RESKEY_conffile" ]
>> +	then
>> +		ocf_log err "Config file $OCF_RESKEY_conffile does not
exist."
>> +		exit $OCF_ERR_ARGS
>> +		
>> +	fi
> 
> Besides, both checks are wrong. Your own "start" function defaults
these
> two values, so the script will work fine even when they are not set.

Here I should check if these values are set, and if they aren't
correct, then it should return error no? So this it should be:

if [ -  n "$OCF_RESKEY_conffile" -  a ! -  f "$OCF_RESKEY_conffile" ]
then
	ocf_log err "Config file $OCF_RESKEY_conffile does not exist."
	exit $OCF_ERR_ARGS
fi

for the correct behavior. Right? 

Once again thanks for all the feedback.

Oza




More information about the Linux-HA-Dev mailing list