[PATCH 22/41] interface: introduce virtinterfaced daemon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 .gitignore                              |  4 ++
 libvirt.spec.in                         |  8 ++++
 src/interface/Makefile.inc.am           | 62 +++++++++++++++++++++++++
 src/interface/virtinterfaced.service.in | 24 ++++++++++
 4 files changed, 98 insertions(+)
 create mode 100644 src/interface/virtinterfaced.service.in

diff --git a/.gitignore b/.gitignore
index 4101bb4564..c361d87868 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
@@ -175,6 +178,7 @@
 /src/util/virkeycodetable*.h
 /src/util/virkeynametable*.h
 /src/virt-aa-helper
+/src/virtinterfaced
 /src/virtlockd
 /src/virtlogd
 /src/virtnetworkd
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 4569f59a98..25bd2a359d 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -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
diff --git a/src/interface/Makefile.inc.am b/src/interface/Makefile.inc.am
index 339a92786b..0476eb7de2 100644
--- a/src/interface/Makefile.inc.am
+++ b/src/interface/Makefile.inc.am
@@ -41,4 +41,66 @@ 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
diff --git a/src/interface/virtinterfaced.service.in b/src/interface/virtinterfaced.service.in
new file mode 100644
index 0000000000..ff3a611d16
--- /dev/null
+++ b/src/interface/virtinterfaced.service.in
@@ -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
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux