[libvirt] [PATCH 1/2] configure: Provide OpenRC scripts for sub-daemons

Michal Privoznik mprivozn at redhat.com
Tue Nov 26 14:46:11 UTC 2019


There is plenty of distributions that haven't switched to
systemd nor they force their users to (Gentoo, Alpine Linux to
name a few). With the daemon split merged their only option is to
still use the monolithic daemon which will go away eventually.
Provide init scripts for these distros too.

For now, I'm not introducing config files which would correspond
to the init files except for libvirtd and virtproxyd init scripts
where it might be desirable to tweak the command line of
corresponding daemons.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 m4/virt-init-script.m4               |  8 +++-
 src/Makefile.am                      | 56 +++++++++++++++++++++++++++-
 src/interface/Makefile.inc.am        | 11 ++++++
 src/interface/virtinterfaced.init.in | 26 +++++++++++++
 src/libxl/Makefile.inc.am            | 10 +++++
 src/libxl/virtxend.init.in           | 26 +++++++++++++
 src/lxc/Makefile.inc.am              | 10 +++++
 src/lxc/virtlxcd.init.in             | 26 +++++++++++++
 src/network/Makefile.inc.am          | 10 +++++
 src/network/virtnetworkd.init.in     | 26 +++++++++++++
 src/node_device/Makefile.inc.am      | 11 ++++++
 src/node_device/virtnodedevd.init.in | 26 +++++++++++++
 src/nwfilter/Makefile.inc.am         | 11 ++++++
 src/nwfilter/virtnwfilterd.init.in   | 26 +++++++++++++
 src/qemu/Makefile.inc.am             | 10 +++++
 src/qemu/virtqemud.init.in           | 26 +++++++++++++
 src/remote/Makefile.inc.am           | 30 +++++++++++++++
 src/remote/libvirtd.confd            | 18 +++++++++
 src/remote/libvirtd.init.in          | 29 ++++++++++++++
 src/remote/virtproxyd.confd          | 10 +++++
 src/remote/virtproxyd.init.in        | 28 ++++++++++++++
 src/secret/Makefile.inc.am           | 10 +++++
 src/secret/virtsecretd.init.in       | 26 +++++++++++++
 src/storage/Makefile.inc.am          | 10 +++++
 src/storage/virtstoraged.init.in     | 26 +++++++++++++
 src/vbox/Makefile.inc.am             | 10 +++++
 src/vbox/virtvboxd.init.in           | 26 +++++++++++++
 src/vz/Makefile.inc.am               | 10 +++++
 src/vz/virtvzd.init.in               | 26 +++++++++++++
 29 files changed, 576 insertions(+), 2 deletions(-)
 create mode 100644 src/interface/virtinterfaced.init.in
 create mode 100644 src/libxl/virtxend.init.in
 create mode 100644 src/lxc/virtlxcd.init.in
 create mode 100644 src/network/virtnetworkd.init.in
 create mode 100644 src/node_device/virtnodedevd.init.in
 create mode 100644 src/nwfilter/virtnwfilterd.init.in
 create mode 100644 src/qemu/virtqemud.init.in
 create mode 100644 src/remote/libvirtd.confd
 create mode 100644 src/remote/libvirtd.init.in
 create mode 100644 src/remote/virtproxyd.confd
 create mode 100644 src/remote/virtproxyd.init.in
 create mode 100644 src/secret/virtsecretd.init.in
 create mode 100644 src/storage/virtstoraged.init.in
 create mode 100644 src/vbox/virtvboxd.init.in
 create mode 100644 src/vz/virtvzd.init.in

diff --git a/m4/virt-init-script.m4 b/m4/virt-init-script.m4
index 6eb81f0429..676135866f 100644
--- a/m4/virt-init-script.m4
+++ b/m4/virt-init-script.m4
@@ -19,7 +19,7 @@ dnl
 
 AC_DEFUN([LIBVIRT_ARG_INIT_SCRIPT],[
     LIBVIRT_ARG_WITH([INIT_SCRIPT],
-                     [Style of init script to install: systemd, check, none],
+                     [Style of init script to install: systemd, openrc, check, none],
                      [check])
 ])
 
@@ -32,12 +32,16 @@ AC_DEFUN([LIBVIRT_CHECK_INIT_SCRIPT],[
     if test "$with_init_script" = check && type systemctl >/dev/null 2>&1; then
         with_init_script=systemd
     fi
+    if test "$with_init_script" = check && type openrc >/dev/null 2>&1; then
+        with_init_script=openrc
+    fi
     if test "$with_init_script" = check; then
         with_init_script=none
     fi
 
     AS_CASE([$with_init_script],
         [systemd],[],
+        [openrc],[],
         [none],[],
         [*],[
             AC_MSG_ERROR([Unknown initscript flavour $with_init_script])
@@ -46,6 +50,8 @@ AC_DEFUN([LIBVIRT_CHECK_INIT_SCRIPT],[
 
     AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_SYSTEMD],
                    [test "$with_init_script" = "systemd"])
+    AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_OPENRC],
+                   [test "$with_init_script" = "openrc"])
 
     AC_MSG_RESULT($with_init_script)
 ])
diff --git a/src/Makefile.am b/src/Makefile.am
index 696e64c52e..4b9736d7da 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -88,6 +88,9 @@ PODFILES =
 MANINFILES =
 SYSTEMD_UNIT_FILES =
 SYSTEMD_UNIT_FILES_IN =
+OPENRC_INIT_FILES =
+OPENRC_INIT_FILES_IN =
+OPENRC_CONF_FILES =
 SYSCONF_FILES =
 sbin_PROGRAMS =
 man8_MANS =
@@ -601,7 +604,9 @@ libvirt_lxc_la_LDFLAGS = \
 libvirt_lxc_la_CFLAGS = $(AM_CFLAGS)
 libvirt_lxc_la_LIBADD = libvirt.la $(CYGWIN_EXTRA_LIBADD)
 
-EXTRA_DIST += $(SYSCONF_FILES)
+EXTRA_DIST += \
+	$(SYSCONF_FILES) \
+	$(OPENRC_CONF_FILES)
 
 install-sysconfig:
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
@@ -620,6 +625,25 @@ uninstall-sysconfig:
 	done
 	rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
 
+OPENRC_CONF_DIR = $(sysconfdir)/conf.d
+
+install-openrc-conf:
+	$(MKDIR_P) $(DESTDIR)$(OPENRC_CONF_DIR)
+	for f in $(OPENRC_CONF_FILES:%.confd=%) ; \
+	do \
+		tgt=`basename $$f`; \
+		$(INSTALL_DATA) $(srcdir)/$$f.confd \
+			$(DESTDIR)$(OPENRC_CONF_DIR)/$$tgt; \
+	done
+
+uninstall-openrc-conf:
+	for f in $(OPENRC_CONF_FILES:%.confd=%) ; \
+	do \
+		tgt=`basename $$f`; \
+		rm -f $(DESTDIR)$(OPENRC_CONF_DIR)/$$tgt; \
+	done
+	rmdir $(DESTDIR)$(OPENRC_CONF_DIR) || :
+
 LOGROTATE_FILES := $(LOGROTATE_FILES_IN:remote/%.in=%)
 
 EXTRA_DIST += $(LOGROTATE_FILES_IN)
@@ -665,6 +689,7 @@ CLEANFILES += \
 
 EXTRA_DIST += \
         $(SYSTEMD_UNIT_FILES_IN) \
+		$(OPENRC_INIT_FILES_IN) \
         $(PODFILES) \
         $(NULL)
 
@@ -691,6 +716,35 @@ uninstall-systemd: uninstall-sysconfig
 INSTALL_DATA_LOCAL += install-systemd
 UNINSTALL_LOCAL += uninstall-systemd
 endif LIBVIRT_INIT_SCRIPT_SYSTEMD
+
+if LIBVIRT_INIT_SCRIPT_OPENRC
+
+OPENRC_INIT_DIR = $(sysconfdir)/init.d
+
+BUILT_SOURCES += $(OPENRC_INIT_FILES)
+DISTCLEANFILES += $(OPENRC_INIT_FILES)
+
+install-openrc: $(OPENRC_INIT_FILES) install-openrc-conf
+	$(MKDIR_P) $(DESTDIR)$(OPENRC_INIT_DIR)
+	for f in $(OPENRC_INIT_FILES:%.init=%) ; \
+	do \
+		tgt=`basename $$f`; \
+		$(INSTALL_SCRIPT) $$f.init \
+		$(DESTDIR)$(OPENRC_INIT_DIR)/$$tgt ; \
+	done
+
+uninstall-openrc: uninstall-openrc-conf
+	for f in $(OPENRC_INIT_FILES:%.init=%) ; \
+	do \
+		tgt=`basename $$f`; \
+		rm -f $(DESTDIR)$(OPENRC_INIT_DIR)/$$tgt ; \
+	done
+	rmdir $(DESTDIR)$(OPENRC_INIT_DIR) || :
+
+INSTALL_DATA_LOCAL += install-openrc
+UNINSTALL_LOCAL += uninstall-openrc
+endif LIBVIRT_INIT_SCRIPT_OPENRC
+
 endif WITH_LIBVIRTD
 
 
diff --git a/src/interface/Makefile.inc.am b/src/interface/Makefile.inc.am
index 34acdb7566..3df1d106a7 100644
--- a/src/interface/Makefile.inc.am
+++ b/src/interface/Makefile.inc.am
@@ -72,6 +72,13 @@ SYSTEMD_UNIT_FILES_IN += \
 	interface/virtinterfaced.service.in \
 	$(NULL)
 
+OPENRC_INIT_FILES += \
+	virtinterfaced.init \
+	$(NULL)
+OPENRC_INIT_FILES_IN += \
+	interface/virtinterfaced.init.in \
+	$(NULL)
+
 VIRTINTERFACED_UNIT_VARS = \
 	$(VIRTD_UNIT_VARS) \
 	-e 's|[@]name[@]|Libvirt interface|g' \
@@ -79,6 +86,10 @@ VIRTINTERFACED_UNIT_VARS = \
 	-e 's|[@]sockprefix[@]|virtinterfaced|g' \
 	$(NULL)
 
+virtinterfaced.init: interface/virtinterfaced.init.in \
+		$(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
 virtinterfaced.service: interface/virtinterfaced.service.in \
 		$(top_builddir)/config.status
 	$(AM_V_GEN)$(SED) $(VIRTINTERFACED_UNIT_VARS) $< > $@-t && mv $@-t $@
diff --git a/src/interface/virtinterfaced.init.in b/src/interface/virtinterfaced.init.in
new file mode 100644
index 0000000000..4653cb1e16
--- /dev/null
+++ b/src/interface/virtinterfaced.init.in
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+
+description="Virtualization interface daemon"
+
+VIRTINTERFACED_OPTS=${VIRTINTERFACED_OPTS:-"${VIRTINTERFACED_OPTS}"}
+VIRTINTERFACED_TIMEOUT=${VIRTINTERFACED_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/virtinterfaced"
+command_args="-d ${VIRTINTERFACED_OPTS}"
+pidfile="@runstatedir@/virtinterfaced.pid"
+retry="${VIRTINTERFACED_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    use dbus
+    after nfs nfsmount
+}
+
+reload() {
+    ebegin "re-exec() virtinterfaced"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
diff --git a/src/libxl/Makefile.inc.am b/src/libxl/Makefile.inc.am
index 03b4d2fad4..5d40724c3b 100644
--- a/src/libxl/Makefile.inc.am
+++ b/src/libxl/Makefile.inc.am
@@ -83,6 +83,13 @@ SYSTEMD_UNIT_FILES_IN += \
 	libxl/virtxend.service.in \
 	$(NULL)
 
+OPENRC_INIT_FILES += \
+	virtxend.init \
+	$(NULL)
+OPENRC_INIT_FILES_IN += \
+	libxl/virtxend.init.in \
+	$(NULL)
+
 LIBXL_UNIT_COND = ConditionPathExists=/proc/xen/capabilities
 LIBXL_UNIT_CONFLICT = Conflicts=$(LIBVIRTD_SOCKET_UNIT_FILES)
 
@@ -94,6 +101,9 @@ VIRTXEND_UNIT_VARS = \
 	-e 's|[@]sockprefix[@]|virtxend|g' \
 	$(NULL)
 
+virtxend.init: libxl/virtxend.init.in $(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
 virtxend.service: libxl/virtxend.service.in $(top_builddir)/config.status
 	$(AM_V_GEN)$(SED) $(VIRTXEND_UNIT_VARS) $< > $@-t && mv $@-t $@
 
diff --git a/src/libxl/virtxend.init.in b/src/libxl/virtxend.init.in
new file mode 100644
index 0000000000..9159d6b795
--- /dev/null
+++ b/src/libxl/virtxend.init.in
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+
+description="Virtualization xen daemon"
+
+VIRTXEND_OPTS=${VIRTXEND_OPTS:-"${VIRTXEND_OPTS}"}
+VIRTXEND_TIMEOUT=${VIRTXEND_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/virtxend"
+command_args="-d ${VIRTXEND_OPTS}"
+pidfile="@runstatedir@/virtxend.pid"
+retry="${VIRTXEND_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    use dbus
+    after nfs nfsmount
+}
+
+reload() {
+    ebegin "re-exec() virtxend"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
diff --git a/src/lxc/Makefile.inc.am b/src/lxc/Makefile.inc.am
index 5eb0bb9ad7..26b20e2e03 100644
--- a/src/lxc/Makefile.inc.am
+++ b/src/lxc/Makefile.inc.am
@@ -146,6 +146,13 @@ SYSTEMD_UNIT_FILES_IN += \
 	lxc/virtlxcd.service.in \
 	$(NULL)
 
+OPENRC_INIT_FILES += \
+	virtlxcd.init \
+	$(NULL)
+OPENRC_INIT_FILES_IN += \
+	lxc/virtlxcd.init.in \
+	$(NULL)
+
 VIRTLXCD_UNIT_VARS = \
 	$(VIRTD_UNIT_VARS) \
 	-e 's|[@]name[@]|Libvirt lxc|g' \
@@ -153,6 +160,9 @@ VIRTLXCD_UNIT_VARS = \
 	-e 's|[@]sockprefix[@]|virtlxcd|g' \
 	$(NULL)
 
+virtlxcd.init: lxc/virtlxcd.init.in $(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
 virtlxcd.service: lxc/virtlxcd.service.in $(top_builddir)/config.status
 	$(AM_V_GEN)$(SED) $(VIRTLXCD_UNIT_VARS) $< > $@-t && mv $@-t $@
 
diff --git a/src/lxc/virtlxcd.init.in b/src/lxc/virtlxcd.init.in
new file mode 100644
index 0000000000..48e80c29ab
--- /dev/null
+++ b/src/lxc/virtlxcd.init.in
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+
+description="Virtualization lxc daemon"
+
+VIRTLXCD_OPTS=${VIRTLXCD_OPTS:-"${VIRTLXCD_OPTS}"}
+VIRTLXCD_TIMEOUT=${VIRTLXCD_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/virtlxcd"
+command_args="-d ${VIRTLXCD_OPTS}"
+pidfile="@runstatedir@/virtlxcd.pid"
+retry="${VIRTLXCD_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    use ceph dbus iscsid virtlockd
+    after nfs nfsmount
+}
+
+reload() {
+    ebegin "re-exec() virtlxcd"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
diff --git a/src/network/Makefile.inc.am b/src/network/Makefile.inc.am
index 1cef1c7bce..3eeab74260 100644
--- a/src/network/Makefile.inc.am
+++ b/src/network/Makefile.inc.am
@@ -80,6 +80,13 @@ SYSTEMD_UNIT_FILES_IN += \
 	network/virtnetworkd.service.in \
 	$(NULL)
 
+OPENRC_INIT_FILES += \
+	virtnetworkd.init \
+	$(NULL)
+OPENRC_INIT_FILES_IN += \
+	network/virtnetworkd.init.in \
+	$(NULL)
+
 VIRTNETWORKD_UNIT_VARS = \
 	$(VIRTD_UNIT_VARS) \
 	-e 's|[@]name[@]|Libvirt network|g' \
@@ -87,6 +94,9 @@ VIRTNETWORKD_UNIT_VARS = \
 	-e 's|[@]sockprefix[@]|virtnetworkd|g' \
 	$(NULL)
 
+virtnetworkd.init: network/virtnetworkd.init.in $(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
 virtnetworkd.service: network/virtnetworkd.service.in \
 		$(top_builddir)/config.status
 	$(AM_V_GEN)$(SED) $(VIRTNETWORKD_UNIT_VARS) $< > $@-t && mv $@-t $@
diff --git a/src/network/virtnetworkd.init.in b/src/network/virtnetworkd.init.in
new file mode 100644
index 0000000000..7a683193a5
--- /dev/null
+++ b/src/network/virtnetworkd.init.in
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+
+description="Virtualization network daemon"
+
+VIRTNETWORKD_OPTS=${VIRTNETWORKD_OPTS:-"${VIRTNETWORKD_OPTS}"}
+VIRTNETWORKD_TIMEOUT=${VIRTNETWORKD_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/virtnetworkd"
+command_args="-d ${VIRTNETWORKD_OPTS}"
+pidfile="@runstatedir@/virtnetworkd.pid"
+retry="${VIRTNETWORKD_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    use ceph dbus iscsid virtlockd
+    after nfs nfsmount
+}
+
+reload() {
+    ebegin "re-exec() virtnetworkd"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
diff --git a/src/node_device/Makefile.inc.am b/src/node_device/Makefile.inc.am
index 58077ebddd..c29397464b 100644
--- a/src/node_device/Makefile.inc.am
+++ b/src/node_device/Makefile.inc.am
@@ -96,6 +96,13 @@ SYSTEMD_UNIT_FILES_IN += \
 	node_device/virtnodedevd.service.in \
 	$(NULL)
 
+OPENRC_INIT_FILES += \
+	virtnodedevd.init \
+	$(NULL)
+OPENRC_INIT_FILES_IN += \
+	node_device/virtnodedevd.init.in \
+	$(NULL)
+
 VIRTNODEDEVD_UNIT_VARS = \
 	$(VIRTD_UNIT_VARS) \
 	-e 's|[@]name[@]|Libvirt nodedev|g' \
@@ -103,6 +110,10 @@ VIRTNODEDEVD_UNIT_VARS = \
 	-e 's|[@]sockprefix[@]|virtnodedevd|g' \
 	$(NULL)
 
+virtnodedevd.init: node_device/virtnodedevd.init.in \
+		$(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
 virtnodedevd.service: node_device/virtnodedevd.service.in \
 		$(top_builddir)/config.status
 	$(AM_V_GEN)$(SED) $(VIRTNODEDEVD_UNIT_VARS) $< > $@-t && mv $@-t $@
diff --git a/src/node_device/virtnodedevd.init.in b/src/node_device/virtnodedevd.init.in
new file mode 100644
index 0000000000..8b5f8bb081
--- /dev/null
+++ b/src/node_device/virtnodedevd.init.in
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+
+description="Virtualization nodedev daemon"
+
+VIRTNODEDEVD_OPTS=${VIRTNODEDEVD_OPTS:-"${VIRTNODEDEVD_OPTS}"}
+VIRTNODEDEVD_TIMEOUT=${VIRTNODEDEVD_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/virtnodedevd"
+command_args="-d ${VIRTNODEDEVD_OPTS}"
+pidfile="@runstatedir@/virtnodedevd.pid"
+retry="${VIRTNODEDEVD_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    use ceph dbus iscsid virtlockd
+    after nfs nfsmount
+}
+
+reload() {
+    ebegin "re-exec() virtnodedevd"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
diff --git a/src/nwfilter/Makefile.inc.am b/src/nwfilter/Makefile.inc.am
index b51c8a5cda..d571d5c713 100644
--- a/src/nwfilter/Makefile.inc.am
+++ b/src/nwfilter/Makefile.inc.am
@@ -81,6 +81,13 @@ SYSTEMD_UNIT_FILES_IN += \
 	nwfilter/virtnwfilterd.service.in \
 	$(NULL)
 
+OPENRC_INIT_FILES += \
+	virtnwfilterd.init \
+	$(NULL)
+OPENRC_INIT_FILES_IN += \
+	nwfilter/virtnwfilterd.init.in \
+	$(NULL)
+
 VIRTNWFILTERD_UNIT_VARS = \
 	$(VIRTD_UNIT_VARS) \
 	-e 's|[@]name[@]|Libvirt nwfilter|g' \
@@ -88,6 +95,10 @@ VIRTNWFILTERD_UNIT_VARS = \
 	-e 's|[@]sockprefix[@]|virtnwfilterd|g' \
 	$(NULL)
 
+virtnwfilterd.init: nwfilter/virtnwfilterd.init.in \
+		$(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
 virtnwfilterd.service: nwfilter/virtnwfilterd.service.in \
 		$(top_builddir)/config.status
 	$(AM_V_GEN)$(SED) $(VIRTNWFILTERD_UNIT_VARS) $< > $@-t && mv $@-t $@
diff --git a/src/nwfilter/virtnwfilterd.init.in b/src/nwfilter/virtnwfilterd.init.in
new file mode 100644
index 0000000000..76a9adfe48
--- /dev/null
+++ b/src/nwfilter/virtnwfilterd.init.in
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+
+description="Virtualization nwfilter daemon"
+
+VIRTNWFILTERD_OPTS=${VIRTNWFILTERD_OPTS:-"${VIRTNWFILTERD_OPTS}"}
+VIRTNWFILTERD_TIMEOUT=${VIRTNWFILTERD_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/virtnwfilterd"
+command_args="-d ${VIRTNWFILTERD_OPTS}"
+pidfile="@runstatedir@/virtnwfilterd.pid"
+retry="${VIRTNWFILTERD_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    use ceph dbus iscsid virtlockd
+    after nfs nfsmount
+}
+
+reload() {
+    ebegin "re-exec() virtnwfilterd"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am
index bf30f8a3c5..da849ae1c3 100644
--- a/src/qemu/Makefile.inc.am
+++ b/src/qemu/Makefile.inc.am
@@ -152,6 +152,13 @@ SYSTEMD_UNIT_FILES_IN += \
 	qemu/virtqemud.service.in \
 	$(NULL)
 
+OPENRC_INIT_FILES += \
+	virtqemud.init \
+	$(NULL)
+OPENRC_INIT_FILES_IN += \
+	qemu/virtqemud.init.in \
+	$(NULL)
+
 VIRTQEMUD_UNIT_VARS = \
 	$(VIRTD_UNIT_VARS) \
 	-e 's|[@]name[@]|Libvirt qemu|g' \
@@ -159,6 +166,9 @@ VIRTQEMUD_UNIT_VARS = \
 	-e 's|[@]sockprefix[@]|virtqemud|g' \
 	$(NULL)
 
+virtqemud.init: qemu/virtqemud.init.in $(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
 virtqemud.service: qemu/virtqemud.service.in $(top_builddir)/config.status
 	$(AM_V_GEN)$(SED) $(VIRTQEMUD_UNIT_VARS) $< > $@-t && mv $@-t $@
 
diff --git a/src/qemu/virtqemud.init.in b/src/qemu/virtqemud.init.in
new file mode 100644
index 0000000000..b7c385db18
--- /dev/null
+++ b/src/qemu/virtqemud.init.in
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+
+description="Virtualization qemu daemon"
+
+VIRTQEMUD_OPTS=${VIRTQEMUD_OPTS:-"${VIRTQEMUD_OPTS}"}
+VIRTQEMUD_TIMEOUT=${VIRTQEMUD_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/virtqemud"
+command_args="-d ${VIRTQEMUD_OPTS}"
+pidfile="@runstatedir@/virtqemud.pid"
+retry="${VIRTQEMUD_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    use ceph dbus iscsid virtlockd
+    after nfs nfsmount
+}
+
+reload() {
+    ebegin "re-exec() virtqemud"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am
index 8103cfb96a..1fe438c830 100644
--- a/src/remote/Makefile.inc.am
+++ b/src/remote/Makefile.inc.am
@@ -129,6 +129,19 @@ SYSTEMD_UNIT_FILES_IN += \
 	$(GUEST_UNIT_FILES_IN) \
 	$(NULL)
 
+OPENRC_INIT_FILES += \
+	libvirtd.init \
+	virtproxyd.init \
+	$(NULL)
+OPENRC_INIT_FILES_IN += \
+	remote/libvirtd.init.in \
+	remote/virtproxyd.init.in \
+	$(NULL)
+OPENRC_CONF_FILES += \
+	remote/libvirtd.confd \
+	remote/virtproxyd.confd \
+	$(NULL)
+
 REMOTE_PROTOCOL = $(srcdir)/remote/remote_protocol.x
 LXC_PROTOCOL = $(srcdir)/remote/lxc_protocol.x
 QEMU_PROTOCOL = $(srcdir)/remote/qemu_protocol.x
@@ -398,6 +411,17 @@ LIBVIRTD_UNIT_VARS = \
 	-e 's|[@]deps[@]||g' \
 	$(NULL)
 
+LIBVIRTD_INIT_VARS = \
+	$(COMMON_UNIT_VARS)
+
+if WITH_FIREWALLD
+LIBVIRTD_INIT_VARS += \
+	-e 's|[@]NEED_FIREWALLD[@]|need firewalld|g'
+else ! WITH_FIREWALLD
+LIBVIRTD_INIT_VARS += \
+	-e 's|[@]NEED_FIREWALLD[@]||g'
+endif ! WITH_FIREWALLD
+
 VIRTD_UNIT_VARS = \
 	$(COMMON_UNIT_VARS) \
 	-e 's|[@]deps[@]|Conflicts=$(LIBVIRTD_SOCKET_UNIT_FILES)|g' \
@@ -410,6 +434,12 @@ VIRTPROXYD_UNIT_VARS = \
 	-e 's|[@]sockprefix[@]|libvirt|g' \
 	$(NULL)
 
+libvirtd.init: remote/libvirtd.init.in $(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
+virtproxyd.init: remote/virtproxyd.init.in $(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
 libvirtd.service: remote/libvirtd.service.in $(top_builddir)/config.status
 	$(AM_V_GEN)$(SED) $(LIBVIRTD_UNIT_VARS) $< > $@-t && mv $@-t $@
 
diff --git a/src/remote/libvirtd.confd b/src/remote/libvirtd.confd
new file mode 100644
index 0000000000..c326531d46
--- /dev/null
+++ b/src/remote/libvirtd.confd
@@ -0,0 +1,18 @@
+# /etc/conf.d/libvirtd
+
+# Startup dependency
+# libvirtd typically requires all networks to be up and settled which
+# is what rc_need="net" provides. However if you only use specific networks
+# for libvirtd, you may override this. Or if you only use libvirtd locally.
+rc_need="net"
+
+# The termination timeout (start-stop-daemon parameter "retry") ensures
+# that the service will be terminated within a given time (25 + 5 seconds
+# per default) when you are stopping the service.
+#LIBVIRTD_TERMTIMEOUT="TERM/25/KILL/5"
+
+# LIBVIRTD_OPTS
+# You may want to add '--listen' to have libvirtd listen for tcp/ip connections
+# if you want to use libvirt for remote control
+# Please consult 'libvirtd --help' for more options
+#LIBVIRTD_OPTS="--listen"
diff --git a/src/remote/libvirtd.init.in b/src/remote/libvirtd.init.in
new file mode 100644
index 0000000000..b708befbc5
--- /dev/null
+++ b/src/remote/libvirtd.init.in
@@ -0,0 +1,29 @@
+#!/sbin/openrc-run
+
+description="Virtualization daemon"
+
+LIBVIRTD_OPTS=${LIBVIRTD_OPTS:-"${LIBVIRTD_OPTS}"}
+LIBVIRTD_TIMEOUT=${LIBVIRTD_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/libvirtd"
+command_args="-d ${LIBVIRTD_OPTS}"
+start_stop_daemon_args="--env KRB5_KTNAME=/etc/libvirt/krb5.tab"
+pidfile="@runstatedir@/libvirtd.pid"
+retry="${LIBVIRTD_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    need virtlogd
+    @NEED_FIREWALLD@
+    use ceph dbus iscsid virtlockd
+    after cgconfig corosync ebtables iptables ip6tables nfs nfsmount ntp-client ntpdportmap rpc.statd sanlock xenconsoled
+}
+
+reload() {
+    ebegin "re-exec() libvirtd"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
diff --git a/src/remote/virtproxyd.confd b/src/remote/virtproxyd.confd
new file mode 100644
index 0000000000..6503c14dd7
--- /dev/null
+++ b/src/remote/virtproxyd.confd
@@ -0,0 +1,10 @@
+# /etc/conf.d/virtproxyd
+
+# The termination timeout (start-stop-daemon parameter "retry") ensures
+# that the service will be terminated within a given time (25 + 5 seconds
+# per default) when you are stopping the service.
+#VIRTPROXYD_TERMTIMEOUT="TERM/25/KILL/5"
+
+# VIRTPROXYD_OPTS
+# Please consult 'virtproxyd --help' for more options
+#VIRTPROXYD_OPTS=""
diff --git a/src/remote/virtproxyd.init.in b/src/remote/virtproxyd.init.in
new file mode 100644
index 0000000000..b644c084a9
--- /dev/null
+++ b/src/remote/virtproxyd.init.in
@@ -0,0 +1,28 @@
+#!/sbin/openrc-run
+
+description="Virtualization daemon proxy"
+
+VIRTPROXYD_OPTS=${VIRTPROXYD_OPTS:-"${VIRTPROXYD_OPTS}"}
+VIRTPROXYD_TIMEOUT=${VIRTPROXYD_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/virtproxyd"
+command_args="-d ${VIRTPROXYD_OPTS}"
+start_stop_daemon_args="--env KRB5_KTNAME=/etc/libvirt/krb5.tab"
+pidfile="@runstatedir@/virtproxyd.pid"
+retry="${VIRTPROXYD_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    use dbus
+    after cgconfig corosync ebtables iptables ip6tables nfs nfsmount ntp-client ntpdportmap rpc.statd sanlock xenconsoled
+    need net
+}
+
+reload() {
+    ebegin "re-exec() virtproxyd"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
diff --git a/src/secret/Makefile.inc.am b/src/secret/Makefile.inc.am
index 959d21099d..d332060e38 100644
--- a/src/secret/Makefile.inc.am
+++ b/src/secret/Makefile.inc.am
@@ -69,6 +69,13 @@ SYSTEMD_UNIT_FILES_IN += \
 	secret/virtsecretd.service.in \
 	$(NULL)
 
+OPENRC_INIT_FILES += \
+	virtsecretd.init \
+	$(NULL)
+OPENRC_INIT_FILES_IN += \
+	secret/virtsecretd.init.in \
+	$(NULL)
+
 VIRTSECRETD_UNIT_VARS = \
 	$(VIRTD_UNIT_VARS) \
 	-e 's|[@]name[@]|Libvirt secret|g' \
@@ -76,6 +83,9 @@ VIRTSECRETD_UNIT_VARS = \
 	-e 's|[@]sockprefix[@]|virtsecretd|g' \
 	$(NULL)
 
+virtsecretd.init: secret/virtsecretd.init.in $(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
 virtsecretd.service: secret/virtsecretd.service.in \
 		$(top_builddir)/config.status
 	$(AM_V_GEN)$(SED) $(VIRTSECRETD_UNIT_VARS) $< > $@-t && mv $@-t $@
diff --git a/src/secret/virtsecretd.init.in b/src/secret/virtsecretd.init.in
new file mode 100644
index 0000000000..6deecae8cb
--- /dev/null
+++ b/src/secret/virtsecretd.init.in
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+
+description="Virtualization secret daemon"
+
+VIRTSECRETD_OPTS=${VIRTSECRETD_OPTS:-"${VIRTSECRETD_OPTS}"}
+VIRTSECRETD_TIMEOUT=${VIRTSECRETD_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/virtsecretd"
+command_args="-d ${VIRTSECRETD_OPTS}"
+pidfile="@runstatedir@/virtsecretd.pid"
+retry="${VIRTSECRETD_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    use ceph dbus iscsid virtlockd
+    after nfs nfsmount
+}
+
+reload() {
+    ebegin "re-exec() virtsecretd"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
diff --git a/src/storage/Makefile.inc.am b/src/storage/Makefile.inc.am
index 3d453029a7..3808079fde 100644
--- a/src/storage/Makefile.inc.am
+++ b/src/storage/Makefile.inc.am
@@ -173,6 +173,13 @@ SYSTEMD_UNIT_FILES_IN += \
 	storage/virtstoraged.service.in \
 	$(NULL)
 
+OPENRC_INIT_FILES += \
+	virtstoraged.init \
+	$(NULL)
+OPENRC_INIT_FILES_IN += \
+	storage/virtstoraged.init.in \
+	$(NULL)
+
 VIRTSTORAGED_UNIT_VARS = \
 	$(VIRTD_UNIT_VARS) \
 	-e 's|[@]name[@]|Libvirt storage|g' \
@@ -180,6 +187,9 @@ VIRTSTORAGED_UNIT_VARS = \
 	-e 's|[@]sockprefix[@]|virtstoraged|g' \
 	$(NULL)
 
+virtstoraged.init: storage/virtstoraged.init.in $(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
 virtstoraged.service: storage/virtstoraged.service.in \
 		$(top_builddir)/config.status
 	$(AM_V_GEN)$(SED) $(VIRTSTORAGED_UNIT_VARS) $< > $@-t && mv $@-t $@
diff --git a/src/storage/virtstoraged.init.in b/src/storage/virtstoraged.init.in
new file mode 100644
index 0000000000..24e1a68af7
--- /dev/null
+++ b/src/storage/virtstoraged.init.in
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+
+description="Virtualization storage daemon"
+
+VIRTSTORAGED_OPTS=${VIRTSTORAGED_OPTS:-"${VIRTSTORAGED_OPTS}"}
+VIRTSTORAGED_TIMEOUT=${VIRTSTORAGED_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/virtstoraged"
+command_args="-d ${VIRTSTORAGED_OPTS}"
+pidfile="@runstatedir@/virtstoraged.pid"
+retry="${VIRTSTORAGED_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    use ceph dbus iscsid virtlockd
+    after nfs nfsmount
+}
+
+reload() {
+    ebegin "re-exec() virtstoraged"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
diff --git a/src/vbox/Makefile.inc.am b/src/vbox/Makefile.inc.am
index 37da9b0aae..57f7987dc8 100644
--- a/src/vbox/Makefile.inc.am
+++ b/src/vbox/Makefile.inc.am
@@ -92,6 +92,13 @@ SYSTEMD_UNIT_FILES_IN += \
 	vbox/virtvboxd.service.in \
 	$(NULL)
 
+OPENRC_INIT_FILES += \
+	virtvboxd.init \
+	$(NULL)
+OPENRC_INIT_FILES_IN += \
+	vbox/virtvboxd.init.in \
+	$(NULL)
+
 VIRTVBOXD_UNIT_VARS = \
 	$(VIRTD_UNIT_VARS) \
 	-e 's|[@]name[@]|Libvirt vbox|g' \
@@ -99,6 +106,9 @@ VIRTVBOXD_UNIT_VARS = \
 	-e 's|[@]sockprefix[@]|virtvboxd|g' \
 	$(NULL)
 
+virtvboxd.init: vbox/virtvboxd.init.in $(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
 virtvboxd.service: vbox/virtvboxd.service.in $(top_builddir)/config.status
 	$(AM_V_GEN)$(SED) $(VIRTVBOXD_UNIT_VARS) $< > $@-t && mv $@-t $@
 
diff --git a/src/vbox/virtvboxd.init.in b/src/vbox/virtvboxd.init.in
new file mode 100644
index 0000000000..dfee0409f6
--- /dev/null
+++ b/src/vbox/virtvboxd.init.in
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+
+description="Virtualization vbox daemon"
+
+VIRTVBOXD_OPTS=${VIRTVBOXD_OPTS:-"${VIRTVBOXD_OPTS}"}
+VIRTVBOXD_TIMEOUT=${VIRTVBOXD_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/virtvboxd"
+command_args="-d ${VIRTVBOXD_OPTS}"
+pidfile="@runstatedir@/virtvboxd.pid"
+retry="${VIRTVBOXD_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    use ceph dbus iscsid virtlockd
+    after nfs nfsmount
+}
+
+reload() {
+    ebegin "re-exec() virtvboxd"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
diff --git a/src/vz/Makefile.inc.am b/src/vz/Makefile.inc.am
index 7dd20e8013..e21eab6c92 100644
--- a/src/vz/Makefile.inc.am
+++ b/src/vz/Makefile.inc.am
@@ -67,6 +67,13 @@ SYSTEMD_UNIT_FILES_IN += \
 	vz/virtvzd.service.in \
 	$(NULL)
 
+OPENRC_INIT_FILES += \
+	virtvzd.init \
+	$(NULL)
+OPENRC_INIT_FILES_IN += \
+	vz/virtvzd.init.in \
+	$(NULL)
+
 VIRTVZD_UNIT_VARS = \
 	$(VIRTD_UNIT_VARS) \
 	-e 's|[@]name[@]|Libvirt vz|g' \
@@ -74,6 +81,9 @@ VIRTVZD_UNIT_VARS = \
 	-e 's|[@]sockprefix[@]|virtvzd|g' \
 	$(NULL)
 
+virtvzd.init: vz/virtvzd.init.in $(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(LIBVIRTD_INIT_VARS) $< > $@-t && mv $@-t $@
+
 virtvzd.service: vz/virtvzd.service.in $(top_builddir)/config.status
 	$(AM_V_GEN)$(SED) $(VIRTVZD_UNIT_VARS) $< > $@-t && mv $@-t $@
 
diff --git a/src/vz/virtvzd.init.in b/src/vz/virtvzd.init.in
new file mode 100644
index 0000000000..677419adeb
--- /dev/null
+++ b/src/vz/virtvzd.init.in
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+
+description="Virtualization vz daemon"
+
+VIRTVZD_OPTS=${VIRTVZD_OPTS:-"${VIRTVZD_OPTS}"}
+VIRTVZD_TIMEOUT=${VIRTVZD_TERMTIMEOUT:-"TERM/25/KILL/5"}
+
+command="@sbindir@/virtvzd"
+command_args="-d ${VIRTVZD_OPTS}"
+pidfile="@runstatedir@/virtvzd.pid"
+retry="${VIRTVZD_TERMTIMEOUT}"
+
+extra_started_commands="reload"
+description_reload="re-exec the daemon to enforce configuration reload"
+
+depend() {
+    use ceph dbus iscsid virtlockd
+    after nfs nfsmount
+}
+
+reload() {
+    ebegin "re-exec() virtvzd"
+
+    start-stop-daemon --signal SIGHUP \
+      --exec "${command}" --pidfile "${pidfile}"
+}
-- 
2.23.0




More information about the libvir-list mailing list