[Ovirt-devel] [PATCH] wrappers for taskomatic.rb and host-status.rb

Daniel P. Berrange berrange at redhat.com
Thu May 1 22:56:38 UTC 2008


On Thu, May 01, 2008 at 05:37:04PM -0500, steve linabery wrote:
> Hi Ovirt!
> 
> taskomatic.rb and host-status.rb were becoming daemons by using
> "Daemons.daemonize".
> 
> This had the unfortunate effect of detaching them from any controlling
> terminal, and so using killproc in /etc/init.d/ovirt-wui was *not*
> killing them. I noticed that after repeated 'service ovirt-wui
> restart', I had many stray taskomatic & host-status processes, all
> making connections to postgresql, and sending my appliance way into
> swap.
> 
> So this patch:
> 0) renames taskomatic.rb and host-status.rb to taskomatic_.rb and
> host-status_.rb, respectively.
> 1) replaces taskomatic.rb and host-status.rb with wrapper scripts for
> taskomatic_.rb and host-status_.rb. The wrappers use the
> "Daemons.run(script,options)" method instead of Daemons.daemonize.
> 2) edits /etc/init.d/ovirt-wui to invoke 'taskomatic.rb start' and
> 'taskomatic.rb stop' (same for host-status.rb) instead of the
> initscript functions daemon and killproc.

This is not really a good idea.

The decision about how/if to daemonize belows to the initscripts. In 
SysV init this is daemon/killproc. In the new Upstart world, it doesn't
daemonize at all - it keeps ownership of the process so it can detect 
death & restart.  

Xen used to follow the approach of your patch too and we just spent
time ripping out all that code and making it used daemon/killproc
correctly in the initscripts in F10.

The simpler way around this problem would have just been to change the
existing initscript to pass '-n' when starting the programs so that
the Daemons.daemonize() call was skipped - it was redundant when running
the program via the 'daemon' shell command. And figuring out whatever  is
needed to make killproc work correctly.

The existing initscript also really needs to be split up so that there is
one initscript per daemon that ovirt has.

Dan.
-- 
|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the ovirt-devel mailing list