File: lvcreate-thin-external-stack.sh

package info (click to toggle)
lvm2 2.03.31-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,920 kB
  • sloc: ansic: 180,675; sh: 42,231; python: 6,554; makefile: 2,079; cpp: 1,258; ruby: 66; awk: 20
file content (86 lines) | stat: -rw-r--r-- 2,013 bytes parent folder | download
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
80
81
82
83
84
85
86
#!/usr/bin/env bash

# Copyright (C) 2023 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 creation of stack of external thin origins


SKIP_WITH_LVMPOLLD=1

export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}

. lib/inittest

which mkfs.ext4 || skip
which fsck || skip

#
# Main
#
aux have_thin 1 3 0 || skip

aux prepare_vg 2 64

# Create original thin pool with 1st. external origin LV using thin from this pool
lvcreate -T -L10M -V20M -n $lv1 $vg/pool1
mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"

# 2nd. layer
lvcreate -T -L10M $vg/pool2
lvchange -an $vg/$lv1
lvchange -pr $vg/$lv1
lvcreate --type thin -n $lv2 --thinpool pool2 $vg/$lv1

lvs -ao+uuid $vg
fsck -n "$DM_DEV_DIR/$vg/$lv2"

# 3rd. layer
lvcreate -T -L10M $vg/pool3
lvchange -an $vg/$lv2
lvchange -pr $vg/$lv2
lvs -a $vg
lvcreate --type thin -n $lv3 --thinpool pool3 $vg/$lv2

fsck -n "$DM_DEV_DIR/$vg/$lv3"

# 4th. layer
lvcreate -T -L10M $vg/pool4
lvchange -an $vg/$lv3
lvchange -pr $vg/$lv3
lvcreate --type thin -n $lv4 --thinpool pool4 $vg/$lv3

lvs -a $vg
fsck -n "$DM_DEV_DIR/$vg/$lv4"

# Create multiple LVs using same external origin
# using also the 'snapshot' interface
lvcreate -s -n ${lv2}a --thinpool pool2 $vg/$lv1
lvcreate -s -n ${lv2}b --thinpool pool2 $vg/$lv1
lvcreate -s -n ${lv2}c --thinpool pool2 $vg/$lv1

lvs -a $vg

lvcreate -s -n ${lv3}a --thinpool pool3 $vg/$lv2
lvcreate -s -n ${lv3}b --thinpool pool3 $vg/$lv2
lvcreate -s -n ${lv3}c --thinpool pool3 $vg/$lv2

fsck -n "$DM_DEV_DIR/$vg/${lv3}c"

check active $vg ${lv3}a
vgchange -an $vg
check inactive $vg ${lv3}a

lvs -a $vg


#check active $vg $lv3

vgremove -ff $vg