[systemd-devel] Re-exec()ing services for 'systemctl restart' ?

Daniel P. Berrange berrange at redhat.com
Thu Aug 9 02:13:48 PDT 2012


On Wed, Aug 08, 2012 at 07:07:38PM +0200, Lennart Poettering wrote:
> On Mon, 06.08.12 16:52, Daniel P. Berrange (berrange at redhat.com) wrote:
> 
> > For libvirt, we (will soon) have a daemon (virtlockd) which maintains
> > exclusive fcntl() based locks on disk images/devices, on behalf of both
> > libvirtd and any running QEMU or LXC instances. This is a safety critical
> > daemon (hence separate from libvirtd), to the extent that if the daemon
> > stops / crashes, the entire host should be immediately fenced using a
> > kernel watchdog and/or hardware power control device.
> > 
> > We still want to be able to restart this daemon during RPM upgrades to
> > newer versions, but we can't use a normal stop+start sequence, because
> > that will loose locks for any active VMs. Thus the daemon has the ability
> > to re-exec() itself triggered by SIGUSR1, preserving its critical state.
> > I've read the manpages for .service, .exec, etc but I've not seen any
> > reference to changing config such that
> > 
> >   # systemctl restart virtdlockd.service
> > 
> > will simply send SIGUSR1 to the process, instead of stopping it and then
> > starting it again. Obviously I could make the RPM %post send SIGUSR1
> > directly and ignore systemctl, but that doesn't help admins who just
> > expect to use systemctl. So I want to know if there is a recommended
> > way to handle this kind of use case ?
> 
> This is fundamentally difficult to implement, simply because restarting
> a service also means that the services binding to it need restarting
> too. And the ordering of that gets impossible if the stop/start sequence
> is "atomic" because it is done internally in the service, and cannot be
> split into two steps that we can order freely against each other.
> 
> So, I fear we cannot really add this for you. As Kay suggested
> "systemctl kill" is probably your best choice here, or maybe "systemctl
> reload".

Ok, thanks for explaining the issues - I think I'll just use systemctl kill
for now.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


More information about the systemd-devel mailing list