[libvirt] [PATCH v5] Add support for systemd init service

Daniel P. Berrange berrange at redhat.com
Fri Nov 18 10:46:07 UTC 2011


On Wed, Nov 16, 2011 at 07:23:51PM -0500, Laine Stump wrote:
> On 11/16/2011 09:20 AM, Daniel P. Berrange wrote:
> >From: "Daniel P. Berrange"<berrange at redhat.com>
> >
> >This patch adds support for a systemd init service for libvirtd
> >and libvirt-guests. The libvirtd.service is *not* written to use
> >socket activation, since we want libvirtd to start on boot so it
> >can do guest auto-start.
> 
> Dang! I guess I have to do this for the transaction rollback
> initscript in netcf. Any advice / pointers to docs other than "read
> my patch and do what I did"?? :-)

Read my patch and do what I did ;-P

More seriously though, the netcf transaction script needs are pretty
similar to the libvirt-guests script.

If I'm honest, the way I handled the libvirt-guest script here is
kind of lame, and the minimum possible work.

I basically left the libvirt-guests script in /etc/init.d and just
wrote a systemd service to directly invoke it.

Really the way the libvirt-guests script is written in the first
place was wrong. We should never have had all the functionality
in the initscript in the first place. The save/restore-all-guests
code should have been in a proper support command in /usr/bin (or
/usr/sbin), with a name like  virt-guest-lifecycle or something
less stupid. THe initscript should then have merely invoked that
command with a shutdown/startup arg.

So for netcf, I would suggest the same idea. Create a new command
/usr/sbin/netcf-transaction to contain all the actual business
logic. Then just make your initscript invoke that. Now you can
trivially also create a systemd service to invoke that.

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 libvir-list mailing list