network: introduce virtnetworkd daemon

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: 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 d353d57fcd
commit 1c27cef1e3
4 changed files with 99 additions and 0 deletions

4
.gitignore vendored
View File

@ -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]
@ -175,6 +178,7 @@
/src/virt-aa-helper
/src/virtlockd
/src/virtlogd
/src/virtnetworkd
/src/virtproxyd
/src/virtsecretd
/src/virt-guest-shutdown.target

View File

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

View File

@ -49,6 +49,68 @@ 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 = \

View File

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