libxl: introduce virtxend daemon

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.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2018-03-16 17:05:24 +00:00
parent 653ddc2e64
commit 12e30d1e54
4 changed files with 104 additions and 0 deletions

4
.gitignore vendored
View File

@ -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
@ -189,6 +192,7 @@
/src/util/virkeynametable*.h
/src/virt-aa-helper
/src/virtinterfaced
/src/virtxend
/src/virtlockd
/src/virtlogd
/src/virtnetworkd

View File

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

View File

@ -65,6 +65,69 @@ 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 = \
$(COMMON_UNIT_VARS) \
-e 's|[@]deps[@]|Conflicts=$(LIBVIRTD_SOCKET_UNIT_FILES)\nConditionPathExists=/proc/xen/capabilities|g' \
-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

View File

@ -0,0 +1,29 @@
[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
After=remote-fs.target
After=xencommons.service
Conflicts=xendomains.service
Documentation=man:libvirtd(8)
Documentation=https://libvirt.org
ConditionPathExists=/proc/xen/capabilities
[Service]
Type=notify
ExecStart=@sbindir@/virtxend --timeout 120
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
KillMode=process
[Install]
WantedBy=multi-user.target
Also=virtxend.socket
Also=virtxend-ro.socket
Also=virtxend-admin.socket