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

[libvirt] [PATCH v4 28/42] qemu: introduce virtqemud daemon



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

Reviewed-by: Andrea Bolognani <abologna redhat com>
Signed-off-by: Daniel P. Berrangé <berrange redhat com>
---
 .gitignore                    |  4 +++
 libvirt.spec.in               |  8 +++++
 src/qemu/Makefile.inc.am      | 62 +++++++++++++++++++++++++++++++++++
 src/qemu/virtqemud.service.in | 40 ++++++++++++++++++++++
 4 files changed, 114 insertions(+)
 create mode 100644 src/qemu/virtqemud.service.in

diff --git a/.gitignore b/.gitignore
index 0c6fa0c771..67962a696e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -170,6 +170,9 @@
 /src/nwfilter/virtnwfilterd.aug
 /src/nwfilter/virtnwfilterd.conf
 /src/qemu/test_libvirtd_qemu.aug
+/src/qemu/test_virtqemud.aug
+/src/qemu/virtqemud.aug
+/src/qemu/virtqemud.conf
 /src/remote/*_client_bodies.h
 /src/remote/*_protocol.[ch]
 /src/remote/*_stubs.h
@@ -199,6 +202,7 @@
 /src/virtnodedevd
 /src/virtnwfilterd
 /src/virtproxyd
+/src/virtqemud
 /src/virtsecretd
 /src/virtstoraged
 /src/virt-guest-shutdown.target
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 9615fff19b..d1093db847 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1735,6 +1735,14 @@ exit 0
 
 %if %{with_qemu}
 %files daemon-driver-qemu
+%config(noreplace) %{_sysconfdir}/libvirt/virtqemud.conf
+%{_datadir}/augeas/lenses/virtqemud.aug
+%{_datadir}/augeas/lenses/tests/test_virtqemud.aug
+%{_unitdir}/virtqemud.service
+%{_unitdir}/virtqemud.socket
+%{_unitdir}/virtqemud-ro.socket
+%{_unitdir}/virtqemud-admin.socket
+%attr(0755, root, root) %{_sbindir}/virtqemud
 %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/
 %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
 %config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am
index 12236a9e7b..30a9751cfd 100644
--- a/src/qemu/Makefile.inc.am
+++ b/src/qemu/Makefile.inc.am
@@ -112,6 +112,68 @@ CLEANFILES += \
 
 endif WITH_DTRACE_PROBES
 
+sbin_PROGRAMS += virtqemud
+
+nodist_conf_DATA += qemu/virtqemud.conf
+augeas_DATA += qemu/virtqemud.aug
+augeastest_DATA += qemu/test_virtqemud.aug
+CLEANFILES += qemu/virtqemud.aug
+
+virtqemud_SOURCES = $(REMOTE_DAEMON_SOURCES)
+virtqemud_CFLAGS = \
+       $(REMOTE_DAEMON_CFLAGS) \
+       -DDAEMON_NAME="\"virtqemud\"" \
+       -DMODULE_NAME="\"qemu\"" \
+       $(NULL)
+virtqemud_LDFLAGS = $(REMOTE_DAEMON_LD_FLAGS)
+virtqemud_LDADD = $(REMOTE_DAEMON_LD_ADD)
+
+SYSTEMD_UNIT_FILES += \
+	virtqemud.service \
+	virtqemud.socket \
+	virtqemud-ro.socket \
+	virtqemud-admin.socket \
+	$(NULL)
+SYSTEMD_UNIT_FILES_IN += \
+	qemu/virtqemud.service.in \
+	$(NULL)
+
+VIRTQEMUD_UNIT_VARS = \
+	$(VIRTD_UNIT_VARS) \
+	-e 's|[ ]name[@]|Libvirt qemu|g' \
+	-e 's|[ ]service[@]|virtqemud|g' \
+	-e 's|[ ]sockprefix[@]|virtqemud|g' \
+	$(NULL)
+
+virtqemud.service: qemu/virtqemud.service.in $(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(VIRTQEMUD_UNIT_VARS) $< > $ -t && mv $ -t $@
+
+virtqemu%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
+	$(AM_V_GEN)$(SED) $(VIRTQEMUD_UNIT_VARS) $< > $ -t && mv $ -t $@
+
+qemu/virtqemud.conf: remote/libvirtd.conf.in
+	$(AM_V_GEN)$(SED) \
+		-e '/[ ]CUT_ENABLE_IP[@]/,/[ ]END[@]/d' \
+		-e 's/[ ]DAEMON_NAME[@]/virtqemud/' \
+		$< > $@
+
+qemu/virtqemud.aug: remote/libvirtd.aug.in
+	$(AM_V_GEN)$(SED) \
+		-e '/[ ]CUT_ENABLE_IP[@]/,/[ ]END[@]/d' \
+		-e 's/[ ]DAEMON_NAME[@]/virtqemud/' \
+		-e 's/[ ]DAEMON_NAME_UC[@]/Virtqemud/' \
+		$< > $@
+
+qemu/test_virtqemud.aug: remote/test_libvirtd.aug.in \
+		qemu/virtqemud.conf $(AUG_GENTEST)
+	$(AM_V_GEN)$(AUG_GENTEST) qemu/virtqemud.conf \
+		$(srcdir)/remote/test_libvirtd.aug.in | \
+		$(SED) \
+		-e '/[ ]CUT_ENABLE_IP[@]/,/[ ]END[@]/d' \
+		-e 's/[ ]DAEMON_NAME[@]/virtqemud/' \
+		-e 's/[ ]DAEMON_NAME_UC[@]/Virtqemud/' \
+		> $@ || rm -f $@
+
 conf_DATA += qemu/qemu.conf
 
 augeas_DATA += qemu/libvirtd_qemu.aug
diff --git a/src/qemu/virtqemud.service.in b/src/qemu/virtqemud.service.in
new file mode 100644
index 0000000000..44eb2a2bf7
--- /dev/null
+++ b/src/qemu/virtqemud.service.in
@@ -0,0 +1,40 @@
+[Unit]
+Description=Virtualization qemu daemon
+Conflicts=libvirtd.service
+Requires=virtqemud.socket
+Requires=virtqemud-ro.socket
+Requires=virtqemud-admin.socket
+Wants=systemd-machined.service
+Before=libvirt-guests.service
+After=network.target
+After=dbus.service
+After=apparmor.service
+After=local-fs.target
+After=remote-fs.target
+After=systemd-logind.service
+After=systemd-machined.service
+Documentation=man:libvirtd(8)
+Documentation=https://libvirt.org
+
+[Service]
+Type=notify
+ExecStart= sbindir@/virtqemud --timeout 120
+ExecReload=/bin/kill -HUP $MAINPID
+KillMode=process
+Restart=on-failure
+# At least 1 FD per guest, often 2 (eg qemu monitor + qemu agent).
+# eg if we want to support 4096 guests, we'll typically need 8192 FDs
+# If changing this, also consider virtlogd.service & virtlockd.service
+# limits which are also related to number of guests
+LimitNOFILE=8192
+# The cgroups pids controller can limit the number of tasks started by
+# the daemon, which can limit the number of domains for some hypervisors.
+# A conservative default of 8 tasks per guest results in a TasksMax of
+# 32k to support 4096 guests.
+TasksMax=32768
+
+[Install]
+WantedBy=multi-user.target
+Also=virtqemud.socket
+Also=virtqemud-ro.socket
+Also=virtqemud-admin.socket
-- 
2.21.0


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