summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2021-11-29 17:13:44 -0600
committerDavid Teigland <teigland@redhat.com>2021-11-29 17:13:44 -0600
commitd12baba1a9bfe2d82537b20bc768758d84b263b6 (patch)
tree79da320a19027c64fa73562d389505347daa08f3 /test
parent009007484b88fb16e2177deaf4774d0e50576a06 (diff)
downloadlvm2-d12baba1a9bfe2d82537b20bc768758d84b263b6.tar.gz
pvscan: match device arg to filter symlink
This fixes an issue related to the optimization in "pvscan: only add device args to dev cache" If the devices file is not used, and the lvm.conf filter accepts devices via symlink names, then those devices won't be accepted by pvscan for autoactivation. To resolve this, recognize when the filter contains symlinks and disable the optimization. When the optimization is disabled, a full dev_cache_scan is performed, and symlinks are associated with the device names passed to pvscan. filter-regex will accept a device if symlinks to that device are accepted.
Diffstat (limited to 'test')
-rw-r--r--test/shell/udev-pvscan-vgchange.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/shell/udev-pvscan-vgchange.sh b/test/shell/udev-pvscan-vgchange.sh
index a82bf8876..a209dc048 100644
--- a/test/shell/udev-pvscan-vgchange.sh
+++ b/test/shell/udev-pvscan-vgchange.sh
@@ -381,8 +381,13 @@ BDEVMD=$(basename "$mddev")
lvcreate -l1 -an -n $lv1 $vg9
lvcreate -l1 -an -n $lv2 $vg9
+mdadm --stop "$mddev"
+systemctl stop lvm-activate-$vg9 || true
_clear_online_files
+mdadm --assemble "$mddev" "$dev1" "$dev2"
+# this trigger might be redundant because the mdadm --assemble
+# probably triggers an add uevent
udevadm trigger --settle -c add /sys/block/$BDEVMD
wait_lvm_activate $vg9
@@ -410,3 +415,51 @@ systemctl stop lvm-activate-$vg7
systemctl stop lvm-activate-$vg8
systemctl stop lvm-activate-$vg9
+
+# no devices file, filter with symlink of PV
+# the pvscan needs to look at all dev names to
+# match the symlink in the filter with the
+# dev name (or major minor) passed to pvscan.
+# This test doesn't really belong in this file
+# because it's not testing lvm-activate.
+
+aux lvmconf 'devices/use_devicesfile = 0'
+_clear_online_files
+rm "$DF"
+vgcreate $vg10 "$dev1"
+lvcreate -l1 -an -n $lv1 $vg10 "$dev1"
+
+PVID1=$(pvs "$dev1" --noheading -o uuid | tr -d - | awk '{print $1}')
+# PVID with dashes
+OPVID1=`pvs "$dev1" --noheading -o uuid | awk '{print $1}'`
+
+udevadm trigger --settle -c add /sys/block/$BDEV1
+
+# uevent from the trigger should create this symlink
+ls /dev/disk/by-id/lvm-pv-uuid-$OPVID1
+
+vgchange -an $vg10
+systemctl stop lvm-activate-$vg10
+_clear_online_files
+
+aux lvmconf "devices/filter = [ \"a|/dev/disk/by-id/lvm-pv-uuid-$OPVID1|\", \"r|.*|\" ]"
+aux lvmconf 'devices/global_filter = [ "a|.*|" ]'
+
+pvscan --cache -aay "$dev1"
+
+check lv_field $vg10/$lv1 lv_active "active"
+
+vgchange -an $vg10
+_clear_online_files
+
+aux lvmconf 'devices/filter = [ "a|lvm-pv-uuid|", "r|.*|" ]'
+aux lvmconf 'devices/global_filter = [ "a|.*|" ]'
+
+pvscan --cache -aay "$dev1"
+
+check lv_field $vg10/$lv1 lv_active "active"
+
+vgchange -an $vg10
+vgremove -y $vg10
+wipe_all
+