summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2018-10-18 12:33:56 -0500
committerDavid Teigland <teigland@redhat.com>2018-10-18 12:36:11 -0500
commitd1b652143abc9c0c02eea62dd424d0285ab8fb52 (patch)
treead7a3a0a5c7a83cd5bbc4323d2aac0aa0a7d506d
parente7bb50880901a4462e350ce0d272a63aa8440781 (diff)
downloadlvm2-d1b652143abc9c0c02eea62dd424d0285ab8fb52.tar.gz
tests: add new test for lvm on md devices
-rw-r--r--test/shell/lvm-on-md.sh87
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 000000000..ec8cc2372
--- /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