2017-07-02 22:38:32 +03:00
#!/usr/bin/env bash
2013-11-28 18:47:20 +04:00
# 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,
2016-01-21 13:49:46 +03:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2013-11-28 18:47:20 +04:00
# 'Exercise signature wiping during lvcreate'
2018-05-24 17:49:48 +03:00
2015-10-27 17:10:06 +03:00
SKIP_WITH_LVMPOLLD = 1
2013-11-28 18:47:20 +04:00
2015-10-27 17:10:06 +03:00
. lib/inittest
2015-05-09 02:59:18 +03:00
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
2020-06-23 15:10:18 +03:00
# Zeroing stops the command when there is a failure (write error in this case)
aux error_dev " $dev1 " " $( get first_extent_sector " $dev1 " ) :2 "
not lvcreate -l1 -n $lv1 $vg 2>& 1 | tee out
grep "Failed to initialize" out
aux enable_dev " $dev1 "
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