summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2021-09-03 11:46:33 -0500
committerDavid Teigland <teigland@redhat.com>2021-09-07 17:06:44 -0500
commitfd4231f63897b6d3cc09dff9d19df0d02e326519 (patch)
tree69d44917498722f5163ee878a04ac31bfc695c6e
parent1189d17032105fc8b91837a73244f8d08eb42ecd (diff)
downloadlvm2-dev-dct-activation-switch-1.tar.gz
event activation switchdev-dct-activation-switch-1
During startup, a new service lvm-activate-vgs will run at a fixed point in time to activate all complete VGs. At the same time it enables the pvscan/vgchange in the lvm udev rule to begin event based autoactivation for VGs that become complete after lvm-activate-vgs.
-rw-r--r--scripts/lvm-activate-vgs-last.service15
-rw-r--r--scripts/lvm-activate-vgs-main.service16
-rw-r--r--udev/69-dm-lvm-metad.rules.in2
-rw-r--r--udev/69-dm-lvm.rules.in2
4 files changed, 33 insertions, 2 deletions
diff --git a/scripts/lvm-activate-vgs-last.service b/scripts/lvm-activate-vgs-last.service
new file mode 100644
index 000000000..42287d1b5
--- /dev/null
+++ b/scripts/lvm-activate-vgs-last.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Activate LVM Volume Groups (last)
+Documentation=man:vgchange(8)
+After=lvm-activate-vgs.service multipathd.service cryptsetup.target
+Before=local-fs-pre.target shutdown.target
+DefaultDependencies=no
+Conflicts=shutdown.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/lvm vgchange -aay --vgonline --config devices/hints=none --eventactivation enable
+RemainAfterExit=yes
+
+[Install]
+WantedBy=sysinit.target
diff --git a/scripts/lvm-activate-vgs-main.service b/scripts/lvm-activate-vgs-main.service
new file mode 100644
index 000000000..9d4d5486b
--- /dev/null
+++ b/scripts/lvm-activate-vgs-main.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Activate LVM Volume Groups
+Documentation=man:vgchange(8)
+After=dm-event.socket dm-event.service
+Wants=systemd-udev-settle.service
+Before=local-fs-pre.target shutdown.target
+DefaultDependencies=no
+Conflicts=shutdown.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/lvm vgchange -aay --vgonline --config devices/hints=none
+RemainAfterExit=yes
+
+[Install]
+WantedBy=sysinit.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 70f2b37e8..5aeb26cac 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 --config devices/hints=none $env{LVM_VG_NAME_COMPLETE}"
GOTO="lvm_end"