2
# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
4
# This copyrighted material is made available to anyone wishing to use,
5
# modify, copy, or redistribute it subject to the terms and conditions
6
# of the GNU General Public License v.2.
8
# You should have received a copy of the GNU General Public License
9
# along with this program; if not, write to the Free Software Foundation,
10
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
aux lvmconf 'allocation/maximise_cling = 0'
16
aux lvmconf 'allocation/mirror_logs_require_separate_pvs = 1'
18
# Clean-up and create a 2-way mirror, where the the
19
# leg devices are always on $dev[12] and the log
20
# is always on $dev3. ($dev4 behaves as a spare)
22
vgreduce --removemissing $vg
23
for d in "$@"; do aux enable_dev $d; done
24
for d in "$@"; do vgextend $vg $d; done
25
lvremove -ff $vg/mirror
26
lvcreate -m 1 --ig -l 2 -n mirror $vg $dev1 $dev2 $dev3:0
30
lvconvert --repair --use-policies --config "$1" $vg/mirror
33
lvcreate -m 1 -L 1 -n mirror $vg
34
lvchange -a n $vg/mirror
36
# Fail a leg of a mirror.
38
lvchange --partial -a y $vg/mirror
39
repair 'activation { mirror_image_fault_policy = "remove" }'
40
check linear $vg mirror
43
# Fail a leg of a mirror.
44
# Expected result: Mirror (leg replaced, should retain log)
46
repair 'activation { mirror_image_fault_policy = "replace" mirror_log_fault_policy = "remove" }'
47
check mirror $vg mirror
48
check active $vg mirror_mlog
51
# Fail a leg of a mirror.
52
# Expected result: Mirror (leg replaced)
54
repair 'activation { mirror_image_fault_policy = "replace" }'
55
check mirror $vg mirror
56
check active $vg mirror_mlog
59
# Fail a leg of a mirror (use old name for policy specification)
60
# Expected result: Mirror (leg replaced)
62
repair 'activation { mirror_image_fault_policy = "replace" }'
63
check mirror $vg mirror
64
check active $vg mirror_mlog
67
# Fail a leg of a mirror w/ no available spare
68
# Expected result: linear
69
# (or 2-way with leg/log overlap if alloc anywhere)
70
aux disable_dev $dev2 $dev4
71
repair 'activation { mirror_image_fault_policy = "replace" }'
72
check mirror $vg mirror
73
not check lv_exists $vg mirror_mlog
76
# Fail the log device of a mirror w/ no available spare
77
# Expected result: mirror w/ corelog
78
aux disable_dev $dev3 $dev4
79
repair 'activation { mirror_image_fault_policy = "replace" }' $vg/mirror
80
check mirror $vg mirror
81
not check lv_exists $vg mirror_mlog
84
# Fail the log device with a remove policy
85
# Expected result: mirror w/ corelog
86
lvchange -a y $vg/mirror
87
aux disable_dev $dev3 $dev4
88
repair 'activation { mirror_log_fault_policy = "remove" }'
89
check mirror $vg mirror core
90
not check lv_exists $vg mirror_mlog