2013-11-28 18:47:20 +04:00
#!/bin/sh
# Copyright (C) 2013 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
# 'Exercise signature wiping during lvcreate'
2014-06-06 19:40:04 +04:00
. lib/inittest
2013-11-28 18:47:20 +04:00
2015-05-09 02:59:18 +03:00
test -e LOCAL_LVMPOLLD && skip
2014-03-25 12:59:43 +04:00
init_lv_( ) {
mkswap " $DM_DEV_DIR / $vg / $lv1 "
}
test_blkid_( ) {
2014-06-30 22:04:24 +04:00
local type
type = $( blkid -s TYPE -o value -c /dev/null " $DM_DEV_DIR / $vg / $lv1 " )
2014-03-25 12:59:43 +04:00
test " $type " = "swap"
}
test_msg_( ) {
grep "Wiping swap signature" out
}
2014-03-20 02:33:01 +04:00
aux prepare_vg
2013-11-28 18:47:20 +04:00
# lvcreate wipes signatures when found on newly created LV - test this on "swap".
# Test all combinatios with -Z{y|n} and -W{y|n} and related lvm.conf settings.
lvcreate -l1 -n $lv1 $vg
2014-03-25 12:59:43 +04:00
init_lv_
# This system has unusable blkid (does not recognize small swap, needs fix...)
test_blkid_ || skip
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2013-12-09 13:35:47 +04:00
aux lvmconf "allocation/wipe_signatures_when_zeroing_new_lvs = 0"
2013-11-28 18:47:20 +04:00
2014-03-25 12:59:43 +04:00
lvcreate -y -Zn -l1 -n $lv1 $vg 2>& 1 | tee out
not test_msg_
test_blkid_
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2014-03-25 12:59:43 +04:00
lvcreate -y -Zn -Wn -l1 -n $lv1 $vg 2>& 1 | tee out
not test_msg_
test_blkid_
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2014-03-25 12:59:43 +04:00
lvcreate -y -Zn -Wy -l1 -n $lv1 $vg 2>& 1 | tee out
test_msg_
not test_blkid_
init_lv_
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2014-03-25 12:59:43 +04:00
lvcreate -y -Zy -l1 -n $lv1 $vg 2>& 1 | tee out
not test_msg_
not test_blkid_
init_lv_
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2014-03-25 12:59:43 +04:00
lvcreate -y -Zy -Wn -l1 -n $lv1 $vg 2>& 1 | tee out
not test_msg_
not test_blkid_
init_lv_
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2014-03-25 12:59:43 +04:00
lvcreate -y -Zy -Wy -l1 -n $lv1 $vg 2>& 1 | tee out
test_msg_
not test_blkid_
init_lv_
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2013-12-09 13:35:47 +04:00
aux lvmconf "allocation/wipe_signatures_when_zeroing_new_lvs = 1"
2013-11-28 18:47:20 +04:00
2014-03-25 12:59:43 +04:00
lvcreate -y -Zn -l1 -n $lv1 $vg 2>& 1 | tee out
not test_msg_
test_blkid_
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2014-03-25 12:59:43 +04:00
lvcreate -y -Zn -Wn -l1 -n $lv1 $vg 2>& 1 | tee out
not test_msg_
test_blkid_
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2014-03-25 12:59:43 +04:00
lvcreate -y -Zn -Wy -l1 -n $lv1 $vg 2>& 1 | tee out
test_msg_
not test_blkid_
init_lv_
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2014-03-25 12:59:43 +04:00
lvcreate -y -Zy -l1 -n $lv1 $vg 2>& 1 | tee out
test_msg_
not test_blkid_
init_lv_
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2014-03-25 12:59:43 +04:00
lvcreate -y -Zy -Wn -l1 -n $lv1 $vg 2>& 1 | tee out
not test_msg_
not test_blkid_
init_lv_
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2014-03-25 12:59:43 +04:00
lvcreate -y -Zy -Wy -l1 -n $lv1 $vg 2>& 1 | tee out
test_msg_
not test_blkid_
init_lv_
2013-11-28 18:47:20 +04:00
lvremove -f $vg /$lv1
2014-03-20 02:33:01 +04:00
vgremove -f $vg