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(a)redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
.gitignore | 4 +++
libvirt.spec.in | 8 +++++
src/vbox/Makefile.inc.am | 63 +++++++++++++++++++++++++++++++++++
src/vbox/virtvboxd.service.in | 25 ++++++++++++++
4 files changed, 100 insertions(+)
create mode 100644 src/vbox/virtvboxd.service.in
diff --git a/.gitignore b/.gitignore
index 8e396d6127..e0f8bc3518 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 1c3d988136..184268b596 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -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
diff --git a/src/vbox/Makefile.inc.am b/src/vbox/Makefile.inc.am
index 95407778f7..178c360b99 100644
--- a/src/vbox/Makefile.inc.am
+++ b/src/vbox/Makefile.inc.am
@@ -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
diff --git a/src/vbox/virtvboxd.service.in b/src/vbox/virtvboxd.service.in
new file mode 100644
index 0000000000..7e0f7518d6
--- /dev/null
+++ b/src/vbox/virtvboxd.service.in
@@ -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
--
2.21.0