blob: 7bdf268e1b47bc0e50f781f97c331bc0bc8df7e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#!/usr/bin/env bash
# Copyright (C) 2020 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# Test various error conditions user may hit with thin volumes
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
. lib/inittest
#
# Main
#
aux have_thin 1 3 0 || skip
aux thin_pool_error_works_32 || skip
aux prepare_vg 2
###############################################
# Testing failing thin-pool metadata device #
###############################################
lvcreate -T -L1M --errorwhenfull y $vg/pool
lvcreate -V2 -n $lv1 $vg/pool
lvcreate -s -n $lv2 $vg/$lv1
# Prepare old metadata with transaction_id 2
vgcfgbackup -f mda_tid_2 $vg
lvcreate -s -n $lv3 $vg/$lv1
lvcreate -s -n $lv4 $vg/$lv1
lvcreate -s -n $lv5 $vg/$lv1
vgcfgbackup -f mda_tid_5 $vg
# Restore mismatching old metadata with different transaction_id
vgcfgrestore -f mda_tid_2 --force --yes $vg
not lvcreate -s -n $lv5 $vg/$lv1
sed -e 's/transaction_id = 2/transaction_id = 5/g' mda_tid_2 > mda_tid_2_5
# Restore metadata with matching transaction_id,
# but already existing device in kernel, unknown to lvm2
vgcfgrestore -f mda_tid_2_5 --force --yes $vg
not lvcreate -s -n $lv5 $vg/$lv1
# can be tried repeatedly
not lvcreate -s -n $lv5 $vg/$lv1
# Restore matching metadata and check all works
# and no kernel thin device was lost
vgcfgrestore -f mda_tid_5 --force --yes $vg
lvcreate -s -n $lv6 $vg/$lv1
lvchange -ay -K $vg
check active $vg $lv1
check active $vg $lv2
check active $vg $lv3
check active $vg $lv4
check active $vg $lv5
check active $vg $lv6
vgremove -ff $vg
|