[Pacemaker] Pure-FTPd resource script is wrong (at least on ubuntu and probably debian)
Mailing List SVR
lists at svrinformatica.it
Thu Nov 10 17:40:21 UTC 2011
Il 10/11/2011 16:30, Dejan Muhamedagic ha scritto:
> On Tue, Nov 08, 2011 at 07:24:48PM +0100, Mailing List SVR wrote:
>> Il 08/11/2011 16:30, Dejan Muhamedagic ha scritto:
>>> Hi,
>>>
>>> On Mon, Nov 07, 2011 at 06:48:22PM +0100, Mailing List SVR wrote:
>>>> Hi,
>>>>
>>>> thanks for your answer
>>>>
>>>> Il 07/11/2011 18:27, Dejan Muhamedagic ha scritto:
>>>>> Hi,
>>>>>
>>>>> On Sat, Nov 05, 2011 at 10:26:12PM +0100, Mailing List SVR wrote:
>>>>>> Hi,
>>>>>>
>>>>>> the script doesn't create the pid file directory if missing and so
>>>>> None of the resource agents does that. Anyway, it needs to be
>>>>> created just once per node and arguably it should be part of
>>>>> deployment.
>>>> /var/run is a tmpfs so is cleaned every time you reboot the server, are
>>>> you suggesting to do that in rc.local?
>>> So directories are also removed on reboot. That wasn't the case
>>> before, but I can now vaguelly recall that there was sometimes a
>>> switch to tmpfs in some distributions. At any rate,
>>> /etc/init.d/{corosync,heartbeat} should create the HA_RSCTMP
>>> directory on start.
>>>
>>>>> Note that the default pidfile directory (shared by
>>>>> all agents) should be created by the init script (IIRC).
>>>> please note that pure-ftpd on debian/ubuntu has the pid hardcoded to
>>>>
>>>> /var/run/pure-ftpd/pure-ftpd.pid
>>> Hardcoded in the RA?
>> no hardcoded in pure-ftpd package,
> So, how can that influence the operation of the RA? Or are we
> talking here about the init script?
Sorry my english is so bad that probably you can understand what I mean
and evidently you not tested the RA script on debian/ubuntu. I'll try to
explain by examples:
1) I have this primitive:
primitive ftp_service ocf:heartbeat:Pure-FTPd \
params script="/usr/sbin/pure-ftpd-wrapper"
daemon_type="postgresql" pidfile="/var/run/pure-ftpd/pure-ftpd.pid" \
op monitor interval="40s" timeout="20s" \
op start interval="0" timeout="20s" \
op stop interval="0" timeout="20s"
please note that I'm passing pidfile parameter to the RA script and that
on debian/ubuntu pidfile is hardcoded to
"/var/run/pure-ftpd/pure-ftpd.pid" so this is the only available choice
the directory /var/run/pure-ftpd is deleted every time I reboot the
server and I don't like to create it in rc.local
2) pacemaker start pure-ftpd using the RA script, the ftp server starts
but the pid file is not created since the directory /var/run/pure-ftpd
is missing (without the modification I suggest)
3) the "status" fuction on the RA script fails since the pid file does
not exists and try to start pure-ftpd again
4) pure-ftpd is already started and the new start fails (the ftp port is
already in use by the previous launched instance) and so on for ever
The point is that I'm passing the pidfile location to the RA script,
since standard pid location is tmpfs on all major distro the ra script
could simply create the pid directory if missing and avoid this problem,
I hope this explainaition is clear enough,
Nicola
>
>> I think that as general rule if a user specify a pidfile the start
>> script should check if the pid dir exists since the pid are generally
>> stored in tmpfs
>>
>>> Then it differs from upstream (which is a
>>> parameter):
>>>
>>> : ${OCF_RESKEY_pidfile="${HA_RSCTMP}/pure-ftpd-${OCF_RESOURCE_INSTANCE}.pid"}
>>>
>>> Note that this default also supports multiple ftpd resources.
>>> It's also a very common pidfile business (many RAs use the same
>>> naming scheme).
>>>
>>>> and in general if a resource script accept a pidfile as configuration
>>>> parameters should try to create the directory if missing.
>>>>
>>>> Anyway is a fact that this resource script doesn't work on debian/ubuntu
>>>> and the modify I sent solve the problem, please suggest a better
>>>> approach if it is wrong (this is the first time I'm using resource
>>>> scripts so maybe I'm missing something)
>>> All RA should work out of the box if properly configured. But I
>>> wonder why it didn't work for you. It would be best to involve
>>> your distribution maintainer.
>> yes I can do so, but consider that debian/ubuntu init scripts are not
>> yet lsb compliant, try:
>>
>> <initscript> status
>>
>> with the service not running you'll see exit code 4 and not 3, there are
>> bugs open since years for this issue and not yet resolved ... and
>> pure-ftpd is in universe ... I think I have few possibilities to see a
>> fix from debian/ubuntu ... I can recompile pure-ftpd or patch RA script,
>> the second is easy.
>>
>> I think the fix I proposed can only improve RA scripts in general,
>> however I can survive with a local modification if you don't agree
> But we're running in circles, I still don't understand how comes
> that the directory you need created is /var/run/pure-ftpd, when
> it should've been /var/run/resource-agents. Which one is it?
> In case it was the latter, then that directory should have
> existed.
>
> Thanks,
>
> Dejan
>
>> thanks anyway,
>>
>> Nicola
>>
>>
>>> Cheers,
>>>
>>> Dejan
>>>
>>>> thanks
>>>> Nicola
>>>>
>>>>> Thanks,
>>>>>
>>>>> Dejan
>>>>>
>>>>>> pure-ftpd starts but no pidfile is created and the motion function fails
>>>>>> and try top start pure-ftpd again but this time the address is already
>>>>>> in use and so on,
>>>>>>
>>>>>> must be added something like this before start pure-ftpd:
>>>>>>
>>>>>> if [ ! -e `dirname $PIDFILE` ];then
>>>>>> mkdir `dirname $PIDFILE`
>>>>>> fi
>>>>>>
>>>>>> please apply,
>>>>>>
>>>>>> thanks
>>>>>> Nicola
>>>>>>
>>>>>> P.S. I'm testing on ubuntu 11.10, note also that on ubuntu 11.10 seems
>>>>>> the pid is hardcoded to /var/run/pure-ftpd/pure-ftpd.pid
>>>>>>
>>>>>> _______________________________________________
>>>>>> Pacemaker mailing list:Pacemaker at oss.clusterlabs.org
>>>>>> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>>>>>>
>>>>>> Project Home:http://www.clusterlabs.org
>>>>>> Getting started:http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>>>>> Bugs:http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker
>>> _______________________________________________
>>> Pacemaker mailing list:Pacemaker at oss.clusterlabs.org
>>> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>>>
>>> Project Home:http://www.clusterlabs.org
>>> Getting started:http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>> Bugs:http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker
>>>
>>
>>
>> _______________________________________________
>> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
>> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>>
>> Project Home: http://www.clusterlabs.org
>> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>> Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker
More information about the Pacemaker
mailing list