2008-11-10 12:43:35 +00: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,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2014-06-06 17:40:04 +02:00
. lib/inittest
2008-09-29 16:06:10 +00:00
2015-05-09 00:59:18 +01:00
test -e LOCAL_LVMPOLLD && skip
2012-03-16 13:00:05 +00:00
check_( ) {
2012-03-28 07:46:35 +00: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 01:57:55 +02:00
$1 grep " Inconsistent metadata found for VG $vg " vgscan.out
2012-03-16 13:00:05 +00:00
}
2008-09-29 16:06:10 +00:00
aux prepare_vg 3
2013-08-07 15:48:31 -05:00
lvcreate -an -Zn --type mirror -m 1 -l 1 -n mirror $vg
2013-06-15 11:21:03 +02:00
#lvchange -a n $vg
2008-09-29 16:06:10 +00:00
2008-11-10 12:43:35 +00:00
# try orphaning a missing PV (bz45867)
2012-03-16 13:00:05 +00:00
aux disable_dev " $dev1 "
2008-09-29 16:06:10 +00:00
vgreduce --removemissing --force $vg
2012-03-16 13:00:05 +00:00
aux enable_dev " $dev1 "
2012-09-20 01:57:55 +02:00
2012-03-16 13:00:05 +00:00
check_
2012-09-20 01:57:55 +02:00
test -e LOCAL_LVMETAD && pvcreate -f " $dev1 "
check_ not
2008-09-29 16:06:10 +00: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 13:00:05 +00:00
vgextend $vg " $dev1 "
2012-09-20 01:57:55 +02:00
lvcreate -l 1 -n boo -a n --zero n $vg
2012-03-16 13:00:05 +00:00
aux disable_dev " $dev1 "
2008-09-29 16:06:10 +00:00
lvremove $vg /mirror
2012-03-16 13:00:05 +00:00
aux enable_dev " $dev1 "
check_
2012-09-20 01:57:55 +02:00
test -e LOCAL_LVMETAD && lvremove $vg /boo # FIXME trigger a write :-(
check_ not
2014-02-26 23:25:30 +01:00
2015-06-10 16:27:59 +02:00
aux disable_dev " $dev1 "
vgreduce --removemissing --force $vg
aux enable_dev " $dev1 "
2015-06-23 13:39:57 +02:00
vgscan 2>& 1 | tee out
grep 'Removing PV' out
vgs 2>& 1 | tee out
not grep 'Removing PV' out
2015-06-10 16:27:59 +02:00
2014-02-26 23:25:30 +01:00
vgremove -ff $vg