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>
This commit is contained in:
Daniel P. Berrangé 2018-03-16 17:05:24 +00:00
parent 12e30d1e54
commit bb1021e369
4 changed files with 114 additions and 0 deletions

4
.gitignore vendored
View File

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

View File

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

View File

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

View File

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