vbox: introduce virtvboxd daemon

The virtvboxd daemon will be responsible for providing the vbox API
driver functionality. The vbox driver is still loaded by the main
libvirtd daemon at this stage, so virtvboxd 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 23ab0f0bef
commit 60ee70e93e
4 changed files with 100 additions and 0 deletions

4
.gitignore vendored
View File

@ -196,6 +196,9 @@
/src/test*.aug
/src/util/virkeycodetable*.h
/src/util/virkeynametable*.h
/src/vbox/test_virtvboxd.aug
/src/vbox/virtvboxd.aug
/src/vbox/virtvboxd.conf
/src/virt-aa-helper
/src/virtinterfaced
/src/virtxend
@ -209,6 +212,7 @@
/src/virtqemud
/src/virtsecretd
/src/virtstoraged
/src/virtvboxd
/src/virt-guest-shutdown.target
/tests/*.log
/tests/*.pid

View File

@ -1802,6 +1802,14 @@ exit 0
%if %{with_vbox}
%files daemon-driver-vbox
%config(noreplace) %{_sysconfdir}/libvirt/virtvboxd.conf
%{_datadir}/augeas/lenses/virtvboxd.aug
%{_datadir}/augeas/lenses/tests/test_virtvboxd.aug
%{_unitdir}/virtvboxd.service
%{_unitdir}/virtvboxd.socket
%{_unitdir}/virtvboxd-ro.socket
%{_unitdir}/virtvboxd-admin.socket
%attr(0755, root, root) %{_sbindir}/virtvboxd
%{_libdir}/%{name}/connection-driver/libvirt_driver_vbox.so
%endif

View File

@ -63,4 +63,67 @@ libvirt_driver_vbox_impl_la_LIBADD = \
$(LIBXML_LIBS) \
$(NULL)
libvirt_driver_vbox_impl_la_SOURCES = $(VBOX_DRIVER_SOURCES)
sbin_PROGRAMS += virtvboxd
nodist_conf_DATA += vbox/virtvboxd.conf
augeas_DATA += vbox/virtvboxd.aug
augeastest_DATA += vbox/test_virtvboxd.aug
CLEANFILES += vbox/virtvboxd.aug
virtvboxd_SOURCES = $(REMOTE_DAEMON_SOURCES)
virtvboxd_CFLAGS = \
$(REMOTE_DAEMON_CFLAGS) \
-DDAEMON_NAME="\"virtvboxd\"" \
-DMODULE_NAME="\"vbox\"" \
$(NULL)
virtvboxd_LDFLAGS = $(REMOTE_DAEMON_LD_FLAGS)
virtvboxd_LDADD = $(REMOTE_DAEMON_LD_ADD)
SYSTEMD_UNIT_FILES += \
virtvboxd.service \
virtvboxd.socket \
virtvboxd-ro.socket \
virtvboxd-admin.socket \
$(NULL)
SYSTEMD_UNIT_FILES_IN += \
vbox/virtvboxd.service.in \
$(NULL)
VIRTVBOXD_UNIT_VARS = \
$(VIRTD_UNIT_VARS) \
-e 's|[@]name[@]|Libvirt vbox|g' \
-e 's|[@]service[@]|virtvboxd|g' \
-e 's|[@]sockprefix[@]|virtvboxd|g' \
$(NULL)
virtvboxd.service: vbox/virtvboxd.service.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(VIRTVBOXD_UNIT_VARS) $< > $@-t && mv $@-t $@
virtvbox%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
$(AM_V_GEN)$(SED) $(VIRTVBOXD_UNIT_VARS) $< > $@-t && mv $@-t $@
vbox/virtvboxd.conf: remote/libvirtd.conf.in
$(AM_V_GEN)$(SED) \
-e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
-e 's/[@]DAEMON_NAME[@]/virtvboxd/' \
$< > $@
vbox/virtvboxd.aug: remote/libvirtd.aug.in
$(AM_V_GEN)$(SED) \
-e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
-e 's/[@]DAEMON_NAME[@]/virtvboxd/' \
-e 's/[@]DAEMON_NAME_UC[@]/Virtvboxd/' \
$< > $@
vbox/test_virtvboxd.aug: remote/test_libvirtd.aug.in \
vbox/virtvboxd.conf $(AUG_GENTEST)
$(AM_V_GEN)$(AUG_GENTEST) vbox/virtvboxd.conf \
$(srcdir)/remote/test_libvirtd.aug.in | \
$(SED) \
-e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
-e 's/[@]DAEMON_NAME[@]/virtvboxd/' \
-e 's/[@]DAEMON_NAME_UC[@]/Virtvboxd/' \
> $@ || rm -f $@
endif WITH_VBOX

View File

@ -0,0 +1,25 @@
[Unit]
Description=Virtualization vbox daemon
Conflicts=libvirtd.service
Requires=virtvboxd.socket
Requires=virtvboxd-ro.socket
Requires=virtvboxd-admin.socket
After=network.target
After=dbus.service
After=apparmor.service
After=local-fs.target
After=remote-fs.target
Documentation=man:libvirtd(8)
Documentation=https://libvirt.org
[Service]
Type=notify
ExecStart=@sbindir@/virtvboxd --timeout 120
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
Also=virtvboxd.socket
Also=virtvboxd-ro.socket
Also=virtvboxd-admin.socket