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.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
.gitignore | 4 +++
libvirt.spec.in | 8 +++++
src/vbox/Makefile.inc.am | 62 +++++++++++++++++++++++++++++++++++
src/vbox/virtvboxd.service.in | 24 ++++++++++++++
4 files changed, 98 insertions(+)
create mode 100644 src/vbox/virtvboxd.service.in
diff --git a/.gitignore b/.gitignore
index d279c7bc1f..a23828cce6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -195,6 +195,9 @@
/src/storage/virtstoraged.conf
/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
@@ -208,6 +211,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 e64c2931ac..3e897459f1 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..dfa0ab4016 100644
--- a/src/vbox/Makefile.inc.am
+++ b/src/vbox/Makefile.inc.am
@@ -63,4 +63,66 @@ 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..e4c00f2d68
--- /dev/null
+++ b/src/vbox/virtvboxd.service.in
@@ -0,0 +1,24 @@
+[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
+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