The virtstoraged daemon will be responsible for providing the storage API
driver functionality. The storage driver is still loaded by the main
libvirtd daemon at this stage, so virtstoraged must not be running at
the same time.
Reviewed-by: Christophe de Dinechin <dinechin(a)redhat.com>
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/storage/Makefile.inc.am | 62 +++++++++++++++++++++++++++++
src/storage/virtstoraged.service.in | 26 ++++++++++++
4 files changed, 100 insertions(+)
create mode 100644 src/storage/virtstoraged.service.in
diff --git a/.gitignore b/.gitignore
index 02d657d54f..58a1ef1293 100644
--- a/.gitignore
+++ b/.gitignore
@@ -175,6 +175,9 @@
/src/secret/test_virtsecretd.aug
/src/secret/virtsecretd.aug
/src/secret/virtsecretd.conf
+/src/storage/test_virtstoraged.aug
+/src/storage/virtstoraged.aug
+/src/storage/virtstoraged.conf
/src/test*.aug
/src/util/virkeycodetable*.h
/src/util/virkeynametable*.h
@@ -185,6 +188,7 @@
/src/virtnetworkd
/src/virtproxyd
/src/virtsecretd
+/src/virtstoraged
/src/virt-guest-shutdown.target
/tests/*.log
/tests/*.pid
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 1458c4708d..35288b0e2d 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1663,6 +1663,14 @@ exit 0
%files daemon-driver-storage
%files daemon-driver-storage-core
+%config(noreplace) %{_sysconfdir}/libvirt/virtstoraged.conf
+%{_datadir}/augeas/lenses/virtstoraged.aug
+%{_datadir}/augeas/lenses/tests/test_virtstoraged.aug
+%{_unitdir}/virtstoraged.service
+%{_unitdir}/virtstoraged.socket
+%{_unitdir}/virtstoraged-ro.socket
+%{_unitdir}/virtstoraged-admin.socket
+%attr(0755, root, root) %{_sbindir}/virtstoraged
%attr(0755, root, root) %{_libexecdir}/libvirt_parthelper
%{_libdir}/%{name}/connection-driver/libvirt_driver_storage.so
%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_fs.so
diff --git a/src/storage/Makefile.inc.am b/src/storage/Makefile.inc.am
index 538709256d..fd0d57d2b6 100644
--- a/src/storage/Makefile.inc.am
+++ b/src/storage/Makefile.inc.am
@@ -142,6 +142,68 @@ mod_LTLIBRARIES += libvirt_driver_storage.la
libvirt_driver_storage_la_LDFLAGS = $(AM_LDFLAGS_MOD_NOUNDEF)
libvirt_driver_storage_impl_la_SOURCES += $(STORAGE_DRIVER_SOURCES)
+sbin_PROGRAMS += virtstoraged
+
+nodist_conf_DATA += storage/virtstoraged.conf
+augeas_DATA += storage/virtstoraged.aug
+augeastest_DATA += storage/test_virtstoraged.aug
+CLEANFILES += storage/virtstoraged.aug
+
+virtstoraged_SOURCES = $(REMOTE_DAEMON_SOURCES)
+virtstoraged_CFLAGS = \
+ $(REMOTE_DAEMON_CFLAGS) \
+ -DDAEMON_NAME="\"virtstoraged\"" \
+ -DMODULE_NAME="\"storage\"" \
+ $(NULL)
+virtstoraged_LDFLAGS = $(REMOTE_DAEMON_LD_FLAGS)
+virtstoraged_LDADD = $(REMOTE_DAEMON_LD_ADD)
+
+SYSTEMD_UNIT_FILES += \
+ virtstoraged.service \
+ virtstoraged.socket \
+ virtstoraged-ro.socket \
+ virtstoraged-admin.socket \
+ $(NULL)
+SYSTEMD_UNIT_FILES_IN += \
+ storage/virtstoraged.service.in \
+ $(NULL)
+
+VIRTSTORAGED_UNIT_VARS = \
+ $(VIRTD_UNIT_VARS) \
+ -e 's|[@]name[@]|Libvirt storage|g' \
+ -e 's|[@]service[@]|virtstoraged|g' \
+ -e 's|[@]sockprefix[@]|virtstoraged|g' \
+ $(NULL)
+
+virtstoraged.service: storage/virtstoraged.service.in $(top_builddir)/config.status
+ $(AM_V_GEN)$(SED) $(VIRTSTORAGED_UNIT_VARS) $< > $@-t && mv $@-t $@
+
+virtstorage%.socket: remote/libvirt%.socket.in $(top_builddir)/config.status
+ $(AM_V_GEN)$(SED) $(VIRTSTORAGED_UNIT_VARS) $< > $@-t && mv $@-t $@
+
+storage/virtstoraged.conf: remote/libvirtd.conf.in
+ $(AM_V_GEN)$(SED) \
+ -e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
+ -e 's/[@]DAEMON_NAME[@]/virtstoraged/' \
+ $< > $@
+
+storage/virtstoraged.aug: remote/libvirtd.aug.in
+ $(AM_V_GEN)$(SED) \
+ -e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
+ -e 's/[@]DAEMON_NAME[@]/virtstoraged/' \
+ -e 's/[@]DAEMON_NAME_UC[@]/Virtstoraged/' \
+ $< > $@
+
+storage/test_virtstoraged.aug: remote/test_libvirtd.aug.in \
+ storage/virtstoraged.conf $(AUG_GENTEST)
+ $(AM_V_GEN)$(AUG_GENTEST) storage/virtstoraged.conf \
+ $(srcdir)/remote/test_libvirtd.aug.in | \
+ $(SED) \
+ -e '/[@]CUT_ENABLE_IP[@]/,/[@]END[@]/d' \
+ -e 's/[@]DAEMON_NAME[@]/virtstoraged/' \
+ -e 's/[@]DAEMON_NAME_UC[@]/Virtstoraged/' \
+ > $@ || rm -f $@
+
libvirt_storage_backend_fs_la_SOURCES = $(STORAGE_DRIVER_FS_SOURCES)
libvirt_storage_backend_fs_la_CFLAGS = \
diff --git a/src/storage/virtstoraged.service.in b/src/storage/virtstoraged.service.in
new file mode 100644
index 0000000000..9aa26764a9
--- /dev/null
+++ b/src/storage/virtstoraged.service.in
@@ -0,0 +1,26 @@
+[Unit]
+Description=Virtualization storage daemon
+Conflicts=libvirtd.service
+Requires=virtstoraged.socket
+Requires=virtstoraged-ro.socket
+Requires=virtstoraged-admin.socket
+After=network.target
+After=dbus.service
+After=iscsid.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@/virtstoraged --timeout 120
+ExecReload=/bin/kill -HUP $MAINPID
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
+Also=virtstoraged.socket
+Also=virtstoraged-ro.socket
+Also=virtstoraged-admin.socket
--
2.21.0