Re: [libvirt] [PATCH v3] Add support for systemd init service

2011-11-16 Thread Daniel P. Berrange
On Tue, Nov 15, 2011 at 04:02:23PM -0700, Eric Blake wrote:
 On 11/15/2011 04:35 AM, Daniel P. Berrange wrote:
  From: Daniel P. Berrange berra...@redhat.com
  
  Followup to
  
https://www.redhat.com/archives/libvir-list/2011-November/msg00580.html
  
  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.
 
 Looks like you addressed all the v2 review comments.
 
 ACK with one nit:
 
  In v2:
  
   - Fix AC_MSG_HELP wrapping
   - Fix %makeinstall target
   - Explicitly handle 'none' for --with-initscript
   - Revert rename of libvirt-guests.sh
  
  +[AC_HELP_STRING([--with-init-script@:@=STYLE@:@],
  +[Style of init script to install: redhat, 
  systemd, systemd+redhat,
  + upstart, auto, none @:@default=auto@:@])])
  +init_redhat=no
  +init_systemd=no
  +case $with_init_script in
  +systemd+redhat)
  +   init_redhat=yes
  +   init_systemd=yes
  +   ;;
  +systemd)
  +   init_systemd=yes
  +   ;;
  +redhat)
  +   init_redhat=yes
  +   ;;
  +none)
  +   ;;
  +*)
 
 Where is upstart handled?  Without an explicit clause, you might be
 accidentally turning it into with_init_script=redhat.

Ha, I knew I was forgetting one bit. We have never had any rules to
actually install the upstart file before, we just included it as an
example. Time for a v3

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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


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

2011-11-15 Thread Daniel P. Berrange
From: Daniel P. Berrange berra...@redhat.com

Followup to

  https://www.redhat.com/archives/libvir-list/2011-November/msg00580.html

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.

The libvirt-guests.service is pretty lame, just exec'ing the
original init script for now. Ideally we would factor out the
functionality, into some shared tool.

Instead of

  ./configure --with-init-script=redhat

You can now do

  ./configure --with-init-script=systemd

Or better still:

  ./configure --with-init-script=systemd+redhat

* configure.ac: Add systemd, and systemd+redhat options to
  --with-init-script option
* daemon/Makefile.am: Install systemd services
* daemon/libvirtd.sysconf: Add note about unused env variable
  with systemd
* daemon/libvirtd.service.in: libvirtd systemd service unit
* libvirt.spec.in: Add scripts to installing systemd services
  and migrating from legacy init scripts
* tools/Makefile.am: Install systemd services
* tools/libvirt-guests.init.sh: Rename to tools/libvirt-guests.init.in
* tools/libvirt-guests.service.in: systemd service unit

In v2:

 - Fix AC_MSG_HELP wrapping
 - Fix %makeinstall target
 - Explicitly handle 'none' for --with-initscript
 - Revert rename of libvirt-guests.sh

---
 configure.ac|   37 +++
 daemon/.gitignore   |1 +
 daemon/Makefile.am  |   77 +++-
 daemon/libvirtd.service.in  |   20 
 daemon/libvirtd.sysconf |3 +
 libvirt.spec.in |   93 +-
 po/POTFILES.in  |2 +-
 tools/Makefile.am   |   61 -
 tools/libvirt-guests.service.in |   13 +
 9 files changed, 260 insertions(+), 47 deletions(-)
 create mode 100644 daemon/libvirtd.service.in
 create mode 100644 tools/libvirt-guests.service.in

diff --git a/configure.ac b/configure.ac
index 3b7535e..c663f7b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -329,16 +329,33 @@ dnl init script flavor
 dnl
 AC_MSG_CHECKING([for init script flavor])
 AC_ARG_WITH([init-script],
-[AC_HELP_STRING([--with-init-script=@:@redhat|auto|none@:@],
-[Style of init script to install @:@default=auto@:@])])
-if test x$with_init_script = x || test x$with_init_script = xauto; then
-if test $cross_compiling = yes || test ! -f /etc/redhat-release; then
-with_init_script=none
-else
-with_init_script=redhat
-fi
-fi
-AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_RED_HAT], test x$with_init_script = 
xredhat)
+[AC_HELP_STRING([--with-init-script@:@=STYLE@:@],
+[Style of init script to install: redhat, systemd, 
systemd+redhat,
+ upstart, auto, none @:@default=auto@:@])])
+init_redhat=no
+init_systemd=no
+case $with_init_script in
+systemd+redhat)
+   init_redhat=yes
+   init_systemd=yes
+   ;;
+systemd)
+   init_systemd=yes
+   ;;
+redhat)
+   init_redhat=yes
+   ;;
+none)
+   ;;
+*)
+   if test $cross_compiling != yes  test -f /etc/redhat-release; then
+  init_redhat=yes
+  with_init_script=redhat
+   fi
+   ;;
+esac
+AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_RED_HAT], test $init_redhat = yes)
+AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_SYSTEMD], test $init_systemd = yes)
 AC_MSG_RESULT($with_init_script)
 
 dnl RHEL-5 has a peculiar version of Xen, which requires some special casing
diff --git a/daemon/.gitignore b/daemon/.gitignore
index ab3d093..2873143 100644
--- a/daemon/.gitignore
+++ b/daemon/.gitignore
@@ -7,6 +7,7 @@ Makefile.in
 libvirt_qemud
 libvirtd
 libvirtd.init
+libvirtd.service
 libvirtd*.logrotate
 libvirtd.8
 libvirtd.8.in
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index e8c47ae..92b6b86 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -170,13 +170,14 @@ policyfile = libvirtd.policy-1
 endif
 endif
 
-install-data-local: install-init install-data-sasl install-data-polkit \
-   install-logrotate
+install-data-local: install-init install-systemd install-data-sasl 
install-data-polkit \
+   install-logrotate install-sysctl
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt
mkdir -p $(DESTDIR)$(localstatedir)/run/libvirt
mkdir -p $(DESTDIR)$(localstatedir)/lib/libvirt
 
-uninstall-local:: uninstall-init uninstall-data-sasl uninstall-data-polkit
+uninstall-local:: uninstall-init uninstall-systemd uninstall-data-sasl 
uninstall-data-polkit \
+ uninstall-sysctl
rmdir $(DESTDIR)$(localstatedir)/log/libvirt || :
rmdir $(DESTDIR)$(localstatedir)/run/libvirt || :
rmdir $(DESTDIR)$(localstatedir)/lib/libvirt || :
@@ -234,25 +235,56 @@ install-logrotate: 

Re: [libvirt] [PATCH v3] Add support for systemd init service

2011-11-15 Thread Eric Blake
On 11/15/2011 04:35 AM, Daniel P. Berrange wrote:
 From: Daniel P. Berrange berra...@redhat.com
 
 Followup to
 
   https://www.redhat.com/archives/libvir-list/2011-November/msg00580.html
 
 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.

Looks like you addressed all the v2 review comments.

ACK with one nit:

 In v2:
 
  - Fix AC_MSG_HELP wrapping
  - Fix %makeinstall target
  - Explicitly handle 'none' for --with-initscript
  - Revert rename of libvirt-guests.sh
 
 +[AC_HELP_STRING([--with-init-script@:@=STYLE@:@],
 +[Style of init script to install: redhat, 
 systemd, systemd+redhat,
 + upstart, auto, none @:@default=auto@:@])])
 +init_redhat=no
 +init_systemd=no
 +case $with_init_script in
 +systemd+redhat)
 +   init_redhat=yes
 +   init_systemd=yes
 +   ;;
 +systemd)
 +   init_systemd=yes
 +   ;;
 +redhat)
 +   init_redhat=yes
 +   ;;
 +none)
 +   ;;
 +*)

Where is upstart handled?  Without an explicit clause, you might be
accidentally turning it into with_init_script=redhat.

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list