~ubuntu-branches/ubuntu/saucy/lvm2/saucy

« back to all changes in this revision

Viewing changes to test/shell/lvcreate-thin.sh

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2012-08-14 14:35:57 UTC
  • mfrom: (3.1.25 sid)
  • Revision ID: package-import@ubuntu.com-20120814143557-93aill2tp3kf3o30
Tags: 2.02.95-4ubuntu1
* Merge from Debian unstable, remaining changes:
  - debian/patches/avoid-dev-block.patch: Prefer any other device name over
    names in /dev/block/ since lvm.conf won't handle this.
  - debian/rules:
    - copy .po file to .pot file for Rosetta (Ubuntu specific).
  - debian/{dmsetup,lvm2}-udeb.install:
    - install initramfs and udev hooks in udebs (Debian bug 504341).
  - auto-start VGs as their PVs are discovered (Ubuntu specific):
    - add debian/tree/lvm2/lib/udev/rules.d/85-lvm2.rules: use watershed plus
      the sledgehammer of vgscan/vgchange to turn on VGs as they come online.
    - debian/tree/lvm2/usr/share/initramfs-tools/scripts/hooks/lvm2:
      - add 85-lvm2.rules to the list of udev rules to copy.
      - depend on udev.
    - debian/control:
      - add versioned Depend on watershed in lvm2 for udev rules.
      - add Depends on watershed-udeb in lvm2-udeb for udev rules.
      - add versioned Depend/Breaks on udev in dmsetup for udev rules.
      - add Depend on initramfs-tools in dmsetup so system is not potentially
        rendered unbootable by out-of-order dpkg configuration.
    - debian/rules:
      - do not install local-top scripts since Ubuntu mounts root using udev.
      - do not install init scripts for lvm2, since udev starts LVM.
    - debian/lvm2.postinst: handle missing lvm2 init script.
    - debian/tree/dmsetup/lib/udev/rules.d/60-persistent-storage-dm.rules:
      watch dm devices for changes with inotify
  - add mountroot failure hooks to help fix bad boots (Debian bug 468115):
    - debian/tree/lvm2/usr/share/initramfs-tools/scripts/init-premount/lvm2
  - remaining changes to upstream event manager packages (Debian bug 514706):
    - debian/rules:
      - enable dmeventd during configure.
    - debian/dmeventd.{8,manpages}: install dmeventd files.
  - rename debian/clvm.defaults to debian/clvm.default so it is installed
    correctly.
  - debian/control: add dmsetup-udeb to libdevmapper1.02.1-udeb recommends.
  - debian/rules: make sure dmsetup and lvm2 initramfs-tools scripts are
    executable.  When the Ubuntu-specific ones are added with a patch,
    they may lose their executable bit.
  - Add and install clvmd resource agent
  - Add dependency on libudev-dev to libdevmapper-dev so that the .pc file
    works.
  - debian/{clvmd.ra,clvm.init}:
    - create /run/lvm if it doesn't exist.
  - debian/clvm.init:
    - exit 3 if not running on status action.
  - Call dh_installman so that our dmeventd manpage actually gets installed
  - Install the missing fsadm manpage.

 * libdevmapper-dev:
  - move .so symlinks and pkgconfig files to multiarched locations.
  - mark libdevmapper-dev M-A: same

 * libdevmapper-event1.02.1:
  - Add Breaks: dmeventd (<< 2.02.95-4ubuntu1) due to debian symbol rename

 * debian/lvm2.{preinst,postinst,postrm}:
  - Implement removal of obsolete /etc/init.d/lvm2 conffile, which
    should not have been re-introduced in Quantal.

 * Dropped Changes, included in Debian:
  - Mostly included packages for upstream event manager (Debian bug 514706).
  - debian/patches/rules-subdir.patch: removed as reordering will cause
    build failure with dmeventd.
  - debian/patches/libdm-event-static.patch: removed as other static libs
    aren't being built anymore either.
  - Update symbols for libdevmapper-event.
  - Update libdevmapper-event, dmeventd descriptions to match Debian
    boilerplate.

 * Disappeared Changes:
  - Don't install documentation in udebs. No diff found, but no docs are
    installed into udebs either.

 * Resurected Changes:
  - corrected dropping the wrong init script. Now clvm.init is shipped
    and lvm2.init is dropped in favor of udev rules as per original
    intention (LP: #1037033).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved.
 
4
#
 
5
# This copyrighted material is made available to anyone wishing to use,
 
6
# modify, copy, or redistribute it subject to the terms and conditions
 
7
# of the GNU General Public License v.2.
 
8
#
 
9
# You should have received a copy of the GNU General Public License
 
10
# along with this program; if not, write to the Free Software Foundation,
 
11
# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
12
 
 
13
# test currently needs to drop
 
14
# 'return NULL' in _lv_create_an_lv after log_error("Can't create %s without using "
 
15
 
 
16
. lib/test
 
17
 
 
18
check_lv_exists_()
 
19
{
 
20
        for d in $*; do
 
21
                check lv_exists $vg $d
 
22
        done
 
23
}
 
24
 
 
25
check_lv_field_modules_()
 
26
{
 
27
        mod=$1
 
28
        shift
 
29
 
 
30
        for d in $*; do
 
31
                check lv_field $vg/$d modules $mod
 
32
        done
 
33
}
 
34
 
 
35
 
 
36
#
 
37
# Main
 
38
#
 
39
aux target_at_least dm-thin-pool 1 0 0 || skip
 
40
 
 
41
aux prepare_pvs 2 64
 
42
 
 
43
# disable thin_check if not present in system
 
44
which thin_check || aux lvmconf 'global/thin_check_executable = ""'
 
45
 
 
46
clustered=
 
47
test -e LOCAL_CLVMD && clustered="--clustered y"
 
48
 
 
49
vgcreate $clustered $vg -s 64K $(cat DEVICES)
 
50
 
 
51
# Create named pool only
 
52
lvcreate -l1 -T $vg/pool1
 
53
lvcreate -l1 -T --thinpool $vg/pool2
 
54
lvcreate -l1 -T --thinpool pool3 $vg
 
55
lvcreate -l1 --type thin $vg/pool4
 
56
lvcreate -l1 --type thin --thinpool $vg/pool5
 
57
lvcreate -l1 --type thin --thinpool pool6 $vg
 
58
lvcreate -l1 --type thin-pool $vg/pool7
 
59
lvcreate -l1 --type thin-pool --thinpool $vg/pool8
 
60
lvcreate -l1 --type thin-pool --thinpool pool9 $vg
 
61
 
 
62
lvremove -ff $vg/pool1 $vg/pool2 $vg/pool3 $vg/pool4 $vg/pool5 $vg/pool6 $vg/pool7 $vg/pool8 $vg/pool9
 
63
check vg_field $vg lv_count 0
 
64
 
 
65
 
 
66
# Create default pool name
 
67
lvcreate -l1 -T $vg
 
68
lvcreate -l1 --type thin $vg
 
69
lvcreate -l1 --type thin-pool $vg
 
70
 
 
71
lvremove -ff $vg/lvol0 $vg/lvol1 $vg/lvol2
 
72
check vg_field $vg lv_count 0
 
73
 
 
74
 
 
75
# Create default pool and default thin LV
 
76
lvcreate -l1 -V2G -T $vg
 
77
lvcreate -l1 -V2G --type thin $vg
 
78
 
 
79
lvremove -ff $vg
 
80
 
 
81
 
 
82
# Create named pool and default thin LV
 
83
lvcreate -L4M -V2G -T $vg/pool1
 
84
lvcreate -L4M -V2G -T --thinpool $vg/pool2
 
85
lvcreate -L4M -V2G -T --thinpool pool3 $vg
 
86
lvcreate -L4M -V2G --type thin $vg/pool4
 
87
lvcreate -L4M -V2G --type thin --thinpool $vg/pool5
 
88
lvcreate -L4M -V2G --type thin --thinpool pool6 $vg
 
89
 
 
90
check_lv_exists_ lvol0 lvol1 lvol2 lvol3 lvol4 lvol5
 
91
lvremove -ff $vg
 
92
 
 
93
 
 
94
# Create named pool and named thin LV
 
95
lvcreate -L4M -V2G -T $vg/pool1 --name lv1
 
96
lvcreate -L4M -V2G -T $vg/pool2 --name $vg/lv2
 
97
lvcreate -L4M -V2G -T --thinpool $vg/pool3 --name lv3
 
98
lvcreate -L4M -V2G -T --thinpool $vg/pool4 --name $vg/lv4
 
99
lvcreate -L4M -V2G -T --thinpool pool5 --name lv5 $vg
 
100
lvcreate -L4M -V2G -T --thinpool pool6 --name $vg/lv6 $vg
 
101
 
 
102
check_lv_exists_ lv1 lv2 lv3 lv4 lv5 lv6
 
103
lvremove -ff $vg
 
104
 
 
105
 
 
106
lvcreate -L4M -V2G --type thin $vg/pool1 --name lv1
 
107
lvcreate -L4M -V2G --type thin $vg/pool2 --name $vg/lv2
 
108
lvcreate -L4M -V2G --type thin --thinpool $vg/pool3 --name lv3
 
109
lvcreate -L4M -V2G --type thin --thinpool $vg/pool4 --name $vg/lv4
 
110
lvcreate -L4M -V2G --type thin --thinpool pool5 --name lv5 $vg
 
111
lvcreate -L4M -V2G --type thin --thinpool pool6 --name $vg/lv6 $vg
 
112
 
 
113
check_lv_exists_ lv1 lv2 lv3 lv4 lv5 lv6
 
114
lvremove -ff $vg
 
115
 
 
116
 
 
117
# Create default thin LV in existing pool
 
118
lvcreate -L4M -T $vg/pool
 
119
lvcreate -V2G -T $vg/pool
 
120
lvcreate -V2G -T --thinpool $vg/pool
 
121
lvcreate -V2G -T --thinpool pool $vg
 
122
lvcreate -V2G --type thin $vg/pool
 
123
lvcreate -V2G --type thin --thinpool $vg/pool
 
124
lvcreate -V2G --type thin --thinpool pool $vg
 
125
 
 
126
check_lv_exists_ lvol0 lvol1 lvol2 lvol3 lvol4 lvol5
 
127
 
 
128
 
 
129
# Create named thin LV in existing pool
 
130
lvcreate -V2G -T $vg/pool --name lv1
 
131
lvcreate -V2G -T $vg/pool --name $vg/lv2
 
132
lvcreate -V2G -T --thinpool $vg/pool --name lv3
 
133
lvcreate -V2G -T --thinpool $vg/pool --name $vg/lv4
 
134
lvcreate -V2G -T --thinpool pool --name lv5 $vg
 
135
lvcreate -V2G -T --thinpool pool --name $vg/lv6 $vg
 
136
lvcreate -V2G --type thin $vg/pool --name lv7
 
137
lvcreate -V2G --type thin $vg/pool --name $vg/lv8
 
138
lvcreate -V2G --type thin --thinpool $vg/pool --name lv9
 
139
lvcreate -V2G --type thin --thinpool $vg/pool --name $vg/lv10
 
140
lvcreate -V2G --type thin --thinpool pool --name lv11 $vg
 
141
lvcreate -V2G --type thin --thinpool pool --name $vg/lv12 $vg
 
142
 
 
143
check_lv_exists_ lv1 lv2 lv3 lv4 lv5 lv6 lv7 lv8 lv9 lv10 lv11 lv12
 
144
check vg_field $vg lv_count 19
 
145
 
 
146
lvremove -ff $vg
 
147
check vg_field $vg lv_count 0
 
148
 
 
149
# Create thin snapshot of thinLV
 
150
lvcreate -L10M -V10M -T $vg/pool --name lv1
 
151
mkfs.ext4 $DM_DEV_DIR/$vg/lv1
 
152
lvcreate -s $vg/lv1
 
153
fsck -p $DM_DEV_DIR/$vg/lvol0
 
154
lvcreate -s $vg/lv1 --name lv2
 
155
lvcreate -s $vg/lv1 --name $vg/lv3
 
156
lvcreate --type snapshot $vg/lv1
 
157
lvcreate --type snapshot $vg/lv1 --name lv4
 
158
lvcreate --type snapshot $vg/lv1 --name $vg/lv5
 
159
 
 
160
check_lv_field_modules_ thin-pool lv1 lvol0 lv2 lv3 lvol1 lv4 lv5
 
161
check vg_field $vg lv_count 8
 
162
lvremove -ff $vg
 
163
 
 
164
 
 
165
# Normal Snapshots of thinLV
 
166
lvcreate -L4M -V2G -T $vg/pool --name lv1
 
167
lvcreate -s $vg/lv1 -l1
 
168
lvcreate -s $vg/lv1 -l1 --name lv2
 
169
lvcreate -s $vg/lv1 -l1 --name $vg/lv3
 
170
lvcreate -s lv1 -L4M --name $vg/lv4
 
171
 
 
172
check_lv_field_modules_ snapshot lvol0 lv2 lv3 lv4
 
173
check vg_field $vg lv_count 6
 
174
 
 
175
lvremove -ff $vg
 
176
check vg_field $vg lv_count 0
 
177
 
 
178
 
 
179
# Fail cases
 
180
# Too small pool size (1 extent 64KB) for given chunk size
 
181
not lvcreate --chunksize 256 -l1 -T $vg/pool1
 
182
# Too small chunk size (min is 64KB -  128 sectors)
 
183
not lvcreate --chunksize 32 -l1 -T $vg/pool1
 
184
 
 
185
lvcreate -L4M -V2G --name lv1 -T $vg/pool1
 
186
# Origin name is not accepted
 
187
not lvcreate -s $vg/lv1 -L4M -V2G --name $vg/lv4
 
188
vgremove -ff $vg
 
189
 
 
190
 
 
191
# Test --poolmetadatasize
 
192
# allocating large devices for testing
 
193
aux teardown_devs
 
194
aux prepare_pvs 7 16500
 
195
vgcreate $clustered $vg -s 64K $(cat DEVICES)
 
196
 
 
197
lvcreate -L4M --chunksize 128 -T $vg/pool
 
198
lvcreate -L4M --chunksize 128 --poolmetadatasize 0 -T $vg/pool1 2>out
 
199
grep "WARNING: Minimum" out
 
200
# FIXME: metadata allocation fails, if PV doesn't have at least 16GB
 
201
# i.e. pool metadata device cannot be multisegment
 
202
lvcreate -L4M --chunksize 128 --poolmetadatasize 17G -T $vg/pool2 2>out
 
203
grep "WARNING: Maximum" out
 
204
check lv_field $vg/pool_tmeta size  "2.00m"
 
205
check lv_field $vg/pool1_tmeta size "2.00m"
 
206
check lv_field $vg/pool2_tmeta size "16.00g"
 
207
lvremove -ff $vg
 
208
 
 
209
# check automatic calculation of poolmetadatasize
 
210
lvcreate -L10G --chunksize 128 -T $vg/pool
 
211
lvcreate -L10G --chunksize 256 -T $vg/pool1
 
212
lvcreate -L60G --chunksize 1024 -T $vg/pool2
 
213
check lv_field $vg/pool_tmeta size  "5.00m"
 
214
check lv_field $vg/pool1_tmeta size "2.50m"
 
215
check lv_field $vg/pool2_tmeta size "3.75m"
 
216
vgremove -ff $vg