storage: introduce virtstoraged daemon

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@redhat.com>
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 62d817a328
commit e23d5b0435
4 changed files with 100 additions and 0 deletions

4
.gitignore vendored
View File

@ -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

View File

@ -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

View File

@ -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 = \

View File

@ -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