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,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2014-06-06 19:40:04 +04:00
. lib/inittest
2008-09-29 20:06:10 +04: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
vgremove -ff $vg