summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2021-11-17 17:10:45 -0600
committerDavid Teigland <teigland@redhat.com>2021-11-18 17:41:00 -0600
commit212b1fc529a7d550c49f32cb7cbecb017ceb35b0 (patch)
treefc7a203e3d651dfb046d474cf622807ccdfd0812 /test
parentb8f4ec846d8f4f5256b2737a6d6127482ef7b44e (diff)
downloadlvm2-212b1fc529a7d550c49f32cb7cbecb017ceb35b0.tar.gz
devices: exclude multipath components based on matching wwid
If multipath component devices get through the filter and cause lvm to see duplicate PVs, then check the wwid of the devs and drop the component devices as if they had been filtered. If a dm mpath device was found among the duplicates then use that as the PV, otherwise do not use any of the components as the PV. "duplicate PVs" associated with multipath configs will no longer stop commands from working.
Diffstat (limited to 'test')
-rw-r--r--test/shell/duplicate-pvs-multipath.sh67
1 files changed, 67 insertions, 0 deletions
diff --git a/test/shell/duplicate-pvs-multipath.sh b/test/shell/duplicate-pvs-multipath.sh
new file mode 100644
index 000000000..a145e4afb
--- /dev/null
+++ b/test/shell/duplicate-pvs-multipath.sh
@@ -0,0 +1,67 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2021 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+test_description='udev rule and systemd unit run vgchange'
+
+SKIP_WITH_LVMPOLLD=1
+SKIP_WITH_LVMLOCKD=1
+
+. lib/inittest
+
+# FIXME: skip until mpath/scsi_debug cleanup works after a failure
+skip
+
+modprobe --dry-run scsi_debug || skip
+multipath -l || skip
+multipath -l | grep scsi_debug && skip
+
+# Turn off multipath_component_detection so that the duplicate
+# resolution of mpath components is used.
+aux lvmconf 'devices/multipath_component_detection = 0'
+# Prevent wwids from being used for filtering.
+aux lvmconf 'devices/multipath_wwids_file = "/dev/null"'
+# Need to use /dev/mapper/mpath
+aux lvmconf 'devices/dir = "/dev"'
+aux lvmconf 'devices/scan = "/dev"'
+# Could set filter to $MP and the component /dev/sd devs
+aux lvmconf "devices/filter = [ \"a|.*|\" ]"
+aux lvmconf "devices/global_filter = [ \"a|.*|\" ]"
+
+modprobe scsi_debug dev_size_mb=100 num_tgts=1 vpd_use_hostno=0 add_host=4 delay=20 max_luns=2 no_lun_0=1
+sleep 2
+
+multipath -r
+sleep 2
+
+MPB=$(multipath -l | grep scsi_debug | cut -f1 -d ' ')
+echo $MPB
+MP=/dev/mapper/$MPB
+echo $MP
+
+pvcreate $MP
+vgcreate $vg1 $MP
+lvcreate -l1 $vg1
+vgchange -an $vg1
+
+pvs |tee out
+grep $MP out
+for i in $(grep -H scsi_debug /sys/block/sd*/device/model | cut -f4 -d /); do
+ not grep /dev/$i out;
+done
+
+vgchange -an $vg1
+vgremove -y $vg1
+
+sleep 2
+multipath -f $MP
+sleep 1
+rmmod scsi_debug