2014-11-19 18:49:15 +01:00
#!/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,
2016-01-21 11:49:46 +01:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2014-11-19 18:49:15 +01:00
2015-10-27 15:10:06 +01:00
SKIP_WITH_LVMPOLLD = 1
2014-11-19 18:49:15 +01:00
2015-10-27 15:10:06 +01:00
. lib/inittest
2015-05-09 00:59:18 +01:00
2014-11-19 18:49:15 +01:00
aux have_cache 1 3 0 || skip
aux prepare_vg 3
2015-08-12 14:18:28 +02:00
aux lvmconf 'global/cache_disabled_features = [ "policy_smq" ]'
2014-11-19 18:49:15 +01:00
lvcreate --type cache-pool -an -v -L 2 -n cpool $vg
lvcreate -H -L 4 -n corigin --cachepool $vg /cpool
lvcreate -n noncache -l 1 $vg
2015-03-17 09:44:26 +01:00
# cannot change major minor for pools
not lvchange --yes -M y --minor 235 --major 253 $vg /cpool
not lvchange -M n $vg /cpool
2014-11-20 11:30:19 +01:00
not lvchange --cachepolicy mq $vg /noncache
not lvchange --cachesettings foo = bar $vg /noncache
2014-11-19 18:49:15 +01:00
2015-02-24 11:36:30 +01:00
lvchange --cachepolicy cleaner $vg /corigin
dmsetup status | grep $vg -corigin | grep 'cleaner'
2014-11-20 11:30:19 +01:00
lvchange --cachepolicy mq --cachesettings migration_threshold = 333 $vg /corigin
2015-02-24 11:36:30 +01:00
dmsetup status | grep $vg -corigin | not grep 'cleaner'
dmsetup status | grep $vg -corigin | grep 'mq'
2014-11-19 18:49:15 +01:00
dmsetup status | grep $vg -corigin | grep 'migration_threshold 333'
lvchange --refresh $vg /corigin
dmsetup status | grep $vg -corigin | grep 'migration_threshold 333'
lvchange -an $vg
lvchange -ay $vg
dmsetup status | grep $vg -corigin | grep 'migration_threshold 333'
2014-11-20 11:30:19 +01:00
lvchange --cachesettings 'migration_threshold = 233 sequential_threshold = 13' $vg /corigin
2014-11-19 18:49:15 +01:00
dmsetup status | grep $vg -corigin | grep 'migration_threshold 233'
dmsetup status | grep $vg -corigin | grep 'sequential_threshold 13'
2014-11-20 12:05:40 +01:00
lvchange --cachesettings 'migration_threshold = 17' $vg /corigin
dmsetup status | grep $vg -corigin | grep 'migration_threshold 17'
dmsetup status | grep $vg -corigin | grep 'sequential_threshold 13'
lvchange --cachesettings 'migration_threshold = default' $vg /corigin
dmsetup status | grep $vg -corigin | grep 'migration_threshold 2048'
dmsetup status | grep $vg -corigin | grep 'sequential_threshold 13'
lvchange --cachesettings 'migration_threshold = 233 sequential_threshold = 13 random_threshold = 1' $vg /corigin
lvchange --cachesettings 'random_threshold = default migration_threshold = default' $vg /corigin
dmsetup status | grep $vg -corigin | grep 'migration_threshold 2048'
dmsetup status | grep $vg -corigin | grep 'sequential_threshold 13'
dmsetup status | grep $vg -corigin | grep 'random_threshold 4'
2014-11-20 12:35:51 +01:00
lvchange --cachesettings migration_threshold = 233 --cachesettings sequential_threshold = 13 --cachesettings random_threshold = 1 $vg /corigin
dmsetup status | grep $vg -corigin | grep 'migration_threshold 233 '
dmsetup status | grep $vg -corigin | grep 'sequential_threshold 13 '
dmsetup status | grep $vg -corigin | grep 'random_threshold 1 '
lvchange --cachesettings random_threshold = default --cachesettings migration_threshold = default $vg /corigin
dmsetup status | grep $vg -corigin | grep 'migration_threshold 2048 '
dmsetup status | grep $vg -corigin | grep 'sequential_threshold 13 '
dmsetup status | grep $vg -corigin | grep 'random_threshold 4 '
2014-11-19 18:49:15 +01:00
vgremove -f $vg