Blame SOURCES/0001-Revert-new-udev-autoactivation.patch

fabacb
From 63c4458aaf67d114c677baf657a7e9e43440f349 Mon Sep 17 00:00:00 2001
fabacb
From: David Teigland <teigland@redhat.com>
fabacb
Date: Mon, 20 Dec 2021 14:22:02 -0600
4d51e5
Subject: [PATCH 01/54] Revert "new udev autoactivation"
fabacb
fabacb
This reverts commit 67722b312390cdab29c076c912e14bd739c5c0f6.
fabacb
---
fabacb
 scripts/Makefile.in                |   1 +
fabacb
 test/shell/udev-pvscan-vgchange.sh | 403 -----------------------------
fabacb
 udev/69-dm-lvm.rules.in            |  87 -------
fabacb
 udev/Makefile.in                   |   2 +-
fabacb
 5 files changed, 4 insertions(+), 492 deletions(-)
fabacb
 delete mode 100644 test/shell/udev-pvscan-vgchange.sh
fabacb
 delete mode 100644 udev/69-dm-lvm.rules.in
fabacb
fabacb
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
fabacb
index 0d7f45680..ee0acb6f6 100644
fabacb
--- a/scripts/Makefile.in
fabacb
+++ b/scripts/Makefile.in
fabacb
@@ -92,6 +92,7 @@ install_systemd_generators:
fabacb
 install_systemd_units:	install_dbus_service
fabacb
 	@echo "    [INSTALL] systemd_units"
fabacb
 	$(Q) $(INSTALL_DIR) $(systemd_unit_dir)
fabacb
+	$(Q) $(INSTALL_DATA) lvm2-pvscan.service $(systemd_unit_dir)/lvm2-pvscan@.service
fabacb
 ifeq ("@BUILD_DMEVENTD@", "yes")
fabacb
 	$(Q) $(INSTALL_DATA) dm_event_systemd_red_hat.socket $(systemd_unit_dir)/dm-event.socket
fabacb
 	$(Q) $(INSTALL_DATA) dm_event_systemd_red_hat.service $(systemd_unit_dir)/dm-event.service
fabacb
diff --git a/test/shell/udev-pvscan-vgchange.sh b/test/shell/udev-pvscan-vgchange.sh
fabacb
deleted file mode 100644
fabacb
index c81acf0ce..000000000
fabacb
--- a/test/shell/udev-pvscan-vgchange.sh
fabacb
+++ /dev/null
fabacb
@@ -1,403 +0,0 @@
fabacb
-#!/usr/bin/env bash
fabacb
-
fabacb
-# Copyright (C) 2021 Red Hat, Inc. All rights reserved.
fabacb
-#
fabacb
-# This copyrighted material is made available to anyone wishing to use,
fabacb
-# modify, copy, or redistribute it subject to the terms and conditions
fabacb
-# of the GNU General Public License v.2.
fabacb
-#
fabacb
-# You should have received a copy of the GNU General Public License
fabacb
-# along with this program; if not, write to the Free Software Foundation,
fabacb
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
fabacb
-
fabacb
-test_description='udev rule and systemd unit run vgchange'
fabacb
-
fabacb
-SKIP_WITH_LVMPOLLD=1
fabacb
-SKIP_WITH_LVMLOCKD=1
fabacb
-
fabacb
-. lib/inittest
fabacb
-
fabacb
-#
fabacb
-# $ cat /tmp/devs
fabacb
-# /dev/sdb
fabacb
-# /dev/sdc
fabacb
-# /dev/sdd
fabacb
-#
fabacb
-# Specify this file as LVM_TEST_DEVICE_LIST=/tmp/devs
fabacb
-# when running the test.
fabacb
-#
fabacb
-# This test will wipe these devices.
fabacb
-#
fabacb
-
fabacb
-if [ -z ${LVM_TEST_DEVICE_LIST+x} ]; then echo "LVM_TEST_DEVICE_LIST is unset" && skip; else echo "LVM_TEST_DEVICE_LIST is set to '$LVM_TEST_DEVICE_LIST'"; fi
fabacb
-
fabacb
-test -e "$LVM_TEST_DEVICE_LIST" || skip
fabacb
-
fabacb
-num_devs=$(cat $LVM_TEST_DEVICE_LIST | wc -l)
fabacb
-
fabacb
-RUNDIR="/run"
fabacb
-test -d "$RUNDIR" || RUNDIR="/var/run"
fabacb
-PVS_ONLINE_DIR="$RUNDIR/lvm/pvs_online"
fabacb
-VGS_ONLINE_DIR="$RUNDIR/lvm/vgs_online"
fabacb
-PVS_LOOKUP_DIR="$RUNDIR/lvm/pvs_lookup"
fabacb
-
fabacb
-_clear_online_files() {
fabacb
-	# wait till udev is finished
fabacb
-	aux udev_wait
fabacb
-	rm -f "$PVS_ONLINE_DIR"/*
fabacb
-	rm -f "$VGS_ONLINE_DIR"/*
fabacb
-	rm -f "$PVS_LOOKUP_DIR"/*
fabacb
-}
fabacb
-
fabacb
-test -d "$PVS_ONLINE_DIR" || mkdir -p "$PVS_ONLINE_DIR"
fabacb
-test -d "$VGS_ONLINE_DIR" || mkdir -p "$VGS_ONLINE_DIR"
fabacb
-test -d "$PVS_LOOKUP_DIR" || mkdir -p "$PVS_LOOKUP_DIR"
fabacb
-_clear_online_files
fabacb
-
fabacb
-aux prepare_real_devs
fabacb
-
fabacb
-aux lvmconf 'devices/dir = "/dev"'
fabacb
-aux lvmconf 'devices/use_devicesfile = 1'
fabacb
-DFDIR="$LVM_SYSTEM_DIR/devices"
fabacb
-DF="$DFDIR/system.devices"
fabacb
-mkdir $DFDIR || true
fabacb
-not ls $DF
fabacb
-
fabacb
-get_real_devs
fabacb
-
fabacb
-wipe_all() {
fabacb
-	for dev in "${REAL_DEVICES[@]}"; do
fabacb
-		wipefs -a $dev
fabacb
-	done
fabacb
-}
fabacb
-
fabacb
-# udevadm trigger runs udev rule which runs systemd-run --no-wait vgchange -aay
fabacb
-# Because of --no-wait, we need to wait for the transient systemd
fabacb
-# service to be gone before checking the effects of the vgchange.
fabacb
-
fabacb
-wait_lvm_activate() {
fabacb
-	local vgw=$1
fabacb
-	local wait=0
fabacb
-
fabacb
-	while systemctl status lvm-activate-$vgw > /dev/null && test "$wait" -le 30; do
fabacb
-		sleep .2
fabacb
-		wait=$(( wait + 1 ))
fabacb
-	done
fabacb
-}
fabacb
-
fabacb
-# Test requires 3 devs
fabacb
-test $num_devs -gt 2 || skip
fabacb
-BDEV1=$(basename "$dev1")
fabacb
-BDEV2=$(basename "$dev2")
fabacb
-BDEV3=$(basename "$dev3")
fabacb
-
fabacb
-wipe_all
fabacb
-touch $DF
fabacb
-for dev in "${REAL_DEVICES[@]}"; do
fabacb
-	pvcreate $dev
fabacb
-done
fabacb
-
fabacb
-# 1 dev, 1 vg, 1 lv
fabacb
-
fabacb
-vgcreate $vg1 "$dev1"
fabacb
-lvcreate -l1 -an -n $lv1 $vg1 "$dev1"
fabacb
-
fabacb
-PVID1=$(pvs "$dev1" --noheading -o uuid | tr -d - | awk '{print $1}')
fabacb
-
fabacb
-_clear_online_files
fabacb
-udevadm trigger --settle -c add /sys/block/$BDEV1
fabacb
-
fabacb
-wait_lvm_activate $vg1
fabacb
-
fabacb
-ls "$RUNDIR/lvm/pvs_online/$PVID1"
fabacb
-ls "$RUNDIR/lvm/vgs_online/$vg1"
fabacb
-journalctl -u lvm-activate-$vg1 | tee out || true
fabacb
-grep "now active" out
fabacb
-check lv_field $vg1/$lv1 lv_active "active"
fabacb
-
fabacb
-vgchange -an $vg1
fabacb
-vgremove -y $vg1
fabacb
-
fabacb
-
fabacb
-# 2 devs, 1 vg, 2 lvs
fabacb
-
fabacb
-vgcreate $vg2 "$dev1" "$dev2"
fabacb
-lvcreate -l1 -an -n $lv1 $vg2 "$dev1"
fabacb
-lvcreate -l1 -an -n $lv2 $vg2 "$dev2"
fabacb
-
fabacb
-PVID1=$(pvs "$dev1" --noheading -o uuid | tr -d - | awk '{print $1}')
fabacb
-PVID2=$(pvs "$dev2" --noheading -o uuid | tr -d - | awk '{print $1}')
fabacb
-
fabacb
-_clear_online_files
fabacb
-
fabacb
-udevadm trigger --settle -c add /sys/block/$BDEV1
fabacb
-ls "$RUNDIR/lvm/pvs_online/$PVID1"
fabacb
-not ls "$RUNDIR/lvm/vgs_online/$vg2"
fabacb
-journalctl -u lvm-activate-$vg2 | tee out || true
fabacb
-not grep "now active" out
fabacb
-check lv_field $vg2/$lv1 lv_active ""
fabacb
-check lv_field $vg2/$lv2 lv_active ""
fabacb
-
fabacb
-udevadm trigger --settle -c add /sys/block/$BDEV2
fabacb
-ls "$RUNDIR/lvm/pvs_online/$PVID2"
fabacb
-ls "$RUNDIR/lvm/vgs_online/$vg2"
fabacb
-
fabacb
-wait_lvm_activate $vg2
fabacb
-
fabacb
-journalctl -u lvm-activate-$vg2 | tee out || true
fabacb
-grep "now active" out
fabacb
-check lv_field $vg2/$lv1 lv_active "active"
fabacb
-check lv_field $vg2/$lv2 lv_active "active"
fabacb
-
fabacb
-vgchange -an $vg2
fabacb
-vgremove -y $vg2
fabacb
-
fabacb
-
fabacb
-# 3 devs, 1 vg, 4 lvs, concurrent pvscans
fabacb
-# (attempting to have the pvscans run concurrently and race
fabacb
-# to activate the VG)
fabacb
-
fabacb
-vgcreate $vg3 "$dev1" "$dev2" "$dev3"
fabacb
-lvcreate -l1 -an -n $lv1 $vg3 "$dev1"
fabacb
-lvcreate -l1 -an -n $lv2 $vg3 "$dev2"
fabacb
-lvcreate -l1 -an -n $lv3 $vg3 "$dev3"
fabacb
-lvcreate -l8 -an -n $lv4 -i 2 $vg3 "$dev1" "$dev2"
fabacb
-
fabacb
-PVID1=$(pvs "$dev1" --noheading -o uuid | tr -d - | awk '{print $1}')
fabacb
-PVID2=$(pvs "$dev2" --noheading -o uuid | tr -d - | awk '{print $1}')
fabacb
-PVID3=$(pvs "$dev3" --noheading -o uuid | tr -d - | awk '{print $1}')
fabacb
-
fabacb
-_clear_online_files
fabacb
-
fabacb
-udevadm trigger -c add /sys/block/$BDEV1 &
fabacb
-udevadm trigger -c add /sys/block/$BDEV2 &
fabacb
-udevadm trigger -c add /sys/block/$BDEV3
fabacb
-
fabacb
-aux udev_wait
fabacb
-wait_lvm_activate $vg3
fabacb
-
fabacb
-ls "$RUNDIR/lvm/pvs_online/$PVID1"
fabacb
-ls "$RUNDIR/lvm/pvs_online/$PVID2"
fabacb
-ls "$RUNDIR/lvm/pvs_online/$PVID3"
fabacb
-ls "$RUNDIR/lvm/vgs_online/$vg3"
fabacb
-journalctl -u lvm-activate-$vg3 | tee out || true
fabacb
-grep "now active" out
fabacb
-check lv_field $vg3/$lv1 lv_active "active"
fabacb
-check lv_field $vg3/$lv2 lv_active "active"
fabacb
-check lv_field $vg3/$lv3 lv_active "active"
fabacb
-check lv_field $vg3/$lv4 lv_active "active"
fabacb
-
fabacb
-vgchange -an $vg3
fabacb
-vgremove -y $vg3
fabacb
-
fabacb
-
fabacb
-# 3 devs, 1 vg, 4 lvs, concurrent pvscans, metadata on only 1 PV
fabacb
-
fabacb
-wipe_all
fabacb
-rm $DF
fabacb
-touch $DF
fabacb
-pvcreate --metadatacopies 0 "$dev1"
fabacb
-pvcreate --metadatacopies 0 "$dev2"
fabacb
-pvcreate "$dev3"
fabacb
-
fabacb
-vgcreate $vg4 "$dev1" "$dev2" "$dev3"
fabacb
-lvcreate -l1 -an -n $lv1 $vg4 "$dev1"
fabacb
-lvcreate -l1 -an -n $lv2 $vg4 "$dev2"
fabacb
-lvcreate -l1 -an -n $lv3 $vg4 "$dev3"
fabacb
-lvcreate -l8 -an -n $lv4 -i 2 $vg4 "$dev1" "$dev2"
fabacb
-
fabacb
-PVID1=$(pvs "$dev1" --noheading -o uuid | tr -d - | awk '{print $1}')
fabacb
-PVID2=$(pvs "$dev2" --noheading -o uuid | tr -d - | awk '{print $1}')
fabacb
-PVID3=$(pvs "$dev3" --noheading -o uuid | tr -d - | awk '{print $1}')
fabacb
-
fabacb
-_clear_online_files
fabacb
-
fabacb
-udevadm trigger -c add /sys/block/$BDEV1 &
fabacb
-udevadm trigger -c add /sys/block/$BDEV2 &
fabacb
-udevadm trigger -c add /sys/block/$BDEV3
fabacb
-
fabacb
-aux udev_wait
fabacb
-wait_lvm_activate $vg4
fabacb
-
fabacb
-ls "$RUNDIR/lvm/pvs_online/$PVID1"
fabacb
-ls "$RUNDIR/lvm/pvs_online/$PVID2"
fabacb
-ls "$RUNDIR/lvm/pvs_online/$PVID3"
fabacb
-ls "$RUNDIR/lvm/vgs_online/$vg4"
fabacb
-journalctl -u lvm-activate-$vg4 | tee out || true
fabacb
-grep "now active" out
fabacb
-check lv_field $vg4/$lv1 lv_active "active"
fabacb
-check lv_field $vg4/$lv2 lv_active "active"
fabacb
-check lv_field $vg4/$lv3 lv_active "active"
fabacb
-check lv_field $vg4/$lv4 lv_active "active"
fabacb
-
fabacb
-vgchange -an $vg4
fabacb
-vgremove -y $vg4
fabacb
-
fabacb
-
fabacb
-# 3 devs, 3 vgs, 2 lvs in each vg, concurrent pvscans
fabacb
-
fabacb
-wipe_all
fabacb
-rm $DF
fabacb
-touch $DF
fabacb
-
fabacb
-vgcreate $vg5 "$dev1"
fabacb
-vgcreate $vg6 "$dev2"
fabacb
-vgcreate $vg7 "$dev3"
fabacb
-lvcreate -l1 -an -n $lv1 $vg5
fabacb
-lvcreate -l1 -an -n $lv2 $vg5
fabacb
-lvcreate -l1 -an -n $lv1 $vg6
fabacb
-lvcreate -l1 -an -n $lv2 $vg6
fabacb
-lvcreate -l1 -an -n $lv1 $vg7
fabacb
-lvcreate -l1 -an -n $lv2 $vg7
fabacb
-
fabacb
-_clear_online_files
fabacb
-
fabacb
-udevadm trigger -c add /sys/block/$BDEV1 &
fabacb
-udevadm trigger -c add /sys/block/$BDEV2 &
fabacb
-udevadm trigger -c add /sys/block/$BDEV3
fabacb
-
fabacb
-aux udev_wait
fabacb
-wait_lvm_activate $vg5
fabacb
-wait_lvm_activate $vg6
fabacb
-wait_lvm_activate $vg7
fabacb
-
fabacb
-ls "$RUNDIR/lvm/vgs_online/$vg5"
fabacb
-ls "$RUNDIR/lvm/vgs_online/$vg6"
fabacb
-ls "$RUNDIR/lvm/vgs_online/$vg7"
fabacb
-journalctl -u lvm-activate-$vg5 | tee out || true
fabacb
-grep "now active" out
fabacb
-journalctl -u lvm-activate-$vg6 | tee out || true
fabacb
-grep "now active" out
fabacb
-journalctl -u lvm-activate-$vg7 | tee out || true
fabacb
-grep "now active" out
fabacb
-check lv_field $vg5/$lv1 lv_active "active"
fabacb
-check lv_field $vg5/$lv2 lv_active "active"
fabacb
-check lv_field $vg6/$lv1 lv_active "active"
fabacb
-check lv_field $vg6/$lv2 lv_active "active"
fabacb
-check lv_field $vg7/$lv1 lv_active "active"
fabacb
-check lv_field $vg7/$lv2 lv_active "active"
fabacb
-
fabacb
-vgchange -an $vg5
fabacb
-vgremove -y $vg5
fabacb
-vgchange -an $vg6
fabacb
-vgremove -y $vg6
fabacb
-vgchange -an $vg7
fabacb
-vgremove -y $vg7
fabacb
-
fabacb
-# 3 devs, 1 vg, 1000 LVs
fabacb
-
fabacb
-wipe_all
fabacb
-rm $DF
fabacb
-touch $DF
fabacb
-pvcreate --metadatacopies 0 "$dev1"
fabacb
-pvcreate "$dev2"
fabacb
-pvcreate "$dev3"
fabacb
-vgcreate -s 128K $vg8 "$dev1" "$dev2" "$dev3"
fabacb
-
fabacb
-# Number of LVs to create
fabacb
-TEST_DEVS=1000
fabacb
-# On low-memory boxes let's not stress too much
fabacb
-test "$(aux total_mem)" -gt 524288 || TEST_DEVS=256
fabacb
-
fabacb
-vgcfgbackup -f data $vg8
fabacb
-
fabacb
-# Generate a lot of devices (size of 1 extent)
fabacb
-awk -v TEST_DEVS=$TEST_DEVS '/^\t\}/ {
fabacb
-    printf("\t}\n\tlogical_volumes {\n");
fabacb
-    cnt=0;
fabacb
-    for (i = 0; i < TEST_DEVS; i++) {
fabacb
-        printf("\t\tlvol%06d  {\n", i);
fabacb
-        printf("\t\t\tid = \"%06d-1111-2222-3333-2222-1111-%06d\"\n", i, i);
fabacb
-        print "\t\t\tstatus = [\"READ\", \"WRITE\", \"VISIBLE\"]";
fabacb
-        print "\t\t\tsegment_count = 1";
fabacb
-        print "\t\t\tsegment1 {";
fabacb
-        print "\t\t\t\tstart_extent = 0";
fabacb
-        print "\t\t\t\textent_count = 1";
fabacb
-        print "\t\t\t\ttype = \"striped\"";
fabacb
-        print "\t\t\t\tstripe_count = 1";
fabacb
-        print "\t\t\t\tstripes = [";
fabacb
-        print "\t\t\t\t\t\"pv0\", " cnt++;
fabacb
-        printf("\t\t\t\t]\n\t\t\t}\n\t\t}\n");
fabacb
-      }
fabacb
-  }
fabacb
-  {print}
fabacb
-' data >data_new
fabacb
-
fabacb
-vgcfgrestore -f data_new $vg8
fabacb
-
fabacb
-_clear_online_files
fabacb
-
fabacb
-udevadm trigger -c add /sys/block/$BDEV1 &
fabacb
-udevadm trigger -c add /sys/block/$BDEV2 &
fabacb
-udevadm trigger -c add /sys/block/$BDEV3
fabacb
-
fabacb
-aux udev_wait
fabacb
-wait_lvm_activate $vg8
fabacb
-
fabacb
-ls "$RUNDIR/lvm/vgs_online/$vg8"
fabacb
-journalctl -u lvm-activate-$vg8 | tee out || true
fabacb
-grep "now active" out
fabacb
-
fabacb
-num_active=$(lvs $vg8 --noheading -o active | grep active | wc -l)
fabacb
-
fabacb
-test $num_active -eq $TEST_DEVS
fabacb
-
fabacb
-vgchange -an $vg8
fabacb
-vgremove -y $vg8
fabacb
-
fabacb
-# 1 pv on an md dev, 1 vg
fabacb
-
fabacb
-wait_md_create() {
fabacb
-	local md=$1
fabacb
-
fabacb
-	while :; do
fabacb
-		if ! grep "$(basename $md)" /proc/mdstat; then
fabacb
-			echo "$md not ready"
fabacb
-			cat /proc/mdstat
fabacb
-			sleep 2
fabacb
-		else
fabacb
-			break
fabacb
-		fi
fabacb
-	done
fabacb
-	echo "$md" > WAIT_MD_DEV
fabacb
-}
fabacb
-
fabacb
-test -f /proc/mdstat && grep -q raid1 /proc/mdstat || \
fabacb
-       modprobe raid1 || skip
fabacb
-
fabacb
-mddev="/dev/md33"
fabacb
-not grep $mddev /proc/mdstat || skip
fabacb
-
fabacb
-wipe_all
fabacb
-rm $DF
fabacb
-touch $DF
fabacb
-
fabacb
-mdadm --create --metadata=1.0 "$mddev" --level 1 --chunk=64 --raid-devices=2 "$dev1" "$dev2"
fabacb
-wait_md_create "$mddev"
fabacb
-vgcreate $vg9 "$mddev"
fabacb
-
fabacb
-PVIDMD=`pvs $mddev --noheading -o uuid | tr -d - | awk '{print $1}'`
fabacb
-BDEVMD=$(basename "$mddev")
fabacb
-
fabacb
-lvcreate -l1 -an -n $lv1 $vg9
fabacb
-lvcreate -l1 -an -n $lv2 $vg9
fabacb
-
fabacb
-_clear_online_files
fabacb
-
fabacb
-udevadm trigger --settle -c add /sys/block/$BDEVMD
fabacb
-
fabacb
-wait_lvm_activate $vg9
fabacb
-
fabacb
-ls "$RUNDIR/lvm/vgs_online/$vg9"
fabacb
-journalctl -u lvm-activate-$vg9 | tee out || true
fabacb
-grep "now active" out
fabacb
-check lv_field $vg9/$lv1 lv_active "active"
fabacb
-check lv_field $vg9/$lv2 lv_active "active"
fabacb
-
fabacb
-vgchange -an $vg9
fabacb
-vgremove -y $vg9
fabacb
-
fabacb
-mdadm --stop "$mddev"
fabacb
-aux udev_wait
fabacb
-wipe_all
fabacb
-
fabacb
diff --git a/udev/69-dm-lvm.rules.in b/udev/69-dm-lvm.rules.in
fabacb
deleted file mode 100644
fabacb
index 39e5b9807..000000000
fabacb
--- a/udev/69-dm-lvm.rules.in
fabacb
+++ /dev/null
fabacb
@@ -1,87 +0,0 @@
fabacb
-# Copyright (C) 2012,2021 Red Hat, Inc. All rights reserved.
fabacb
-#
fabacb
-# This file is part of LVM.
fabacb
-#
fabacb
-# This rule requires blkid to be called on block devices before so only devices
fabacb
-# used as LVM PVs are processed (ID_FS_TYPE="LVM2_member").
fabacb
-
fabacb
-SUBSYSTEM!="block", GOTO="lvm_end"
fabacb
-(LVM_EXEC_RULE)
fabacb
-
fabacb
-ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="lvm_end"
fabacb
-
fabacb
-# Only process devices already marked as a PV - this requires blkid to be called before.
fabacb
-ENV{ID_FS_TYPE}!="LVM2_member", GOTO="lvm_end"
fabacb
-ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end"
fabacb
-ACTION=="remove", GOTO="lvm_end"
fabacb
-
fabacb
-# Create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for each PV
fabacb
-ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-id/lvm-pv-uuid-$env{ID_FS_UUID_ENC}"
fabacb
-
fabacb
-# If the PV is a special device listed below, scan only if the device is
fabacb
-# properly activated. These devices are not usable after an ADD event,
fabacb
-# but they require an extra setup and they are ready after a CHANGE event.
fabacb
-# Also support coldplugging with ADD event but only if the device is already
fabacb
-# properly activated.
fabacb
-# This logic should be eventually moved to rules where those particular
fabacb
-# devices are processed primarily (MD and loop).
fabacb
-
fabacb
-# DM device:
fabacb
-KERNEL!="dm-[0-9]*", GOTO="next"
fabacb
-ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", ENV{DM_ACTIVATION}=="1", GOTO="lvm_scan"
fabacb
-GOTO="lvm_end"
fabacb
-
fabacb
-# MD device:
fabacb
-LABEL="next"
fabacb
-KERNEL!="md[0-9]*", GOTO="next"
fabacb
-IMPORT{db}="LVM_MD_PV_ACTIVATED"
fabacb
-ACTION=="add", ENV{LVM_MD_PV_ACTIVATED}=="1", GOTO="lvm_scan"
fabacb
-ACTION=="change", ENV{LVM_MD_PV_ACTIVATED}!="1", TEST=="md/array_state", ENV{LVM_MD_PV_ACTIVATED}="1", GOTO="lvm_scan"
fabacb
-ACTION=="add", KERNEL=="md[0-9]*p[0-9]*", GOTO="lvm_scan"
fabacb
-ENV{LVM_MD_PV_ACTIVATED}!="1", ENV{SYSTEMD_READY}="0"
fabacb
-GOTO="lvm_end"
fabacb
-
fabacb
-# Loop device:
fabacb
-LABEL="next"
fabacb
-KERNEL!="loop[0-9]*", GOTO="next"
fabacb
-ACTION=="add", ENV{LVM_LOOP_PV_ACTIVATED}=="1", GOTO="lvm_scan"
fabacb
-ACTION=="change", ENV{LVM_LOOP_PV_ACTIVATED}!="1", TEST=="loop/backing_file", ENV{LVM_LOOP_PV_ACTIVATED}="1", GOTO="lvm_scan"
fabacb
-ENV{LVM_LOOP_PV_ACTIVATED}!="1", ENV{SYSTEMD_READY}="0"
fabacb
-GOTO="lvm_end"
fabacb
-
fabacb
-LABEL="next"
fabacb
-ACTION!="add", GOTO="lvm_end"
fabacb
-
fabacb
-LABEL="lvm_scan"
fabacb
-
fabacb
-ENV{SYSTEMD_READY}="1"
fabacb
-
fabacb
-# pvscan will check if this device completes a VG,
fabacb
-# i.e. all PVs in the VG are now present with the
fabacb
-# arrival of this PV.  If so, it prints to stdout:
fabacb
-# LVM_VG_NAME_COMPLETE='foo'
fabacb
-#
fabacb
-# When the VG is complete it can be activated, so
fabacb
-# vgchange -aay <vgname> is run.  It is run via
fabacb
-# systemd since it can take longer to run than
fabacb
-# udev wants to block when processing rules.
fabacb
-# (if there are hundreds of LVs to activate,
fabacb
-# the vgchange can take many seconds.)
fabacb
-#
fabacb
-# pvscan only reads the single device specified,
fabacb
-# and uses temp files under /run/lvm to check if
fabacb
-# other PVs in the VG are present.
fabacb
-#
fabacb
-# If event_activation=0 in lvm.conf, this pvscan
fabacb
-# (using checkcomplete) will do nothing, so that
fabacb
-# no event-based autoactivation will be happen.
fabacb
-#
fabacb
-# TODO: adjust the output of vgchange -aay so that
fabacb
-# it's better suited to appearing in the journal.
fabacb
-
fabacb
-IMPORT{program}="(LVM_EXEC)/lvm pvscan --cache --listvg --checkcomplete --vgonline --udevoutput --journal=output $env{DEVNAME}"
fabacb
-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}"
fabacb
-GOTO="lvm_end"
fabacb
-
fabacb
-LABEL="lvm_end"
fabacb
-
fabacb
diff --git a/udev/Makefile.in b/udev/Makefile.in
fabacb
index e777dda16..e32cba921 100644
fabacb
--- a/udev/Makefile.in
fabacb
+++ b/udev/Makefile.in
fabacb
@@ -18,7 +18,7 @@ top_builddir = @top_builddir@
fabacb
 include $(top_builddir)/make.tmpl
fabacb
 
fabacb
 DM_RULES=10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
fabacb
-LVM_RULES=11-dm-lvm.rules 69-dm-lvm.rules
fabacb
+LVM_RULES=11-dm-lvm.rules 69-dm-lvm-metad.rules
fabacb
 
fabacb
 DM_DIR=$(shell $(GREP) "\#define DM_DIR" $(top_srcdir)/libdm/misc/dm-ioctl.h | $(AWK) '{print $$3}')
fabacb
 
fabacb
-- 
4d51e5
2.34.3
fabacb