nodedev: introduce virtnodedevd daemon

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

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 e23d5b0435
commit e4de8857ad
4 changed files with 99 additions and 0 deletions

4
.gitignore vendored
View File

@ -160,6 +160,9 @@
/src/network/test_virtnetworkd.aug
/src/network/virtnetworkd.aug
/src/network/virtnetworkd.conf
/src/node_device/test_virtnodedevd.aug
/src/node_device/virtnodedevd.aug
/src/node_device/virtnodedevd.conf
/src/qemu/test_libvirtd_qemu.aug
/src/remote/*_client_bodies.h
/src/remote/*_protocol.[ch]
@ -186,6 +189,7 @@
/src/virtlockd
/src/virtlogd
/src/virtnetworkd
/src/virtnodedevd
/src/virtproxyd
/src/virtsecretd
/src/virtstoraged

View File

@ -1642,6 +1642,14 @@ exit 0
%endif
%files daemon-driver-nodedev
%config(noreplace) %{_sysconfdir}/libvirt/virtnodedevd.conf
%{_datadir}/augeas/lenses/virtnodedevd.aug
%{_datadir}/augeas/lenses/tests/test_virtnodedevd.aug
%{_unitdir}/virtnodedevd.service
%{_unitdir}/virtnodedevd.socket
%{_unitdir}/virtnodedevd-ro.socket
%{_unitdir}/virtnodedevd-admin.socket
%attr(0755, root, root) %{_sbindir}/virtnodedevd
%{_libdir}/%{name}/connection-driver/libvirt_driver_nodedev.so
%files daemon-driver-nwfilter

View File

@ -64,4 +64,67 @@ libvirt_driver_nodedev_la_LIBADD += \
endif WITH_UDEV
libvirt_driver_nodedev_la_LIBADD += ../gnulib/lib/libgnu.la
sbin_PROGRAMS += virtnodedevd
nodist_conf_DATA += node_device/virtnodedevd.conf
augeas_DATA += node_device/virtnodedevd.aug
augeastest_DATA += node_device/test_virtnodedevd.aug
CLEANFILES += node_device/virtnodedevd.aug
virtnodedevd_SOURCES = $(REMOTE_DAEMON_SOURCES)
virtnodedevd_CFLAGS = \
$(REMOTE_DAEMON_CFLAGS) \
-DDAEMON_NAME="\"virtnodedevd\"" \
-DMODULE_NAME="\"nodedev\"" \
$(NULL)
virtnodedevd_LDFLAGS = $(REMOTE_DAEMON_LD_FLAGS)
virtnodedevd_LDADD = $(REMOTE_DAEMON_LD_ADD)
SYSTEMD_UNIT_FILES += \
virtnodedevd.service \
virtnodedevd.socket \
virtnodedevd-ro.socket \
virtnodedevd-admin.socket \
$(NULL)
SYSTEMD_UNIT_FILES_IN += \
node_device/virtnodedevd.service.in \
$(NULL)
VIRTNODEDEVD_UNIT_VARS = \
$(VIRTD_UNIT_VARS) \
-e 's|[@]name[@]|Libvirt nodedev|g' \
-e 's|[@]service[@]|virtnodedevd|g' \
-e 's|[@]sockprefix[@]|virtnodedevd|g' \
$(NULL)
virtnodedevd.service: node_device/virtnodedevd.service.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(VIRTNODEDEVD_UNIT_VARS) $< > $@-t && mv $@-t $@
virtnodedev%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(VIRTNODEDEVD_UNIT_VARS) $< > $@-t && mv $@-t $@
node_device/virtnodedevd.conf: remote/libvirtd.conf.in
$(AM_V_GEN)$(SED) \
-e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
-e 's/[@]DAEMON_NAME[@]/virtnodedevd/' \
$< > $@
node_device/virtnodedevd.aug: remote/libvirtd.aug.in
$(AM_V_GEN)$(SED) \
-e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
-e 's/[@]DAEMON_NAME[@]/virtnodedevd/' \
-e 's/[@]DAEMON_NAME_UC[@]/Virtnodedevd/' \
$< > $@
node_device/test_virtnodedevd.aug: remote/test_libvirtd.aug.in \
node_device/virtnodedevd.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) node_device/virtnodedevd.conf \
$(srcdir)/remote/test_libvirtd.aug.in | \
$(SED) \
-e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
-e 's/[@]DAEMON_NAME[@]/virtnodedevd/' \
-e 's/[@]DAEMON_NAME_UC[@]/Virtnodedevd/' \
> $@ || rm -f $@
endif WITH_NODE_DEVICES

View File

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