2008-11-10 15:43:35 +03:00
#!/bin/sh
# Copyright (C) 2008 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,
2016-01-21 13:49:46 +03:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2008-11-10 15:43:35 +03:00
2015-10-27 17:10:06 +03:00
SKIP_WITH_LVMPOLLD = 1
2008-09-29 20:06:10 +04:00
2015-10-27 17:10:06 +03:00
. lib/inittest
2015-05-09 02:59:18 +03:00
2012-03-16 17:00:05 +04:00
check_( ) {
2012-03-28 11:46:35 +04:00
# vgscan needs --cache option for direct scan if lvmetad is used
test -e LOCAL_LVMETAD && cache = "--cache"
vgscan $cache 2>& 1 | tee vgscan.out
2012-09-20 03:57:55 +04:00
$1 grep " Inconsistent metadata found for VG $vg " vgscan.out
2012-03-16 17:00:05 +04:00
}
2008-09-29 20:06:10 +04:00
aux prepare_vg 3
2013-08-08 00:48:31 +04:00
lvcreate -an -Zn --type mirror -m 1 -l 1 -n mirror $vg
2013-06-15 13:21:03 +04:00
#lvchange -a n $vg
2008-09-29 20:06:10 +04:00
2008-11-10 15:43:35 +03:00
# try orphaning a missing PV (bz45867)
2012-03-16 17:00:05 +04:00
aux disable_dev " $dev1 "
2008-09-29 20:06:10 +04:00
vgreduce --removemissing --force $vg
2012-03-16 17:00:05 +04:00
aux enable_dev " $dev1 "
2012-09-20 03:57:55 +04:00
2012-03-16 17:00:05 +04:00
check_
2012-09-20 03:57:55 +04:00
test -e LOCAL_LVMETAD && pvcreate -f " $dev1 "
check_ not
2008-09-29 20:06:10 +04:00
# try to just change metadata; we expect the new version (with MISSING_PV set
# on the reappeared volume) to be written out to the previously missing PV
2012-03-16 17:00:05 +04:00
vgextend $vg " $dev1 "
2012-09-20 03:57:55 +04:00
lvcreate -l 1 -n boo -a n --zero n $vg
2012-03-16 17:00:05 +04:00
aux disable_dev " $dev1 "
2008-09-29 20:06:10 +04:00
lvremove $vg /mirror
2012-03-16 17:00:05 +04:00
aux enable_dev " $dev1 "
check_
2012-09-20 03:57:55 +04:00
test -e LOCAL_LVMETAD && lvremove $vg /boo # FIXME trigger a write :-(
check_ not
2014-02-27 02:25:30 +04:00
2015-06-10 17:27:59 +03:00
aux disable_dev " $dev1 "
vgreduce --removemissing --force $vg
aux enable_dev " $dev1 "
2015-06-23 14:39:57 +03:00
vgscan 2>& 1 | tee out
grep 'Removing PV' out
vgs 2>& 1 | tee out
not grep 'Removing PV' out
2015-06-10 17:27:59 +03:00
2014-02-27 02:25:30 +04:00
vgremove -ff $vg