The virtxend daemon will be responsible for providing the libxl API
driver functionality. The libxl driver is still loaded by the main
libvirtd daemon at this stage, so virtxend must not be running at
the same time.
This naming is slightly different than other drivers. With the libxl
driver, the user still has a 'xen:///system' URI, and we provide it
in a libvirt-daemon-xen RPM, which pulls in a
libvirt-daemon-driver-libxl RPM.
Arguably we could rename the libxl driver to "xen" since it is the
only xen driver we have these days, and that matches how we expose it
to users in the URI naming.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
.gitignore | 4 +++
libvirt.spec.in | 8 +++++
src/libxl/Makefile.inc.am | 61 +++++++++++++++++++++++++++++++++++
src/libxl/virtxend.service.in | 24 ++++++++++++++
4 files changed, 97 insertions(+)
create mode 100644 src/libxl/virtxend.service.in
diff --git a/.gitignore b/.gitignore
index b93fd1b044..1c746cec44 100644
--- a/.gitignore
+++ b/.gitignore
@@ -139,6 +139,9 @@
/src/libvirtd
/src/libvirtd*.logrotate
/src/libxl/test_libvirtd_libxl.aug
+/src/libxl/test_virtxend.aug
+/src/libxl/virtxend.aug
+/src/libxl/virtxend.conf
/src/locking/libxl-lockd.conf
/src/locking/libxl-sanlock.conf
/src/locking/lock_daemon_dispatch_stubs.h
@@ -188,6 +191,7 @@
/src/util/virkeynametable*.h
/src/virt-aa-helper
/src/virtinterfaced
+/src/virtxend
/src/virtlockd
/src/virtlogd
/src/virtnetworkd
diff --git a/libvirt.spec.in b/libvirt.spec.in
index ae1a278152..06e8666bc5 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1765,6 +1765,14 @@ exit 0
%if %{with_libxl}
%files daemon-driver-libxl
+%config(noreplace) %{_sysconfdir}/libvirt/virtxend.conf
+%{_datadir}/augeas/lenses/virtxend.aug
+%{_datadir}/augeas/lenses/tests/test_virtxend.aug
+%{_unitdir}/virtxend.service
+%{_unitdir}/virtxend.socket
+%{_unitdir}/virtxend-ro.socket
+%{_unitdir}/virtxend-admin.socket
+%attr(0755, root, root) %{_sbindir}/virtxend
%config(noreplace) %{_sysconfdir}/libvirt/libxl.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.libxl
%config(noreplace) %{_sysconfdir}/libvirt/libxl-lockd.conf
diff --git a/src/libxl/Makefile.inc.am b/src/libxl/Makefile.inc.am
index 467c2720b2..0079760488 100644
--- a/src/libxl/Makefile.inc.am
+++ b/src/libxl/Makefile.inc.am
@@ -65,6 +65,67 @@ libvirt_driver_libxl_impl_la_LIBADD = \
$(NULL)
libvirt_driver_libxl_impl_la_SOURCES = $(LIBXL_DRIVER_SOURCES)
+sbin_PROGRAMS += virtxend
+
+nodist_conf_DATA += libxl/virtxend.conf
+augeas_DATA += libxl/virtxend.aug
+augeastest_DATA += libxl/test_virtxend.aug
+CLEANFILES += libxl/virtxend.aug
+
+virtxend_SOURCES = $(REMOTE_DAEMON_SOURCES)
+virtxend_CFLAGS = \
+ $(REMOTE_DAEMON_CFLAGS) \
+ -DDAEMON_NAME="\"virtxend\"" \
+ -DMODULE_NAME="\"libxl\"" \
+ $(NULL)
+virtxend_LDFLAGS = $(REMOTE_DAEMON_LD_FLAGS)
+virtxend_LDADD = $(REMOTE_DAEMON_LD_ADD)
+
+SYSTEMD_UNIT_FILES += \
+ virtxend.service \
+ virtxend.socket \
+ virtxend-ro.socket \
+ virtxend-admin.socket \
+ $(NULL)
+SYSTEMD_UNIT_FILES_IN += \
+ libxl/virtxend.service.in \
+ $(NULL)
+
+VIRTXEND_UNIT_VARS = \
+ $(VIRTD_UNIT_VARS) \
+ -e 's|[@]name[@]|Libvirt libxl|g' \
+ -e 's|[@]service[@]|virtxend|g' \
+ -e 's|[@]sockprefix[@]|virtxend|g' \
+ $(NULL)
+
+virtxend.service: libxl/virtxend.service.in $(top_builddir)/config.status
+ $(AM_V_GEN)sed $(VIRTXEND_UNIT_VARS) < $< > $@-t && mv $@-t $@
+
+virtxen%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
+ $(AM_V_GEN)sed $(VIRTXEND_UNIT_VARS) < $< > $@-t && mv $@-t $@
+
+libxl/virtxend.conf: remote/libvirtd.conf.in
+ $(AM_V_GEN)sed \
+ -e '/:: CUT ENABLE_IP ::/,/:: END ::/d' \
+ -e 's/:: DAEMON_NAME ::/virtxend/' \
+ < $^ > $@
+
+libxl/virtxend.aug: remote/libvirtd.aug.in
+ $(AM_V_GEN)$(SED) \
+ -e '/:: CUT ENABLE_IP ::/,/:: END ::/d' \
+ -e 's/:: DAEMON_NAME ::/virtxend/' \
+ -e 's/:: DAEMON_NAME_UC ::/Virtxend/' \
+ $< > $@
+
+libxl/test_virtxend.aug: remote/test_libvirtd.aug.in \
+ libxl/virtxend.conf $(AUG_GENTEST)
+ $(AM_V_GEN)$(AUG_GENTEST) libxl/virtxend.conf \
+ $(srcdir)/remote/test_libvirtd.aug.in | \
+ $(SED) -e '/:: CUT ENABLE_IP ::/,/:: END ::/d' \
+ -e 's/:: DAEMON_NAME ::/virtxend/' \
+ -e 's/:: DAEMON_NAME_UC ::/Virtxend/' \
+ > $@ || rm -f $@
+
conf_DATA += libxl/libxl.conf
augeas_DATA += libxl/libvirtd_libxl.aug
augeastest_DATA += libxl/test_libvirtd_libxl.aug
diff --git a/src/libxl/virtxend.service.in b/src/libxl/virtxend.service.in
new file mode 100644
index 0000000000..fdb0ccd312
--- /dev/null
+++ b/src/libxl/virtxend.service.in
@@ -0,0 +1,24 @@
+[Unit]
+Description=Virtualization xen daemon
+Conflicts=libvirtd.service
+Requires=virtxend.socket
+Requires=virtxend-ro.socket
+Requires=virtxend-admin.socket
+After=network.target
+After=dbus.service
+After=apparmor.service
+After=local-fs.target
+Documentation=man:libvirtd(8)
+Documentation=https://libvirt.org
+
+[Service]
+Type=notify
+ExecStart=@sbindir@/virtxend --timeout 120
+ExecReload=/bin/kill -HUP $MAINPID
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
+Also=virtxend.socket
+Also=virtxend-ro.socket
+Also=virtxend-admin.socket
--
2.21.0