2017-07-02 21:38:32 +02:00
#!/usr/bin/env bash
2018-12-17 19:24:37 +01:00
# Copyright (C) 2008,2018 Red Hat, Inc. All rights reserved.
2008-11-11 15:29:24 +00:00
#
# 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 11:49:46 +01:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2008-11-11 15:29:24 +00:00
# 'Exercise some lvcreate diagnostics'
2018-05-24 09:49:48 -05:00
2015-10-27 15:10:06 +01:00
SKIP_WITH_LVMPOLLD = 1
2008-11-11 15:29:24 +00:00
2015-10-27 15:10:06 +01:00
. lib/inittest
2015-05-09 00:59:18 +01:00
2018-12-17 19:24:37 +01:00
aux lvmconf "global/support_mirrored_mirror_log=1"
2008-11-11 15:29:24 +00:00
cleanup_lvs( ) {
lvremove -ff $vg
2012-03-28 11:10:08 +00:00
( dm_table | not grep $vg ) || \
die "ERROR: lvremove did leave some some mappings in DM behind!"
2008-11-11 15:29:24 +00:00
}
2011-01-05 00:16:18 +00:00
aux prepare_pvs 2
2017-07-06 19:41:25 +02:00
get_devs
2012-03-16 13:00:05 +00:00
aux pvcreate --metadatacopies 0 " $dev1 "
2018-05-24 09:49:48 -05:00
aux vgcreate $SHARED " $vg " " ${ DEVICES [@] } "
2008-11-11 15:29:24 +00:00
2010-03-26 22:15:43 +00:00
# ---
# Create snapshots of LVs on --metadatacopies 0 PV (bz450651)
2013-05-31 21:11:51 +02:00
lvcreate -aey -n$lv1 -l4 $vg " $dev1 "
2008-11-11 15:29:24 +00:00
lvcreate -n$lv2 -l4 -s $vg /$lv1
2011-07-25 08:41:52 +00:00
lvcreate -n$lv3 -l4 --permission r -s $vg /$lv1
2008-11-11 15:29:24 +00:00
cleanup_lvs
2018-12-18 10:55:35 +01:00
# Skip the rest for cluster
if test -e LOCAL_CLVMD; then
# ---
# Create mirror on two devices with mirrored log using --alloc anywhere - should always fail in cluster
not lvcreate --type mirror -m 1 -l4 -n $lv1 --mirrorlog mirrored $vg --alloc anywhere " $dev1 " " $dev2 "
cleanup_lvs
else
# ---
# Create mirror on two devices with mirrored log using --alloc anywhere
lvcreate --type mirror -m 1 -l4 -n $lv1 --mirrorlog mirrored $vg --alloc anywhere " $dev1 " " $dev2 "
cleanup_lvs
# --
# Create mirror on one dev with mirrored log using --alloc anywhere, should fail
not lvcreate --type mirror -m 1 -l4 -n $lv1 --mirrorlog mirrored $vg --alloc anywhere " $dev1 "
cleanup_lvs
fi
2014-02-26 23:25:30 +01:00
vgremove -ff $vg