The virtnetworkd daemon will be responsible for providing the network API driver functionality. The network driver is still loaded by the main libvirtd daemon at this stage, so virtnetworkd must not be running at the same time. Reviewed-by: Andrea Bolognani <abologna@xxxxxxxxxx> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> --- .gitignore | 4 ++ libvirt.spec.in | 8 ++++ src/network/Makefile.inc.am | 61 +++++++++++++++++++++++++++++ src/network/virtnetworkd.service.in | 25 ++++++++++++ 4 files changed, 98 insertions(+) create mode 100644 src/network/virtnetworkd.service.in diff --git a/.gitignore b/.gitignore index 162b017c4a..4101bb4564 100644 --- a/.gitignore +++ b/.gitignore @@ -154,6 +154,9 @@ /src/lxc/lxc_monitor_protocol.h /src/lxc/lxc_protocol.[ch] /src/lxc/test_libvirtd_lxc.aug +/src/network/test_virtnetworkd.aug +/src/network/virtnetworkd.aug +/src/network/virtnetworkd.conf /src/qemu/test_libvirtd_qemu.aug /src/remote/*_client_bodies.h /src/remote/*_protocol.[ch] @@ -174,6 +177,7 @@ /src/virt-aa-helper /src/virtlockd /src/virtlogd +/src/virtnetworkd /src/virtproxyd /src/virtsecretd /src/virt-guest-shutdown.target diff --git a/libvirt.spec.in b/libvirt.spec.in index 7eeb2b4f07..52a671d908 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1612,6 +1612,14 @@ exit 0 %{_libdir}/%{name}/connection-driver/libvirt_driver_interface.so %files daemon-driver-network +%config(noreplace) %{_sysconfdir}/libvirt/virtnetworkd.conf +%{_datadir}/augeas/lenses/virtnetworkd.aug +%{_datadir}/augeas/lenses/tests/test_virtnetworkd.aug +%{_unitdir}/virtnetworkd.service +%{_unitdir}/virtnetworkd.socket +%{_unitdir}/virtnetworkd-ro.socket +%{_unitdir}/virtnetworkd-admin.socket +%attr(0755, root, root) %{_sbindir}/virtnetworkd %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/ %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/ %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/autostart diff --git a/src/network/Makefile.inc.am b/src/network/Makefile.inc.am index 23cf39b6f4..672142452e 100644 --- a/src/network/Makefile.inc.am +++ b/src/network/Makefile.inc.am @@ -49,6 +49,67 @@ libvirt_driver_network_impl_la_CFLAGS = \ libvirt_driver_network_impl_la_SOURCES = $(NETWORK_DRIVER_SOURCES) libvirt_driver_network_impl_la_LIBADD = $(DBUS_LIBS) $(LIBXML_LIBS) +sbin_PROGRAMS += virtnetworkd + +nodist_conf_DATA += network/virtnetworkd.conf +augeas_DATA += network/virtnetworkd.aug +augeastest_DATA += network/test_virtnetworkd.aug +CLEANFILES += network/virtnetworkd.aug + +virtnetworkd_SOURCES = $(REMOTE_DAEMON_SOURCES) +virtnetworkd_CFLAGS = \ + $(REMOTE_DAEMON_CFLAGS) \ + -DDAEMON_NAME="\"virtnetworkd\"" \ + -DMODULE_NAME="\"network\"" \ + $(NULL) +virtnetworkd_LDFLAGS = $(REMOTE_DAEMON_LD_FLAGS) +virtnetworkd_LDADD = $(REMOTE_DAEMON_LD_ADD) + +SYSTEMD_UNIT_FILES += \ + virtnetworkd.service \ + virtnetworkd.socket \ + virtnetworkd-ro.socket \ + virtnetworkd-admin.socket \ + $(NULL) +SYSTEMD_UNIT_FILES_IN += \ + network/virtnetworkd.service.in \ + $(NULL) + +VIRTNETWORKD_UNIT_VARS = \ + $(VIRTD_UNIT_VARS) \ + -e 's|[@]name[@]|Libvirt network|g' \ + -e 's|[@]service[@]|virtnetworkd|g' \ + -e 's|[@]sockprefix[@]|virtnetworkd|g' \ + $(NULL) + +virtnetworkd.service: network/virtnetworkd.service.in $(top_builddir)/config.status + $(AM_V_GEN)sed $(VIRTNETWORKD_UNIT_VARS) < $< > $@-t && mv $@-t $@ + +virtnetwork%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status + $(AM_V_GEN)sed $(VIRTNETWORKD_UNIT_VARS) < $< > $@-t && mv $@-t $@ + +network/virtnetworkd.conf: remote/libvirtd.conf.in + $(AM_V_GEN)sed \ + -e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \ + -e 's/[@]DAEMON_NAME[@]/virtnetworkd/' \ + < $^ > $@ + +network/virtnetworkd.aug: remote/libvirtd.aug.in + $(AM_V_GEN)$(SED) \ + -e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \ + -e 's/[@]DAEMON_NAME[@]/virtnetworkd/' \ + -e 's/[@]DAEMON_NAME_UC[@]/Virtnetworkd/' \ + $< > $@ + +network/test_virtnetworkd.aug: remote/test_libvirtd.aug.in \ + network/virtnetworkd.conf $(AUG_GENTEST) + $(AM_V_GEN)$(AUG_GENTEST) network/virtnetworkd.conf \ + $(srcdir)/remote/test_libvirtd.aug.in | \ + $(SED) -e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \ + -e 's/[@]DAEMON_NAME[@]/virtnetworkd/' \ + -e 's/[@]DAEMON_NAME_UC[@]/Virtnetworkd/' \ + > $@ || rm -f $@ + libexec_PROGRAMS += libvirt_leaseshelper libvirt_leaseshelper_SOURCES = $(NETWORK_LEASES_HELPER_SOURCES) libvirt_leaseshelper_LDFLAGS = \ diff --git a/src/network/virtnetworkd.service.in b/src/network/virtnetworkd.service.in new file mode 100644 index 0000000000..656e8b4f84 --- /dev/null +++ b/src/network/virtnetworkd.service.in @@ -0,0 +1,25 @@ +[Unit] +Description=Virtualization network daemon +Conflicts=libvirtd.service +Requires=virtnetworkd.socket +Requires=virtnetworkd-ro.socket +Requires=virtnetworkd-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@/virtnetworkd --timeout 120 +ExecReload=/bin/kill -HUP $MAINPID +Restart=on-failure +KillMode=process + +[Install] +WantedBy=multi-user.target +Also=virtnetworkd.socket +Also=virtnetworkd-ro.socket +Also=virtnetworkd-admin.socket -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list