The virtvzd daemon will be responsible for providing the vz API
driver functionality. The vz driver is still loaded by the main
libvirtd daemon at this stage, so virtvzd must not be running at
the same time.
Reviewed-by: Andrea Bolognani <abologna(a)redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
.gitignore | 4 +++
src/vz/Makefile.inc.am | 63 +++++++++++++++++++++++++++++++++++++++
src/vz/virtvzd.service.in | 25 ++++++++++++++++
3 files changed, 92 insertions(+)
create mode 100644 src/vz/virtvzd.service.in
diff --git a/.gitignore b/.gitignore
index 5a7ca221e8..dd5d35c762 100644
--- a/.gitignore
+++ b/.gitignore
@@ -217,7 +217,11 @@
/src/virtsecretd
/src/virtstoraged
/src/virtvboxd
+/src/virtvzd
/src/virt-guest-shutdown.target
+/src/vz/test_virtvzd.aug
+/src/vz/virtvzd.aug
+/src/vz/virtvzd.conf
/tests/*.log
/tests/*.pid
/tests/*.trs
diff --git a/src/vz/Makefile.inc.am b/src/vz/Makefile.inc.am
index a3a146c627..f56fceb8f7 100644
--- a/src/vz/Makefile.inc.am
+++ b/src/vz/Makefile.inc.am
@@ -37,4 +37,67 @@ libvirt_driver_vz_impl_la_LIBADD = \
$(PARALLELS_SDK_LIBS) \
$(LIBNL_LIBS) \
$(NULL)
+
+sbin_PROGRAMS += virtvzd
+
+nodist_conf_DATA += vz/virtvzd.conf
+augeas_DATA += vz/virtvzd.aug
+augeastest_DATA += vz/test_virtvzd.aug
+CLEANFILES += vz/virtvzd.aug
+
+virtvzd_SOURCES = $(REMOTE_DAEMON_SOURCES)
+virtvzd_CFLAGS = \
+ $(REMOTE_DAEMON_CFLAGS) \
+ -DDAEMON_NAME="\"virtvzd\"" \
+ -DMODULE_NAME="\"vz\"" \
+ $(NULL)
+virtvzd_LDFLAGS = $(REMOTE_DAEMON_LD_FLAGS)
+virtvzd_LDADD = $(REMOTE_DAEMON_LD_ADD)
+
+SYSTEMD_UNIT_FILES += \
+ virtvzd.service \
+ virtvzd.socket \
+ virtvzd-ro.socket \
+ virtvzd-admin.socket \
+ $(NULL)
+SYSTEMD_UNIT_FILES_IN += \
+ vz/virtvzd.service.in \
+ $(NULL)
+
+VIRTVZD_UNIT_VARS = \
+ $(VIRTD_UNIT_VARS) \
+ -e 's|[@]name[@]|Libvirt vz|g' \
+ -e 's|[@]service[@]|virtvzd|g' \
+ -e 's|[@]sockprefix[@]|virtvzd|g' \
+ $(NULL)
+
+virtvzd.service: vz/virtvzd.service.in $(top_builddir)/config.status
+ $(AM_V_GEN)$(SED) $(VIRTVZD_UNIT_VARS) $< > $@-t && mv $@-t $@
+
+virtvz%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
+ $(AM_V_GEN)$(SED) $(VIRTVZD_UNIT_VARS) $< > $@-t && mv $@-t $@
+
+vz/virtvzd.conf: remote/libvirtd.conf.in
+ $(AM_V_GEN)$(SED) \
+ -e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
+ -e 's/[@]DAEMON_NAME[@]/virtvzd/' \
+ $< > $@
+
+vz/virtvzd.aug: remote/libvirtd.aug.in
+ $(AM_V_GEN)$(SED) \
+ -e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
+ -e 's/[@]DAEMON_NAME[@]/virtvzd/' \
+ -e 's/[@]DAEMON_NAME_UC[@]/Virtvzd/' \
+ $< > $@
+
+vz/test_virtvzd.aug: remote/test_libvirtd.aug.in \
+ vz/virtvzd.conf $(AUG_GENTEST)
+ $(AM_V_GEN)$(AUG_GENTEST) vz/virtvzd.conf \
+ $(srcdir)/remote/test_libvirtd.aug.in | \
+ $(SED) \
+ -e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
+ -e 's/[@]DAEMON_NAME[@]/virtvzd/' \
+ -e 's/[@]DAEMON_NAME_UC[@]/Virtvzd/' \
+ > $@ || rm -f $@
+
endif WITH_VZ
diff --git a/src/vz/virtvzd.service.in b/src/vz/virtvzd.service.in
new file mode 100644
index 0000000000..cd0f558768
--- /dev/null
+++ b/src/vz/virtvzd.service.in
@@ -0,0 +1,25 @@
+[Unit]
+Description=Virtualization vz daemon
+Conflicts=libvirtd.service
+Requires=virtvzd.socket
+Requires=virtvzd-ro.socket
+Requires=virtvzd-admin.socket
+After=network.target
+After=dbus.service
+After=apparmor.service
+After=local-fs.target
+After=remote-fs.target
+Documentation=man:libvirtd(8)
+Documentation=https://libvirt.org
+
+[Service]
+Type=notify
+ExecStart=@sbindir@/virtvzd --timeout 120
+ExecReload=/bin/kill -HUP $MAINPID
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
+Also=virtvzd.socket
+Also=virtvzd-ro.socket
+Also=virtvzd-admin.socket
--
2.21.0