summaryrefslogtreecommitdiff
path: root/test/shell/lvs-cache.sh
blob: 08e83bdad15b591a45227f8e78435cb10db7f72e (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
#!/bin/sh
# Copyright (C) 2014 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# Exercise creation of cache and cache pool volumes

# Full CLI uses  --type
# Shorthand CLI uses -H | --cache

. lib/inittest

aux have_cache 1 3 0 || skip
aux prepare_vg 5 8000

lvcreate --type cache-pool -L10 $vg/cpool
lvcreate --type cache -l 1 --cachepool $vg/cpool -n corigin $vg
lvs -o lv_name,cache_policy
lvs -o lv_name,cache_settings

lvremove -f $vg

lvcreate --type cache-pool -L10 $vg/cpool
lvcreate --type cache -l 1 --cachepool $vg/cpool -n corigin $vg --cachepolicy mq \
	 --cachesettings migration_threshold=233
lvs -o lv_name,cache_policy   | grep mq
lvs -o lv_name,cache_settings | grep migration_threshold=233

lvremove -f $vg

lvcreate --type cache-pool -L10 --cachepolicy mq --cachesettings migration_threshold=233 $vg/cpool
lvcreate --type cache -l 1 --cachepool $vg/cpool -n corigin $vg
lvs -o lv_name,cache_policy   | grep mq
lvs -o lv_name,cache_settings | grep migration_threshold=233

lvremove -f $vg

lvcreate --type cache-pool -L10 --cachepolicy mq --cachesettings migration_threshold=233 --cachesettings sequential_threshold=13 $vg/cpool
lvcreate --type cache -l 1 --cachepool $vg/cpool -n corigin $vg
lvs -o lv_name,cache_policy   | grep mq
lvs -a -o lv_name,cache_policy -S 'cache_policy=mq' | grep corigin
lvs -o lv_name,cache_settings | grep migration_threshold=233
lvs -o lv_name,cache_settings | grep sequential_threshold=13

lvcreate -n foo -l 1 $vg
lvs -S 'cache_policy=mq' | grep corigin
lvs -S 'cache_policy=mq' | not grep foo
lvs -S 'cache_policy=undefined' | not grep corigin
lvs -S 'cache_policy=undefined' | grep foo
lvs -o +cache_policy -S 'cache_policy=mq' | grep corigin
lvs -o +cache_policy -S 'cache_policy=mq' | not grep foo
lvs -o +cache_policy -S 'cache_policy=undefined' | not grep corigin
lvs -o +cache_policy -S 'cache_policy=undefined' | grep foo
lvs -o +cache_policy -O cache_policy
lvs -o +cache_settings -S 'cache_settings={migration_threshold=233}' | grep corigin
lvs -o +cache_settings -S 'cache_settings!={migration_threshold=233}' | grep foo
lvs -o +cache_policy -O cache_settings

lvremove -f $vg

lvcreate -n foo -l 1 $vg
lvs -a -S 'cache_policy=undefined' | grep foo