From e4de8857adcabeed1ed463983a373157ee0d2e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 16 Mar 2018 17:05:24 +0000 Subject: [PATCH] nodedev: introduce virtnodedevd daemon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Daniel P. Berrangé --- .gitignore | 4 ++ libvirt.spec.in | 8 ++++ src/node_device/Makefile.inc.am | 63 +++++++++++++++++++++++++ src/node_device/virtnodedevd.service.in | 24 ++++++++++ 4 files changed, 99 insertions(+) create mode 100644 src/node_device/virtnodedevd.service.in diff --git a/.gitignore b/.gitignore index 58a1ef1293..c4f6c0ab2f 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/libvirt.spec.in b/libvirt.spec.in index 35288b0e2d..a3c01e7d21 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -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 diff --git a/src/node_device/Makefile.inc.am b/src/node_device/Makefile.inc.am index 3e04651e8c..5a6525d843 100644 --- a/src/node_device/Makefile.inc.am +++ b/src/node_device/Makefile.inc.am @@ -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 diff --git a/src/node_device/virtnodedevd.service.in b/src/node_device/virtnodedevd.service.in new file mode 100644 index 0000000000..132ee05a7f --- /dev/null +++ b/src/node_device/virtnodedevd.service.in @@ -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 -- GitLab