On Thu, Mar 18, 2010 at 09:53:58AM +0100, Andrew Beekhof wrote: > On Wed, Mar 17, 2010 at 11:35 AM, Marian Marinov <[email protected]> wrote: > > On Wednesday 17 March 2010 12:16:58 Andreas Mock wrote: > >> Hi all, > >> > >> here some questions regarding programming ocf-ra: > >> > >> a) Am I right that programming a RA as portable shell script (no bashisms) > >> is preferred? Or are other (scripting) languages also welcome? > > I'm confident that no bashisms are allowed... this made me rewrite a lot of > > things in the mysql RA. I don't think that other scripting languages are > > allowed, but maybe Dejan can answer better here. > > Bashisms are allowed, _provided_ you require /bin/bash instead of /bin/sh
Yes. The reason bash specifics were explicitly rejected for mysql was that it has already been /bin/sh, so changing to /bin/bash would be a regression. > However, if something can be done without bash, its usually best to avoid it. bash specific stuff tends to be arcane and may always be expressed in another, more clear way. Maintenance is important and not that many people understand funny bash constructs. That'd include me which also counts :) > Also any language can be used for the agents, we even have ones in C. Yes, any language would do, but UNIX shell seems to be most versatile for the task. I'm not sure if there are any non-shell LSB init scripts. > >> b) I found RA scripts for daemons where the 'status' call checks for the > >> existence of the daemon pid file and if that file is not there > >> $OCF_NOT_RUNNING is returned. > > Ideally it should also look for running processes. > But if its possible to have multiple copies of the process, it can be > non-trivial to match a running process to a particular cluster > resource. The problem is sometimes pid files are removed and then the RA may behave in a very bad way if it depends on the pid file. Recently there was a case that even the stop action failed which made the cluster fence the node. > >> As all the cluster guys out there should be > >> very pessimistic by default, I'm asking myself if this kind of check is > >> really enough. On the one hand side much efford is taken to be REALLY sure > >> that a ressource isn't alive anymore (fencing, STONITH) and on the other > >> side the simple nonexistence of a file seems to be enough to assume (!) > >> the relevant process isn't alive anymore. > >> > >> What are you thinking about that? > > > > I don't really agree here. You are right that a missing pidfile is not > > enough. > > However, it is required that a service is started with the RA for it. And it > > is required that this RA or the Services handles the creation of the > > pidfile. > > > > The idea is that you are depending on the same RA to check and verify if the > > pidfile was created during the startup and this is way you depend on this > > pid > > file. > > > > If you don't start your service from the RA then it is your problem and not > > the RA. > > > > My point is that one should verify the pidfile after starting and do not > > mark > > as started/running a service with a wrong or missing pidfile. This way we > > will > > skip more useless checks. > > > > Best regards, > > Marian > > > >> c) If you agree with me, that a explicit check for a running process would > >> be more reliable, my next question is: Does anyone know how this can be > >> done in a shell script in a portable and reliable manner? (e.g. ps ax with > >> grep) Yes, ps -ef | grep [p]rocess should do. [p] is a trick not to match the grep process itself. pgrep is also fine. Though there should be a way for the RA to find out which process belongs to the instance. Cheers, Dejan > >> I found that 'ocf_pidfile_status' in .ocf-shellfuncs encapsulates a part of > >> the required tests. > >> > >> Awaiting your comments and suggestions? > >> > >> Best regards > >> Andreas Mock > >> _______________________________________________ > >> Linux-HA mailing list > >> [email protected] > >> http://lists.linux-ha.org/mailman/listinfo/linux-ha > >> See also: http://linux-ha.org/ReportingProblems > >> > > > > -- > > Best regards, > > Marian Marinov > > > > _______________________________________________ > > 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 _______________________________________________ Linux-HA mailing list [email protected] http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
