[lvm-devel] master - tests: add new test for lvm on md devices

David Teigland teigland at sourceware.org
Thu Oct 18 18:07:28 UTC 2018


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7498f8383397a93db95655ca227257836cbcac82
Commit:        7498f8383397a93db95655ca227257836cbcac82
Parent:        9e1ee07d696fb0a1771f7dcd4490ed9ace0fa8d6
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Thu Oct 18 13:06:42 2018 -0500
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Thu Oct 18 13:06:42 2018 -0500

tests: add new test for lvm on md devices

---
 test/shell/lvm-on-md.sh |   87 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 87 insertions(+), 0 deletions(-)

diff --git a/test/shell/lvm-on-md.sh b/test/shell/lvm-on-md.sh
new file mode 100644
index 0000000..ec8cc23
--- /dev/null
+++ b/test/shell/lvm-on-md.sh
@@ -0,0 +1,87 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2018 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
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+test -f /proc/mdstat && grep -q raid1 /proc/mdstat || \
+	modprobe raid1 || skip
+
+aux lvmconf 'devices/md_component_detection = 1'
+aux extend_filter_LVMTEST "a|/dev/md|"
+
+aux prepare_devs 2
+
+# create 2 disk MD raid1 array
+# by default using metadata format 1.0 with data at the end of device
+aux prepare_md_dev 1 64 2 "$dev1" "$dev2"
+
+mddev=$(< MD_DEV)
+pvdev=$(< MD_DEV_PV)
+
+vgcreate $vg "$mddev"
+
+lvs $vg
+
+lvcreate -n $lv1 -l 2 $vg
+lvcreate -n $lv2 -l 2 -an $vg
+
+lvchange -ay $vg/$lv2
+
+lvs $vg
+
+pvs -vvvv 2>&1|tee pvs.out
+
+vgchange -an $vg
+
+vgchange -ay -vvvv $vg 2>&1| tee vgchange.out
+
+lvs $vg
+pvs
+
+vgchange -an $vg
+
+mdadm --stop "$mddev"
+
+# with md superblock 1.0 this pvs will report duplicates
+# for the two md legs since the md device itself is not
+# started
+pvs 2>&1 |tee out
+cat out
+grep "prefers device" out
+
+pvs -vvvv 2>&1| tee pvs2.out
+
+# should not activate from the md legs
+not vgchange -ay -vvvv $vg 2>&1|tee vgchange-fail.out
+
+# should not show an active lv
+lvs $vg
+
+# start the md dev
+mdadm --assemble "$mddev" "$dev1" "$dev2"
+
+# Now that the md dev is online, pvs can see it and
+# ignore the two legs, so there's no duplicate warning
+
+pvs 2>&1 |tee out
+cat out
+not grep "prefers device" out
+
+vgchange -ay $vg 2>&1 |tee out
+cat out
+not grep "prefers device" out
+
+vgchange -an $vg
+
+vgremove -f $vg




More information about the lvm-devel mailing list