[PATCH 23/41] storage: introduce virtstoraged daemon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 .gitignore                          |  4 ++
 libvirt.spec.in                     |  8 ++++
 src/storage/Makefile.inc.am         | 61 +++++++++++++++++++++++++++++
 src/storage/virtstoraged.service.in | 24 ++++++++++++
 4 files changed, 97 insertions(+)
 create mode 100644 src/storage/virtstoraged.service.in

diff --git a/.gitignore b/.gitignore
index c361d87868..3b86183bee 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/util/virkeycodetable*.h
 /src/util/virkeynametable*.h
 /src/virt-aa-helper
@@ -184,6 +187,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 25bd2a359d..dce428ede3 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..8083a6b8ac 100644
--- a/src/storage/Makefile.inc.am
+++ b/src/storage/Makefile.inc.am
@@ -142,6 +142,67 @@ 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..687e3b930e
--- /dev/null
+++ b/src/storage/virtstoraged.service.in
@@ -0,0 +1,24 @@
+[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=apparmor.service
+After=local-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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux