[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] PATCH: Write pidfile earlier in startup

On Fri, May 16, 2008 at 05:39:46PM +0100, Daniel P. Berrange wrote:
> On Fri, May 16, 2008 at 05:05:08PM +0100, Daniel P. Berrange wrote:
> > When used with the --daemon arg, libvirtd will write out a pid file to
> > /var/run/libvirtd.pid and exit if this file already exists. Unfortuantely
> > it does this quite late in its startup procedure - in particular *after*
> > the call to qemudInitialize(), which in turns initializes the drivers,
> > which in turn autostarts all the VMs and networks.
> > 
> > So if you start a 2nd libvirtd instance it would do autostart before it
> > got to checking for existing PID file. This is clearly very bad because
> > the same VM would be started twice resulting in data corruption. Fortunately
> > the Red Hat / Fedora initscript also checks the PID file before even starting
> > the daemon, but this can affect people starting the daemon directly.
> > 
> > So this patch makes the goDaemon() / pidfile creation the very first thing
> > the daemon does after parsing command line arguments. This also results in
> > greatly increased startup time for OS, since the initscript doesn't have
> > to wait for it to auto-start all the VMs & networks before it daemonizes.
> > It also initializes the signal handlers before calling qemudInitialize()
> > since these really need to be setup before we start any VMs / child procs.
> There were actually some more changes needed. It needs to write the PID file
> even if not running with --daemon mode to be truely safe, because some
> init software won't run it in daemon mode at all. So this updated patch will
> always write a PID file if run as root.  It also fixes a few flaws in the
> cleanup process to ensure it only unlinks the pidfile on failure if it owned
> the pidfile, and removes a pointless warning when running non-root.

  Yes this is a serious problem, patch looks fine, +1


Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]