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
16 # Clean-up and create a 2-way mirror, where the the
17 # leg devices are always on $dev[12] and the log
18 # is always on $dev3. ($dev4 behaves as a spare)
20 vgreduce --removemissing $vg
21 for d in "$@"; do enable_dev $d; done
22 for d in "$@"; do vgextend $vg $d; done
23 lvremove -ff $vg/mirror
24 lvcreate -m 1 --ig -l 2 -n mirror $vg $dev1 $dev2 $dev3:0
28 lvconvert --repair --use-policies --config "$1" $vg/mirror
31 lvcreate -m 1 -L 1 -n mirror $vg
32 lvchange -a n $vg/mirror
34 # Fail a leg of a mirror.
36 lvchange --partial -a y $vg/mirror
37 repair 'activation { mirror_image_fault_policy = "remove" }'
38 check linear $vg mirror
41 # Fail a leg of a mirror.
42 # Expected result: Mirror (leg replaced)
44 repair 'activation { mirror_image_fault_policy = "replace" }'
45 check mirror $vg mirror
46 lvs | grep mirror_mlog
49 # Fail a leg of a mirror (use old name for policy specification)
50 # Expected result: Mirror (leg replaced)
52 repair 'activation { mirror_device_fault_policy = "replace" }'
53 check mirror $vg mirror
54 lvs | grep mirror_mlog
57 # Fail a leg of a mirror w/ no available spare
58 # Expected result: 2-way with corelog
59 aux disable_dev $dev2 $dev4
60 repair 'activation { mirror_image_fault_policy = "replace" }'
61 check mirror $vg mirror
62 lvs | not grep mirror_mlog
63 aux cleanup $dev2 $dev4
65 # Fail the log device of a mirror w/ no available spare
66 # Expected result: mirror w/ corelog
67 aux disable_dev $dev3 $dev4
68 repair 'activation { mirror_image_fault_policy = "replace" }' $vg/mirror
69 check mirror $vg mirror
70 lvs | not grep mirror_mlog
71 aux cleanup $dev3 $dev4
73 # Fail the log device with a remove policy
74 # Expected result: mirror w/ corelog
75 lvchange -a y $vg/mirror
76 aux disable_dev $dev3 $dev4
77 repair 'activation { mirror_log_fault_policy = "remove" }'
78 check mirror $vg mirror core
79 lvs | not grep mirror_mlog