From: David Teigland Date: Thu, 18 Oct 2018 13:37:37 -0400 Subject: 2018-06-01-stable - tests: add new test for lvm on md devices Message-ID: <201810181737.w9IHbbvg008948@lists01.pubmisc.prod.ext.phx2.redhat.com> List-Id: To: lvm-devel@redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d1b652143abc9c0c02eea62dd424d0285ab8fb52 Commit: d1b652143abc9c0c02eea62dd424d0285ab8fb52 Parent: e7bb50880901a4462e350ce0d272a63aa8440781 Author: David Teigland AuthorDate: Thu Oct 18 12:33:56 2018 -0500 Committer: David Teigland CommitterDate: Thu Oct 18 12:36:11 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