~ubuntu-branches/debian/sid/lvm2/sid

« back to all changes in this revision

Viewing changes to test/shell/lvconvert-cache.sh

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2014-08-19 15:37:06 UTC
  • mfrom: (1.1.18)
  • Revision ID: package-import@ubuntu.com-20140819153706-i1gaio8lg534dara
Tags: 2.02.109-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
 
3
#
 
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.
 
7
#
 
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
 
11
 
 
12
. lib/inittest
 
13
 
 
14
aux have_cache 1 3 0 || skip
 
15
 
 
16
aux prepare_vg 5 80
 
17
 
 
18
# lvcreate origin, lvcreate cache-pool, and lvconvert to cache
 
19
lvcreate -L 2 -n $lv1 $vg
 
20
lvcreate -L 8 -n $lv2 $vg
 
21
lvcreate -L 8 -n $lv3 $vg
 
22
 
 
23
# undefined cachepool
 
24
invalid lvconvert --type cache --poolmetadata $vg/$lv2 $vg/$lv1
 
25
 
 
26
# cannot mix with thins
 
27
invalid lvconvert --type cache --poolmetadata $vg/$lv2 --thinpool $vg/$lv1
 
28
invalid lvconvert --type cache --thin --poolmetadata $vg/$lv2 $vg/$lv1
 
29
 
 
30
# undefined cached volume
 
31
invalid lvconvert --type cache --cachepool $vg/$lv1
 
32
invalid lvconvert --cache --cachepool $vg/$lv1
 
33
 
 
34
# single vg
 
35
invalid lvconvert --type cache --cachepool $vg/$lv1 --poolmetadata $vg1/$lv2 $vg/$lv3
 
36
invalid lvconvert --type cache --cachepool $vg/$lv1 --poolmetadata $lv2 $vg1/$lv3
 
37
invalid lvconvert --type cache --cachepool $vg1/$lv1 --poolmetadata $vg2/$lv2 $vg/$lv3
 
38
 
 
39
invalid lvconvert --cachepool $vg1/$lv1 --poolmetadata $vg2/$lv2
 
40
invalid lvconvert --type cache-pool --poolmetadata $vg2/$lv2 $vg1/$lv1
 
41
 
 
42
fail lvconvert --yes --type cache-pool --chunksize 16M --poolmetadata $lv2 $vg/$lv1
 
43
 
 
44
lvconvert --yes --type cache-pool --cachepool $vg/$lv1
 
45
 
 
46
#fail lvconvert --cachepool $vg/$lv1 --poolmetadata $vg/$lv2
 
47
#lvconvert --yes --type cache-pool --poolmetadata $vg/$lv2 $vg/$lv1
 
48
#lvconvert --yes --poolmetadata $vg/$lv2 --cachepool $vg/$lv1
 
49
 
 
50
lvremove -ff $vg
 
51
 
 
52
lvcreate -L 2 -n $lv1 $vg
 
53
lvcreate --type cache-pool -l 1 -n ${lv1}_cachepool $vg
 
54
 
 
55
lvconvert --cache --cachepool $vg/${lv1}_cachepool $vg/$lv1
 
56
dmsetup table ${vg}-$lv1 | grep cache  # ensure it is loaded in kernel
 
57
 
 
58
#lvconvert --cachepool $vg/${lv1}_cachepool $vg/$lv1
 
59
#lvconvert --cachepool $vg/${lv1}_cachepool --poolmetadatasize 20 "$dev3"
 
60
 
 
61
 
 
62
fail lvconvert --type cache --cachepool $vg/${lv1}_cachepool $vg/$lv1
 
63
lvremove -ff $vg
 
64
 
 
65
# Bug 1095843
 
66
# lvcreate RAID1 origin, lvcreate cache-pool, and lvconvert to cache
 
67
lvcreate --type raid1 -m 1 -l 2 -n $lv1 $vg
 
68
lvcreate --type cache-pool -l 1 -n ${lv1}_cachepool $vg
 
69
lvconvert --type cache --cachepool $vg/${lv1}_cachepool $vg/$lv1
 
70
lvs -a $vg/${lv1}_corig_rimage_0        # ensure images are properly renamed
 
71
dmsetup table ${vg}-$lv1 | grep cache   # ensure it is loaded in kernel
 
72
lvremove -ff $vg
 
73
 
 
74
# lvcreate RAID1 origin, lvcreate RAID1 cache-pool, and lvconvert to cache
 
75
lvcreate --type raid1 -m 1 -l 2 -n $lv1 $vg
 
76
lvcreate --type raid1 -m 1 -l 2 -n ${lv1}_cachepool $vg
 
77
lvconvert --type cache-pool --yes $vg/${lv1}_cachepool
 
78
#should lvs -a $vg/${lv1}_cdata_rimage_0  # ensure images are properly renamed
 
79
lvconvert --type cache --cachepool $vg/${lv1}_cachepool $vg/$lv1
 
80
lvs -a $vg/${lv1}_corig_rimage_0        # ensure images are properly renamed
 
81
dmsetup table ${vg}-$lv1 | grep cache   # ensure it is loaded in kernel
 
82
lvremove -ff $vg
 
83
 
 
84
vgremove -f $vg