[lvm-devel] master - tests: update cache test

Zdenek Kabelac zkabelac at sourceware.org
Mon Jan 21 11:55:56 UTC 2019


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2cac4bfc150ea1e5459580e3bac4907446ea7f3a
Commit:        2cac4bfc150ea1e5459580e3bac4907446ea7f3a
Parent:        01cbdc4e673989c4d432e6bea8cde1f8f9e8cda5
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Sun Jan 20 12:11:04 2019 +0100
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Mon Jan 21 12:53:16 2019 +0100

tests: update cache test

Since migration_threshold is now protected to not be smaller
then 8*chunk_size - update tests to count with this modification.
---
 test/shell/lvchange-cache.sh |   22 +++++++++++-----------
 test/shell/lvcreate-cache.sh |   15 +++++++++------
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/test/shell/lvchange-cache.sh b/test/shell/lvchange-cache.sh
index 7e95f61..ab7c8b0 100644
--- a/test/shell/lvchange-cache.sh
+++ b/test/shell/lvchange-cache.sh
@@ -38,27 +38,27 @@ check lv_field  $vg/corigin kernel_cache_policy "cleaner"
 # device-mapper: space map common: index_check failed: blocknr 17179869216 != wanted 11
 if aux have_cache 1 5 0 ; then
 
-lvchange --cachepolicy mq --cachesettings migration_threshold=333 $vg/corigin
+lvchange --cachepolicy mq --cachesettings migration_threshold=1333 $vg/corigin
 
 # TODO once mq->smq happens we will get here some 0 for mq settings
 check lv_field $vg/corigin kernel_cache_policy "mq"
-get lv_field $vg/corigin kernel_cache_settings | grep 'migration_threshold=333'
+get lv_field $vg/corigin kernel_cache_settings | grep 'migration_threshold=1333'
 
 lvchange --refresh $vg/corigin
-get lv_field $vg/corigin kernel_cache_settings | grep 'migration_threshold=333'
+get lv_field $vg/corigin kernel_cache_settings | grep 'migration_threshold=1333'
 lvchange -an $vg
 lvchange -ay $vg
-get lv_field $vg/corigin kernel_cache_settings | grep 'migration_threshold=333'
+get lv_field $vg/corigin kernel_cache_settings | grep 'migration_threshold=1333'
 
-lvchange --cachesettings 'migration_threshold = 233 sequential_threshold = 13' $vg/corigin
+lvchange --cachesettings 'migration_threshold = 1233 sequential_threshold = 13' $vg/corigin
 get lv_field $vg/corigin kernel_cache_settings | tee out
-grep 'migration_threshold=233' out
+grep 'migration_threshold=1233' out
 
 if grep 'sequential_threshold=13' out ; then
 
-lvchange --cachesettings 'migration_threshold = 17' $vg/corigin
+lvchange --cachesettings 'migration_threshold = 1117' $vg/corigin
 get lv_field $vg/corigin kernel_cache_settings | tee out
-grep 'migration_threshold=17' out
+grep 'migration_threshold=1117' out
 grep 'sequential_threshold=13' out
 
 lvchange --cachesettings 'migration_threshold = default' $vg/corigin
@@ -66,16 +66,16 @@ get lv_field $vg/corigin kernel_cache_settings | tee out
 grep 'migration_threshold=2048' out
 grep 'sequential_threshold=13' out
 
-lvchange --cachesettings 'migration_threshold = 233 sequential_threshold = 13 random_threshold = 1' $vg/corigin
+lvchange --cachesettings 'migration_threshold = 1233 sequential_threshold = 13 random_threshold = 1' $vg/corigin
 lvchange --cachesettings 'random_threshold = default migration_threshold = default' $vg/corigin
 get lv_field $vg/corigin kernel_cache_settings | tee out
 grep 'migration_threshold=2048' out
 grep 'sequential_threshold=13' out
 grep 'random_threshold=4' out
 
-lvchange --cachesettings migration_threshold=233 --cachesettings sequential_threshold=13 --cachesettings random_threshold=1 $vg/corigin
+lvchange --cachesettings migration_threshold=1233 --cachesettings sequential_threshold=13 --cachesettings random_threshold=1 $vg/corigin
 get lv_field $vg/corigin kernel_cache_settings | tee out
-grep 'migration_threshold=233' out
+grep 'migration_threshold=1233' out
 grep 'sequential_threshold=13' out
 grep 'random_threshold=1' out
 
diff --git a/test/shell/lvcreate-cache.sh b/test/shell/lvcreate-cache.sh
index 010c06f..0663033 100644
--- a/test/shell/lvcreate-cache.sh
+++ b/test/shell/lvcreate-cache.sh
@@ -256,20 +256,23 @@ lvdisplay --maps $vg
 
 lvremove -f $vg
 
+# migration_threshold is protected to not be smaller then  8*chunk_size
+# so even when user sets migration threshold to lower value,
+# activation will ensure the minimal size is preserved
 lvcreate --type cache-pool -L10 $vg/cpool
-lvcreate --type cache -l 1 --cachepool $vg/cpool -n corigin $vg --cachesettings migration_threshold=233
+lvcreate --type cache -l 1 --cachepool $vg/cpool -c 64k -n corigin $vg --cachesettings migration_threshold=233
 dmsetup status | grep $vg
-dmsetup status | grep $vg-corigin | grep 'migration_threshold 233'
+dmsetup status | grep $vg-corigin | grep 'migration_threshold 1024'
 lvchange -an $vg
 lvchange -ay $vg
-dmsetup status | grep $vg-corigin | grep 'migration_threshold 233'
+dmsetup status | grep $vg-corigin | grep 'migration_threshold 1024'
 
 lvremove -f $vg
 
-lvcreate --type cache-pool -L10 --cachepolicy mq --cachesettings migration_threshold=233 $vg/cpool
+lvcreate --type cache-pool -L10 --cachepolicy mq --cachesettings migration_threshold=1233 $vg/cpool
 lvcreate --type cache -l 1 --cachepool $vg/cpool -n corigin $vg
 dmsetup status | grep $vg
-dmsetup status | grep $vg-corigin | grep 'migration_threshold 233'
+dmsetup status | grep $vg-corigin | grep 'migration_threshold 1233'
 
 lvremove -f $vg
 
@@ -281,7 +284,7 @@ lvremove -f $vg
 # Creation of read-only cache pool is not supported
 invalid lvcreate -pr --type cache-pool -l1 -n $vg/cpool
 
-# Atempt to use bigger chunk size then cache pool data size
+# Attempt to use bigger chunk size then cache pool data size
 fail lvcreate -l 1 --type cache-pool --chunksize 16M $vg 2>out
 grep "chunk size" out
 




More information about the lvm-devel mailing list