]> xenbits.xensource.com Git - libvirt.git/commitdiff
daemon: move init system files into src/remote/
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 20 Feb 2018 17:41:45 +0000 (17:41 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 22 Feb 2018 12:21:21 +0000 (12:21 +0000)
Move the systemd, sysvinit, upstart and sysconfig files into the
src/remote/ directory.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
13 files changed:
.gitignore
daemon/Makefile.am
daemon/libvirtd.init.in [deleted file]
daemon/libvirtd.service.in [deleted file]
daemon/libvirtd.sysconf [deleted file]
daemon/libvirtd.upstart [deleted file]
daemon/virt-guest-shutdown.target [deleted file]
src/Makefile.am
src/remote/libvirtd.init.in [new file with mode: 0644]
src/remote/libvirtd.service.in [new file with mode: 0644]
src/remote/libvirtd.sysconf [new file with mode: 0644]
src/remote/libvirtd.upstart [new file with mode: 0644]
src/remote/virt-guest-shutdown.target.in [new file with mode: 0644]

index 0f8446faa0d3b299f20b6f1314d0ad3faa12a520..845fcfea640855c89df044cc26c672f4862bb3de 100644 (file)
 /src/virt-aa-helper
 /src/virtlockd
 /src/virtlogd
+/src/virt-guest-shutdown.target
 /tests/*.log
 /tests/*.pid
 /tests/*.trs
index 88a026e56a98f1a62603446c040df44914a23cd9..d76c4b24bdb653d7ee5337ad0ad0b24a6e10f2cd 100644 (file)
@@ -21,14 +21,9 @@ CLEANFILES =
 DISTCLEANFILES =
 EXTRA_DIST = \
        libvirtd.conf \
-       libvirtd.init.in \
-       libvirtd.upstart \
        libvirtd.policy.in \
        libvirt.rules \
        libvirtd.sasl \
-       libvirtd.service.in \
-       virt-guest-shutdown.target \
-       libvirtd.sysconf \
        libvirtd.sysctl \
        libvirtd.aug \
        libvirtd.logrotate.in \
@@ -73,17 +68,13 @@ libvirtd.policy: libvirtd.policy.in $(top_builddir)/config.status
        mv $@-t $@
 BUILT_SOURCES += libvirtd.policy
 
-install-data-local: install-init-redhat install-init-systemd \
-               install-init-upstart \
-               install-data-sasl install-data-polkit \
+install-data-local: install-data-sasl install-data-polkit \
                install-logrotate install-sysctl
        $(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt \
                   $(DESTDIR)$(localstatedir)/run/libvirt \
                   $(DESTDIR)$(localstatedir)/lib/libvirt
 
-uninstall-local:: uninstall-init-redhat uninstall-init-systemd \
-               uninstall-init-upstart \
-               uninstall-data-sasl uninstall-data-polkit \
+uninstall-local:: uninstall-data-sasl uninstall-data-polkit \
                uninstall-logrotate uninstall-sysctl
        rmdir $(DESTDIR)$(localstatedir)/log/libvirt || :
        rmdir $(DESTDIR)$(localstatedir)/run/libvirt || :
@@ -174,14 +165,6 @@ uninstall-logrotate:
        rmdir $(DESTDIR)$(localstatedir)/log/libvirt/uml || :
        rmdir $(DESTDIR)$(sysconfdir)/logrotate.d || :
 
-install-sysconfig:
-       $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
-       $(INSTALL_DATA) $(srcdir)/libvirtd.sysconf \
-         $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
-uninstall-sysconfig:
-       rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
-       rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
-
 if WITH_SYSCTL
 # Use $(prefix)/lib rather than $(libdir), since man sysctl.d insists on
 # /usr/lib/sysctl.d/ even when libdir is /usr/lib64
@@ -198,79 +181,6 @@ install-sysctl:
 uninstall-sysctl:
 endif ! WITH_SYSCTL
 
-if LIBVIRT_INIT_SCRIPT_RED_HAT
-
-BUILT_SOURCES += libvirtd.init
-
-install-init-redhat: install-sysconfig libvirtd.init
-       $(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
-       $(INSTALL_SCRIPT) libvirtd.init \
-         $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd
-
-uninstall-init-redhat: uninstall-sysconfig
-       rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd
-       rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d || :
-else ! LIBVIRT_INIT_SCRIPT_RED_HAT
-install-init-redhat:
-uninstall-init-redhat:
-endif ! LIBVIRT_INIT_SCRIPT_RED_HAT
-
-
-if LIBVIRT_INIT_SCRIPT_UPSTART
-
-install-init-upstart: install-sysconfig
-       $(MKDIR_P) $(DESTDIR)$(sysconfdir)/event.d
-       $(INSTALL_SCRIPT) libvirtd.upstart \
-         $(DESTDIR)$(sysconfdir)/event.d/libvirtd
-
-uninstall-init-upstart: uninstall-sysconfig
-       rm -f $(DESTDIR)$(sysconfdir)/event.d/libvirtd
-       rmdir $(DESTDIR)$(sysconfdir)/event.d || :
-else ! LIBVIRT_INIT_SCRIPT_UPSTART
-install-init-upstart:
-uninstall-init-upstart:
-endif ! LIBVIRT_INIT_SCRIPT_UPSTART
-
-
-if LIBVIRT_INIT_SCRIPT_SYSTEMD
-
-SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
-BUILT_SOURCES += libvirtd.service
-
-install-init-systemd: install-sysconfig libvirtd.service
-       $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
-       $(INSTALL_DATA) libvirtd.service \
-         $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service
-       $(INSTALL_DATA) $(srcdir)/virt-guest-shutdown.target \
-         $(DESTDIR)$(SYSTEMD_UNIT_DIR)/virt-guest-shutdown.target
-
-uninstall-init-systemd: uninstall-sysconfig
-       rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/virt-guest-shutdown.target
-       rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service
-       rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
-else ! LIBVIRT_INIT_SCRIPT_SYSTEMD
-install-init-systemd:
-uninstall-init-systemd:
-endif ! LIBVIRT_INIT_SCRIPT_SYSTEMD
-
-libvirtd.init: libvirtd.init.in $(top_builddir)/config.status
-       $(AM_V_GEN)sed \
-           -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
-           -e 's|[@]sbindir[@]|$(sbindir)|g' \
-           -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
-           < $< > $@-t && \
-           chmod a+x $@-t && \
-           mv $@-t $@
-
-libvirtd.service: libvirtd.service.in $(top_builddir)/config.status
-       $(AM_V_GEN)sed \
-           -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
-           -e 's|[@]sbindir[@]|$(sbindir)|g' \
-           -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
-           < $< > $@-t && \
-           mv $@-t $@
-
-
 check-local: check-augeas
 
 AUG_GENTEST = $(PERL) $(top_srcdir)/build-aux/augeas-gentest.pl
diff --git a/daemon/libvirtd.init.in b/daemon/libvirtd.init.in
deleted file mode 100644 (file)
index d81dca6..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/bin/sh
-
-# the following is the LSB init header see
-# http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
-#
-### BEGIN INIT INFO
-# Provides: libvirtd
-# Default-Start: 3 4 5
-# Default-Stop: 0 1 2 6
-# Required-Start: $network messagebus virtlogd
-# Required-Stop: $network messagebus
-# Should-Start: $named xend avahi-daemon virtlockd
-# Should-Stop: $named
-# Short-Description: daemon for libvirt virtualization API
-# Description: This is a daemon for managing guest instances
-#              and libvirt virtual networks
-#              See https://libvirt.org
-### END INIT INFO
-
-# the following is chkconfig init header
-#
-# libvirtd:   guest and virtual network management daemon
-#
-# chkconfig: 345 97 03
-# description:  This is a daemon for managing guest instances \
-#               and libvirt virtual networks \
-#               See https://libvirt.org
-#
-# processname: libvirtd
-# pidfile: @localstatedir@/run/libvirtd.pid
-#
-
-# Source function library.
-. @sysconfdir@/rc.d/init.d/functions
-
-SERVICE=libvirtd
-PROCESS=libvirtd
-PIDFILE=@localstatedir@/run/$SERVICE.pid
-
-LIBVIRTD_CONFIG=
-LIBVIRTD_ARGS=
-KRB5_KTNAME=/etc/libvirt/krb5.tab
-
-test -f @sysconfdir@/sysconfig/libvirtd && . @sysconfdir@/sysconfig/libvirtd
-
-export QEMU_AUDIO_DRV
-export SDL_AUDIODRIVER
-
-LIBVIRTD_CONFIG_ARGS=
-if [ -n "$LIBVIRTD_CONFIG" ]
-then
-    LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
-fi
-
-RETVAL=0
-
-start() {
-    echo -n $"Starting $SERVICE daemon: "
-    mkdir -p @localstatedir@/cache/libvirt
-    rm -rf @localstatedir@/cache/libvirt/*
-
-    # LIBVIRTD_NOFILES_LIMIT from /etc/sysconfig/libvirtd is not handled
-    # automatically
-    if [ -n "$LIBVIRTD_NOFILES_LIMIT" ]; then
-        ulimit -n "$LIBVIRTD_NOFILES_LIMIT"
-    fi
-
-    KRB5_KTNAME=$KRB5_KTNAME daemon --pidfile $PIDFILE --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
-    RETVAL=$?
-    echo
-    [ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$SERVICE
-}
-
-stop() {
-    echo -n $"Stopping $SERVICE daemon: "
-
-    killproc -p $PIDFILE $PROCESS
-    RETVAL=$?
-    echo
-    if [ $RETVAL -eq 0 ]; then
-        rm -f @localstatedir@/lock/subsys/$SERVICE
-        rm -rf @localstatedir@/cache/libvirt/*
-    else
-        exit $RETVAL
-    fi
-}
-
-restart() {
-    stop
-    start
-}
-
-reload() {
-    echo -n $"Reloading $SERVICE configuration: "
-
-    killproc -p $PIDFILE $PROCESS -HUP
-    RETVAL=$?
-    echo
-    return $RETVAL
-}
-
-# See how we were called.
-case "$1" in
-    start|stop|restart|reload)
-        $1
-        ;;
-    status)
-        status -p $PIDFILE $PROCESS
-        RETVAL=$?
-        ;;
-    force-reload)
-        reload
-        ;;
-    condrestart|try-restart)
-        [ -f @localstatedir@/lock/subsys/$SERVICE ] && restart || :
-        ;;
-    *)
-        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload|try-restart}"
-        exit 2
-        ;;
-esac
-exit $RETVAL
diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
deleted file mode 100644 (file)
index 769702e..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# NB we don't use socket activation. When libvirtd starts it will
-# spawn any virtual machines registered for autostart. We want this
-# to occur on every boot, regardless of whether any client connects
-# to a socket. Thus socket activation doesn't have any benefit
-
-[Unit]
-Description=Virtualization daemon
-Requires=virtlogd.socket
-Requires=virtlockd.socket
-Wants=systemd-machined.service
-Before=libvirt-guests.service
-After=network.target
-After=dbus.service
-After=iscsid.service
-After=apparmor.service
-After=local-fs.target
-After=remote-fs.target
-After=systemd-machined.service
-Documentation=man:libvirtd(8)
-Documentation=https://libvirt.org
-
-[Service]
-Type=notify
-EnvironmentFile=-/etc/sysconfig/libvirtd
-ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
-ExecReload=/bin/kill -HUP $MAINPID
-KillMode=process
-Restart=on-failure
-# At least 1 FD per guest, often 2 (eg qemu monitor + qemu agent).
-# eg if we want to support 4096 guests, we'll typically need 8192 FDs
-# If changing this, also consider virtlogd.service & virtlockd.service
-# limits which are also related to number of guests
-LimitNOFILE=8192
-# The cgroups pids controller can limit the number of tasks started by
-# the daemon, which can limit the number of domains for some hypervisors.
-# A conservative default of 8 tasks per guest results in a TasksMax of
-# 32k to support 4096 guests.
-TasksMax=32768
-
-[Install]
-WantedBy=multi-user.target
-Also=virtlockd.socket
-Also=virtlogd.socket
diff --git a/daemon/libvirtd.sysconf b/daemon/libvirtd.sysconf
deleted file mode 100644 (file)
index f15e595..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# Override the default config file
-# NOTE: This setting is no longer honoured if using
-# systemd. Set '--config /etc/libvirt/libvirtd.conf'
-# in LIBVIRTD_ARGS instead.
-#LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf
-
-# Listen for TCP/IP connections
-# NB. must setup TLS/SSL keys prior to using this
-#LIBVIRTD_ARGS="--listen"
-
-# Override Kerberos service keytab for SASL/GSSAPI
-#KRB5_KTNAME=/etc/libvirt/krb5.tab
-
-# Override the QEMU/SDL default audio driver probing when
-# starting virtual machines using SDL graphics
-#
-# NB these have no effect for VMs using VNC, unless vnc_allow_host_audio
-# is enabled in /etc/libvirt/qemu.conf
-#QEMU_AUDIO_DRV=sdl
-#
-#SDL_AUDIODRIVER=pulse
-
-# Override the maximum number of opened files.
-# This only works with traditional init scripts.
-# In the systemd world, the limit can only be changed by overriding
-# LimitNOFILE for libvirtd.service. To do that, just create a *.conf
-# file in /etc/systemd/system/libvirtd.service.d/ (for example
-# /etc/systemd/system/libvirtd.service.d/openfiles.conf) and write
-# the following two lines in it:
-#   [Service]
-#   LimitNOFILE=2048
-#
-#LIBVIRTD_NOFILES_LIMIT=2048
diff --git a/daemon/libvirtd.upstart b/daemon/libvirtd.upstart
deleted file mode 100644 (file)
index e620f41..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# libvirtd upstart job
-#
-# XXX wait for rc to get all dependent initscripts started
-# from sysv libvirtd initscript: Required-Start: $network messagebus
-start on stopped rc RUNLEVEL=[345]
-stop on runlevel [!345]
-
-respawn
-
-script
-    LIBVIRTD_CONFIG=
-    LIBVIRTD_ARGS=
-    KRB5_KTNAME=/etc/libvirt/krb5.tab
-
-    if [ -f /etc/sysconfig/libvirtd ]; then
-        . /etc/sysconfig/libvirtd
-    fi
-
-    export QEMU_AUDIO_DRV
-    export SDL_AUDIODRIVER
-    export KRB5_KTNAME
-
-    LIBVIRTD_CONFIG_ARGS=
-    if [ -n "$LIBVIRTD_CONFIG" ]; then
-        LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
-    fi
-
-    # DAEMON_COREFILE_LIMIT from /etc/sysconfig/libvirtd is not handled
-    # automatically
-    if [ -n "$DAEMON_COREFILE_LIMIT" ]; then
-        ulimit -c "$DAEMON_COREFILE_LIMIT"
-    fi
-
-    # LIBVIRTD_NOFILES_LIMIT from /etc/sysconfig/libvirtd is not handled
-    # automatically
-    if [ -n "$LIBVIRTD_NOFILES_LIMIT" ]; then
-        ulimit -n "$LIBVIRTD_NOFILES_LIMIT"
-    fi
-    mkdir -p /var/cache/libvirt
-    rm -rf /var/cache/libvirt/*
-
-    exec /usr/sbin/libvirtd $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
-end script
-
-post-stop script
-    rm -rf /var/cache/libvirt/*
-end script
diff --git a/daemon/virt-guest-shutdown.target b/daemon/virt-guest-shutdown.target
deleted file mode 100644 (file)
index 25d4aaa..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[Unit]
-Description=Libvirt guests shutdown
-Documentation=https://libvirt.org
index e1a9faa5450981108592bf6c26b8b33058d76136..cde91b0333227507d5a10744e8eee1b7459cf228 100644 (file)
@@ -2769,6 +2769,7 @@ endif ! WITH_LIBVIRTD
 SYSCONF_FILES = \
        locking/virtlockd.sysconf \
        logging/virtlogd.sysconf \
+       remote/libvirtd.sysconf \
        $(NULL)
 
 EXTRA_DIST += \
@@ -2797,6 +2798,7 @@ uninstall-sysconfig:
 SYSVINIT_FILES_IN = \
        locking/virtlockd.init.in \
        logging/virtlogd.init.in \
+       remote/libvirtd.init.in \
        $(NULL)
 
 SYSVINIT_FILES = $(notdir $(SYSVINIT_FILES_IN:%.in=%))
@@ -2827,6 +2829,15 @@ install-init::
 uninstall-init::
 endif ! WITH_LIBVIRTD
 
+libvirtd.init: remote/libvirtd.init.in $(top_builddir)/config.status
+       $(AM_V_GEN)sed \
+           -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
+           -e 's|[@]sbindir[@]|$(sbindir)|g' \
+           -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
+           < $< > $@-t && \
+           chmod a+x $@-t && \
+           mv $@-t $@
+
 virtlockd.init: locking/virtlockd.init.in $(top_builddir)/config.status
        $(AM_V_GEN)sed \
            -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
@@ -2913,6 +2924,8 @@ SYSTEMD_UNIT_FILES_IN = \
        logging/virtlogd.service.in \
        logging/virtlogd.socket.in \
        logging/virtlogd-admin.socket.in \
+       remote/libvirtd.service.in \
+       remote/virt-guest-shutdown.target.in \
        $(NULL)
 
 EXTRA_DIST += \
@@ -2956,6 +2969,18 @@ install-systemd:
 uninstall-systemd:
 endif ! WITH_LIBVIRTD
 
+libvirtd.service: remote/libvirtd.service.in $(top_builddir)/config.status
+       $(AM_V_GEN)sed \
+           -e 's|[@]localstatedir[@]|$(localstatedir)|g' \
+           -e 's|[@]sbindir[@]|$(sbindir)|g' \
+           -e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
+           < $< > $@-t && \
+           mv $@-t $@
+
+virt-guest-shutdown.target: remote/virt-guest-shutdown.target.in \
+                       $(top_builddir)/config.status
+       $(AM_V_GEN)cp $< $@
+
 virtlockd.service: locking/virtlockd.service.in $(top_builddir)/config.status
        $(AM_V_GEN)sed \
            -e 's|[@]sbindir[@]|$(sbindir)|g' \
@@ -2995,6 +3020,39 @@ virtlogd-admin.socket: logging/virtlogd-admin.socket.in \
            mv $@-t $@
 
 
+UPSTART_FILES = \
+       remote/libvirtd.upstart \
+       $(NULL)
+
+EXTRA_DIST += $(UPSTART_FILES)
+
+if WITH_LIBVIRTD
+if LIBVIRT_INIT_SCRIPT_UPSTART
+
+install-upstart: install-sysconfig
+       $(MKDIR_P) $(DESTDIR)$(sysconfdir)/event.d
+       for f in $(UPSTART_FILES:%.upstart=%); \
+       do \
+         tgt=`basename $$f` ; \
+         $(INSTALL_SCRIPT) $$f.upstart $(DESTDIR)$(sysconfdir)/event.d/$$tgt ; \
+       done
+
+uninstall-upstart: uninstall-sysconfig
+       for f in $(UPSTART_FILES:%.upstart=%); \
+       do \
+         tgt=`basename $$f` ; \
+         rm -f $(DESTDIR)$(sysconfdir)/event.d/$$tgt ; \
+       done
+       rmdir $(DESTDIR)$(sysconfdir)/event.d || :
+else ! LIBVIRT_INIT_SCRIPT_UPSTART
+install-upstart:
+uninstall-upstart:
+endif ! LIBVIRT_INIT_SCRIPT_UPSTART
+else ! WITH_LIBVIRTD
+install-upstart:
+uninstall-upstart:
+endif ! WITH_LIBVIRTD
+
 if WITH_SANLOCK
 lockdriver_LTLIBRARIES += sanlock.la
 sanlock_la_SOURCES = $(LOCK_DRIVER_SANLOCK_SOURCES)
@@ -3363,7 +3421,7 @@ libvirt_nss_la_LIBADD = \
 endif WITH_NSS
 
 
-install-data-local: install-init install-systemd
+install-data-local: install-init install-systemd install-upstart
 if WITH_LIBVIRTD
        $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/lockd"
        $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/lockd/files"
@@ -3418,7 +3476,7 @@ if WITH_NETWORK
          $(LN_S) ../default.xml default.xml )
 endif WITH_NETWORK
 
-uninstall-local:: uninstall-init uninstall-systemd
+uninstall-local:: uninstall-init uninstall-systemd uninstall-upstart
 if WITH_LIBVIRTD
        rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/lockd/files" ||:
        rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/lockd" ||:
diff --git a/src/remote/libvirtd.init.in b/src/remote/libvirtd.init.in
new file mode 100644 (file)
index 0000000..d81dca6
--- /dev/null
@@ -0,0 +1,122 @@
+#!/bin/sh
+
+# the following is the LSB init header see
+# http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
+#
+### BEGIN INIT INFO
+# Provides: libvirtd
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 2 6
+# Required-Start: $network messagebus virtlogd
+# Required-Stop: $network messagebus
+# Should-Start: $named xend avahi-daemon virtlockd
+# Should-Stop: $named
+# Short-Description: daemon for libvirt virtualization API
+# Description: This is a daemon for managing guest instances
+#              and libvirt virtual networks
+#              See https://libvirt.org
+### END INIT INFO
+
+# the following is chkconfig init header
+#
+# libvirtd:   guest and virtual network management daemon
+#
+# chkconfig: 345 97 03
+# description:  This is a daemon for managing guest instances \
+#               and libvirt virtual networks \
+#               See https://libvirt.org
+#
+# processname: libvirtd
+# pidfile: @localstatedir@/run/libvirtd.pid
+#
+
+# Source function library.
+. @sysconfdir@/rc.d/init.d/functions
+
+SERVICE=libvirtd
+PROCESS=libvirtd
+PIDFILE=@localstatedir@/run/$SERVICE.pid
+
+LIBVIRTD_CONFIG=
+LIBVIRTD_ARGS=
+KRB5_KTNAME=/etc/libvirt/krb5.tab
+
+test -f @sysconfdir@/sysconfig/libvirtd && . @sysconfdir@/sysconfig/libvirtd
+
+export QEMU_AUDIO_DRV
+export SDL_AUDIODRIVER
+
+LIBVIRTD_CONFIG_ARGS=
+if [ -n "$LIBVIRTD_CONFIG" ]
+then
+    LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
+fi
+
+RETVAL=0
+
+start() {
+    echo -n $"Starting $SERVICE daemon: "
+    mkdir -p @localstatedir@/cache/libvirt
+    rm -rf @localstatedir@/cache/libvirt/*
+
+    # LIBVIRTD_NOFILES_LIMIT from /etc/sysconfig/libvirtd is not handled
+    # automatically
+    if [ -n "$LIBVIRTD_NOFILES_LIMIT" ]; then
+        ulimit -n "$LIBVIRTD_NOFILES_LIMIT"
+    fi
+
+    KRB5_KTNAME=$KRB5_KTNAME daemon --pidfile $PIDFILE --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
+    RETVAL=$?
+    echo
+    [ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$SERVICE
+}
+
+stop() {
+    echo -n $"Stopping $SERVICE daemon: "
+
+    killproc -p $PIDFILE $PROCESS
+    RETVAL=$?
+    echo
+    if [ $RETVAL -eq 0 ]; then
+        rm -f @localstatedir@/lock/subsys/$SERVICE
+        rm -rf @localstatedir@/cache/libvirt/*
+    else
+        exit $RETVAL
+    fi
+}
+
+restart() {
+    stop
+    start
+}
+
+reload() {
+    echo -n $"Reloading $SERVICE configuration: "
+
+    killproc -p $PIDFILE $PROCESS -HUP
+    RETVAL=$?
+    echo
+    return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+    start|stop|restart|reload)
+        $1
+        ;;
+    status)
+        status -p $PIDFILE $PROCESS
+        RETVAL=$?
+        ;;
+    force-reload)
+        reload
+        ;;
+    condrestart|try-restart)
+        [ -f @localstatedir@/lock/subsys/$SERVICE ] && restart || :
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload|try-restart}"
+        exit 2
+        ;;
+esac
+exit $RETVAL
diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
new file mode 100644 (file)
index 0000000..769702e
--- /dev/null
@@ -0,0 +1,43 @@
+# NB we don't use socket activation. When libvirtd starts it will
+# spawn any virtual machines registered for autostart. We want this
+# to occur on every boot, regardless of whether any client connects
+# to a socket. Thus socket activation doesn't have any benefit
+
+[Unit]
+Description=Virtualization daemon
+Requires=virtlogd.socket
+Requires=virtlockd.socket
+Wants=systemd-machined.service
+Before=libvirt-guests.service
+After=network.target
+After=dbus.service
+After=iscsid.service
+After=apparmor.service
+After=local-fs.target
+After=remote-fs.target
+After=systemd-machined.service
+Documentation=man:libvirtd(8)
+Documentation=https://libvirt.org
+
+[Service]
+Type=notify
+EnvironmentFile=-/etc/sysconfig/libvirtd
+ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
+ExecReload=/bin/kill -HUP $MAINPID
+KillMode=process
+Restart=on-failure
+# At least 1 FD per guest, often 2 (eg qemu monitor + qemu agent).
+# eg if we want to support 4096 guests, we'll typically need 8192 FDs
+# If changing this, also consider virtlogd.service & virtlockd.service
+# limits which are also related to number of guests
+LimitNOFILE=8192
+# The cgroups pids controller can limit the number of tasks started by
+# the daemon, which can limit the number of domains for some hypervisors.
+# A conservative default of 8 tasks per guest results in a TasksMax of
+# 32k to support 4096 guests.
+TasksMax=32768
+
+[Install]
+WantedBy=multi-user.target
+Also=virtlockd.socket
+Also=virtlogd.socket
diff --git a/src/remote/libvirtd.sysconf b/src/remote/libvirtd.sysconf
new file mode 100644 (file)
index 0000000..f15e595
--- /dev/null
@@ -0,0 +1,33 @@
+# Override the default config file
+# NOTE: This setting is no longer honoured if using
+# systemd. Set '--config /etc/libvirt/libvirtd.conf'
+# in LIBVIRTD_ARGS instead.
+#LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf
+
+# Listen for TCP/IP connections
+# NB. must setup TLS/SSL keys prior to using this
+#LIBVIRTD_ARGS="--listen"
+
+# Override Kerberos service keytab for SASL/GSSAPI
+#KRB5_KTNAME=/etc/libvirt/krb5.tab
+
+# Override the QEMU/SDL default audio driver probing when
+# starting virtual machines using SDL graphics
+#
+# NB these have no effect for VMs using VNC, unless vnc_allow_host_audio
+# is enabled in /etc/libvirt/qemu.conf
+#QEMU_AUDIO_DRV=sdl
+#
+#SDL_AUDIODRIVER=pulse
+
+# Override the maximum number of opened files.
+# This only works with traditional init scripts.
+# In the systemd world, the limit can only be changed by overriding
+# LimitNOFILE for libvirtd.service. To do that, just create a *.conf
+# file in /etc/systemd/system/libvirtd.service.d/ (for example
+# /etc/systemd/system/libvirtd.service.d/openfiles.conf) and write
+# the following two lines in it:
+#   [Service]
+#   LimitNOFILE=2048
+#
+#LIBVIRTD_NOFILES_LIMIT=2048
diff --git a/src/remote/libvirtd.upstart b/src/remote/libvirtd.upstart
new file mode 100644 (file)
index 0000000..e620f41
--- /dev/null
@@ -0,0 +1,47 @@
+# libvirtd upstart job
+#
+# XXX wait for rc to get all dependent initscripts started
+# from sysv libvirtd initscript: Required-Start: $network messagebus
+start on stopped rc RUNLEVEL=[345]
+stop on runlevel [!345]
+
+respawn
+
+script
+    LIBVIRTD_CONFIG=
+    LIBVIRTD_ARGS=
+    KRB5_KTNAME=/etc/libvirt/krb5.tab
+
+    if [ -f /etc/sysconfig/libvirtd ]; then
+        . /etc/sysconfig/libvirtd
+    fi
+
+    export QEMU_AUDIO_DRV
+    export SDL_AUDIODRIVER
+    export KRB5_KTNAME
+
+    LIBVIRTD_CONFIG_ARGS=
+    if [ -n "$LIBVIRTD_CONFIG" ]; then
+        LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
+    fi
+
+    # DAEMON_COREFILE_LIMIT from /etc/sysconfig/libvirtd is not handled
+    # automatically
+    if [ -n "$DAEMON_COREFILE_LIMIT" ]; then
+        ulimit -c "$DAEMON_COREFILE_LIMIT"
+    fi
+
+    # LIBVIRTD_NOFILES_LIMIT from /etc/sysconfig/libvirtd is not handled
+    # automatically
+    if [ -n "$LIBVIRTD_NOFILES_LIMIT" ]; then
+        ulimit -n "$LIBVIRTD_NOFILES_LIMIT"
+    fi
+    mkdir -p /var/cache/libvirt
+    rm -rf /var/cache/libvirt/*
+
+    exec /usr/sbin/libvirtd $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
+end script
+
+post-stop script
+    rm -rf /var/cache/libvirt/*
+end script
diff --git a/src/remote/virt-guest-shutdown.target.in b/src/remote/virt-guest-shutdown.target.in
new file mode 100644 (file)
index 0000000..25d4aaa
--- /dev/null
@@ -0,0 +1,3 @@
+[Unit]
+Description=Libvirt guests shutdown
+Documentation=https://libvirt.org