summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2021-09-03 11:46:33 -0500
committerDavid Teigland <teigland@redhat.com>2021-10-07 12:45:34 -0500
commit582c759929c531c1a355342a11bd3db7fab9436c (patch)
tree22c5cffd6d11c72815bb184adcd48de01f7c4832
parent64dd17e53904b8a77e8cdf25d5338bec40d8fef4 (diff)
downloadlvm2-dev-dct-activation-switch-2.tar.gz
new activation servicesdev-dct-activation-switch-2
During startup, new services lvm-activate-vgs-main and lvm-activate-vgs-last run fixed point in time vgchange -aay commands to activate all VGs. The vgchange in the -last service includes the option "--eventactivation begin" which creates the /run/lvm/event-activation-on file, which enables event-based activation from pvscan commands. The lvm-monitor service starts after lvm-activatae-vgs-last.
-rw-r--r--scripts/Makefile.in22
-rw-r--r--scripts/blk_availability_systemd_red_hat.service.in2
-rw-r--r--scripts/lvm-activate-vgs-last.service.in16
-rw-r--r--scripts/lvm-activate-vgs-main.service.in15
-rw-r--r--scripts/lvm2_monitoring_systemd_red_hat.service.in4
-rw-r--r--udev/69-dm-lvm-metad.rules.in2
-rw-r--r--udev/69-dm-lvm.rules.in2
7 files changed, 42 insertions, 21 deletions
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 0d7f45680..11f5e880b 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -15,9 +15,6 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
-SOURCES = lvm2_activation_generator_systemd_red_hat.c
-TARGETS = lvm2_activation_generator_systemd_red_hat
-
include $(top_builddir)/make.tmpl
ifeq ("@BUILD_DMEVENTD@", "yes")
@@ -78,24 +75,15 @@ ifeq ("@BLKDEACTIVATE@", "yes")
$(Q) $(INSTALL_SCRIPT) blk_availability_init_red_hat $(initdir)/blk-availability
endif
-CFLAGS_lvm2_activation_generator_systemd_red_hat.o += $(EXTRA_EXEC_CFLAGS)
-
-lvm2_activation_generator_systemd_red_hat: $(OBJECTS) $(LVMINTERNAL_LIBS)
- @echo " [CC] $@"
- $(Q) $(CC) -o $@ $(OBJECTS) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) $(LVMINTERNAL_LIBS) $(LIBS)
-
-install_systemd_generators:
- @echo " [INSTALL] systemd_generators"
- $(Q) $(INSTALL_DIR) $(systemd_generator_dir)
- $(Q) $(INSTALL_PROGRAM) lvm2_activation_generator_systemd_red_hat $(systemd_generator_dir)/lvm2-activation-generator
-
install_systemd_units: install_dbus_service
@echo " [INSTALL] systemd_units"
$(Q) $(INSTALL_DIR) $(systemd_unit_dir)
+ $(Q) $(INSTALL_DATA) lvm-activate-vgs-main.service $(systemd_unit_dir)/lvm-activate-vgs-main.service
+ $(Q) $(INSTALL_DATA) lvm-activate-vgs-last.service $(systemd_unit_dir)/lvm-activate-vgs-last.service
ifeq ("@BUILD_DMEVENTD@", "yes")
$(Q) $(INSTALL_DATA) dm_event_systemd_red_hat.socket $(systemd_unit_dir)/dm-event.socket
$(Q) $(INSTALL_DATA) dm_event_systemd_red_hat.service $(systemd_unit_dir)/dm-event.service
- $(Q) $(INSTALL_DATA) lvm2_monitoring_systemd_red_hat.service $(systemd_unit_dir)/lvm2-monitor.service
+ $(Q) $(INSTALL_DATA) lvm2_monitoring_systemd_red_hat.service $(systemd_unit_dir)/lvm-monitor.service
endif
ifeq ("@BLKDEACTIVATE@", "yes")
$(Q) $(INSTALL_DATA) blk_availability_systemd_red_hat.service $(systemd_unit_dir)/blk-availability.service
@@ -155,7 +143,9 @@ DISTCLEAN_TARGETS += \
lvm2_monitoring_init_red_hat \
lvm2_monitoring_systemd_red_hat.service \
lvm2_pvscan_systemd_red_hat@.service \
- lvm2_tmpfiles_red_hat.conf
+ lvm2_tmpfiles_red_hat.conf \
+ lvm-activate-vgs-main.service \
+ lvm-activate-vgs-last.service
# Remove ancient files
DISTCLEAN_TARGETS += \
diff --git a/scripts/blk_availability_systemd_red_hat.service.in b/scripts/blk_availability_systemd_red_hat.service.in
index 82d3b82d0..e42b3ab5f 100644
--- a/scripts/blk_availability_systemd_red_hat.service.in
+++ b/scripts/blk_availability_systemd_red_hat.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=Availability of block devices
Before=shutdown.target
-After=lvm2-activation.service iscsi-shutdown.service iscsi.service iscsid.service fcoe.service rbdmap.service
+After=lvm-activate-vgs-main.service lvm-activate-vgs-last.service iscsi-shutdown.service iscsi.service iscsid.service fcoe.service rbdmap.service
DefaultDependencies=no
Conflicts=shutdown.target
diff --git a/scripts/lvm-activate-vgs-last.service.in b/scripts/lvm-activate-vgs-last.service.in
new file mode 100644
index 000000000..8d5a2f49b
--- /dev/null
+++ b/scripts/lvm-activate-vgs-last.service.in
@@ -0,0 +1,16 @@
+[Unit]
+Description=Activate LVM Volume Groups (last)
+Documentation=man:vgchange(8)
+Wants=systemd-udev-settle.service
+After=lvm-activate-vgs-main.service systemd-udev-settle.service multipathd.service cryptsetup.target
+Before=local-fs-pre.target shutdown.target
+DefaultDependencies=no
+Conflicts=shutdown.target
+
+[Service]
+Type=oneshot
+ExecStart=@SBINDIR@/lvm vgchange -aay --nohints --vgonline --eventactivation enable
+RemainAfterExit=yes
+
+[Install]
+WantedBy=sysinit.target
diff --git a/scripts/lvm-activate-vgs-main.service.in b/scripts/lvm-activate-vgs-main.service.in
new file mode 100644
index 000000000..99966c075
--- /dev/null
+++ b/scripts/lvm-activate-vgs-main.service.in
@@ -0,0 +1,15 @@
+[Unit]
+Description=Activate LVM Volume Groups
+Documentation=man:vgchange(8)
+After=dm-event.socket dm-event.service
+Before=local-fs-pre.target shutdown.target
+DefaultDependencies=no
+Conflicts=shutdown.target
+
+[Service]
+Type=oneshot
+ExecStart=@SBINDIR@/lvm vgchange -aay --nohints --vgonline
+RemainAfterExit=yes
+
+[Install]
+WantedBy=sysinit.target
diff --git a/scripts/lvm2_monitoring_systemd_red_hat.service.in b/scripts/lvm2_monitoring_systemd_red_hat.service.in
index 4bf744a7f..e912c6a85 100644
--- a/scripts/lvm2_monitoring_systemd_red_hat.service.in
+++ b/scripts/lvm2_monitoring_systemd_red_hat.service.in
@@ -1,8 +1,8 @@
[Unit]
-Description=Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling
+Description=Monitor LVM Logical Volumes
Documentation=man:dmeventd(8) man:lvcreate(8) man:lvchange(8) man:vgchange(8)
Requires=dm-event.socket
-After=dm-event.socket dm-event.service lvm2-activation.service
+After=dm-event.socket dm-event.service lvm-activate-vgs-last.service
Before=local-fs-pre.target shutdown.target
DefaultDependencies=no
Conflicts=shutdown.target
diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in
index 78f506520..4727cefc0 100644
--- a/udev/69-dm-lvm-metad.rules.in
+++ b/udev/69-dm-lvm-metad.rules.in
@@ -121,6 +121,6 @@ LABEL="direct_pvscan"
# MD | | X | X* | |
# loop | | X | X* | |
# other | X | | X | | X
-RUN+="(LVM_EXEC)/lvm pvscan --background --cache --activate ay --major $major --minor $minor", ENV{LVM_SCANNED}="1"
+RUN+="(LVM_EXEC)/lvm pvscan --background --cache --activate ay --eventactivation check --major $major --minor $minor", ENV{LVM_SCANNED}="1"
LABEL="lvm_end"
diff --git a/udev/69-dm-lvm.rules.in b/udev/69-dm-lvm.rules.in
index 39e5b9807..cd738e9f9 100644
--- a/udev/69-dm-lvm.rules.in
+++ b/udev/69-dm-lvm.rules.in
@@ -79,7 +79,7 @@ ENV{SYSTEMD_READY}="1"
# TODO: adjust the output of vgchange -aay so that
# it's better suited to appearing in the journal.
-IMPORT{program}="(LVM_EXEC)/lvm pvscan --cache --listvg --checkcomplete --vgonline --udevoutput --journal=output $env{DEVNAME}"
+IMPORT{program}="(LVM_EXEC)/lvm pvscan --cache --listvg --checkcomplete --vgonline --eventactivation check --udevoutput --journal=output $env{DEVNAME}"
ENV{LVM_VG_NAME_COMPLETE}=="?*", RUN+="/usr/bin/systemd-run -r --no-block --property DefaultDependencies=no --unit lvm-activate-$env{LVM_VG_NAME_COMPLETE} lvm vgchange -aay --nohints $env{LVM_VG_NAME_COMPLETE}"
GOTO="lvm_end"