interface: introduce virtinterfaced daemon

The virtinterfaced daemon will be responsible for providing the interface API
driver functionality. The interface driver is still loaded by the main
libvirtd daemon at this stage, so virtinterfaced must not be running at
the same time.

Reviewed-by: Christophe de Dinechin <dinechin@redhat.com>
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 1c27cef1e3
commit 62d817a328
4 changed files with 99 additions and 0 deletions

4
.gitignore vendored
View File

@ -120,6 +120,9 @@
/src/admin/admin_server_dispatch_stubs.h
/src/esx/*.generated.*
/src/hyperv/*.generated.*
/src/interface/test_virtinterfaced.aug
/src/interface/virtinterfaced.aug
/src/interface/virtinterfaced.conf
/src/libvirt*.def
/src/libvirt.syms
/src/libvirt_access.syms
@ -176,6 +179,7 @@
/src/util/virkeycodetable*.h
/src/util/virkeynametable*.h
/src/virt-aa-helper
/src/virtinterfaced
/src/virtlockd
/src/virtlogd
/src/virtnetworkd

View File

@ -1609,6 +1609,14 @@ exit 0
%ghost %{_sysconfdir}/libvirt/nwfilter/*.xml
%files daemon-driver-interface
%config(noreplace) %{_sysconfdir}/libvirt/virtinterfaced.conf
%{_datadir}/augeas/lenses/virtinterfaced.aug
%{_datadir}/augeas/lenses/tests/test_virtinterfaced.aug
%{_unitdir}/virtinterfaced.service
%{_unitdir}/virtinterfaced.socket
%{_unitdir}/virtinterfaced-ro.socket
%{_unitdir}/virtinterfaced-admin.socket
%attr(0755, root, root) %{_sbindir}/virtinterfaced
%{_libdir}/%{name}/connection-driver/libvirt_driver_interface.so
%files daemon-driver-network

View File

@ -41,4 +41,67 @@ libvirt_driver_interface_la_LIBADD += $(UDEV_LIBS)
libvirt_driver_interface_la_SOURCES += $(INTERFACE_DRIVER_UDEV_SOURCES)
endif WITH_UDEV
libvirt_driver_interface_la_LIBADD += ../gnulib/lib/libgnu.la
sbin_PROGRAMS += virtinterfaced
nodist_conf_DATA += interface/virtinterfaced.conf
augeas_DATA += interface/virtinterfaced.aug
augeastest_DATA += interface/test_virtinterfaced.aug
CLEANFILES += interface/virtinterfaced.aug
virtinterfaced_SOURCES = $(REMOTE_DAEMON_SOURCES)
virtinterfaced_CFLAGS = \
$(REMOTE_DAEMON_CFLAGS) \
-DDAEMON_NAME="\"virtinterfaced\"" \
-DMODULE_NAME="\"interface\"" \
$(NULL)
virtinterfaced_LDFLAGS = $(REMOTE_DAEMON_LD_FLAGS)
virtinterfaced_LDADD = $(REMOTE_DAEMON_LD_ADD)
SYSTEMD_UNIT_FILES += \
virtinterfaced.service \
virtinterfaced.socket \
virtinterfaced-ro.socket \
virtinterfaced-admin.socket \
$(NULL)
SYSTEMD_UNIT_FILES_IN += \
interface/virtinterfaced.service.in \
$(NULL)
VIRTINTERFACED_UNIT_VARS = \
$(VIRTD_UNIT_VARS) \
-e 's|[@]name[@]|Libvirt interface|g' \
-e 's|[@]service[@]|virtinterfaced|g' \
-e 's|[@]sockprefix[@]|virtinterfaced|g' \
$(NULL)
virtinterfaced.service: interface/virtinterfaced.service.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(VIRTINTERFACED_UNIT_VARS) $< > $@-t && mv $@-t $@
virtinterface%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(VIRTINTERFACED_UNIT_VARS) $< > $@-t && mv $@-t $@
interface/virtinterfaced.conf: remote/libvirtd.conf.in
$(AM_V_GEN)$(SED) \
-e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
-e 's/[@]DAEMON_NAME[@]/virtinterfaced/' \
$< > $@
interface/virtinterfaced.aug: remote/libvirtd.aug.in
$(AM_V_GEN)$(SED) \
-e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
-e 's/[@]DAEMON_NAME[@]/virtinterfaced/' \
-e 's/[@]DAEMON_NAME_UC[@]/Virtinterfaced/' \
$< > $@
interface/test_virtinterfaced.aug: remote/test_libvirtd.aug.in \
interface/virtinterfaced.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) interface/virtinterfaced.conf \
$(srcdir)/remote/test_libvirtd.aug.in | \
$(SED) \
-e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
-e 's/[@]DAEMON_NAME[@]/virtinterfaced/' \
-e 's/[@]DAEMON_NAME_UC[@]/Virtinterfaced/' \
> $@ || rm -f $@
endif WITH_INTERFACE

View File

@ -0,0 +1,24 @@
[Unit]
Description=Virtualization interface daemon
Conflicts=libvirtd.service
Requires=virtinterfaced.socket
Requires=virtinterfaced-ro.socket
Requires=virtinterfaced-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@/virtinterfaced --timeout 120
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
Also=virtinterfaced.socket
Also=virtinterfaced-ro.socket
Also=virtinterfaced-admin.socket