mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
b493811968
Introduce 'hard limit' for max number of cache chunks. When cache target operates with too many chunks (>10e6). When user is aware of related possible troubles he may increase the limit in lvm.conf. Also verbosely inform user about possible solution. Code works for both lvcreate and lvconvert. Lvconvert fully supports change of chunk_size when caching LV (and validates for compatible settings).
54 lines
1.5 KiB
Bash
54 lines
1.5 KiB
Bash
#!/bin/sh
|
|
# Copyright (C) 2016 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
# Exercise number of cache chunks in cache pool
|
|
|
|
SKIP_WITH_LVMLOCKD=1
|
|
SKIP_WITH_LVMPOLLD=1
|
|
|
|
. lib/inittest
|
|
|
|
aux have_cache 1 3 0 || skip
|
|
|
|
aux prepare_vg 2 1000000
|
|
|
|
# Really large cache pool data LV
|
|
lvcreate -L1T -n cpool $vg
|
|
|
|
# Works and pick higher chunks size then default
|
|
lvconvert -y --type cache-pool $vg/cpool
|
|
|
|
# Check chunk size in sectors is more then 512K
|
|
test $(get lv_field $vg/cpool chunk_size --units s --nosuffix) -gt 1000
|
|
|
|
lvcreate -L1M -n $lv1 $vg
|
|
|
|
# Not let pass small chunks when caching origin
|
|
fail lvconvert -H --chunksize 128K --cachepool $vg/cpool $vg/$lv1
|
|
|
|
# Though 2M is valid
|
|
lvconvert -y -H --chunksize 2M --cachepool $vg/cpool $vg/$lv1
|
|
|
|
lvremove -f $vg
|
|
|
|
###
|
|
|
|
# Really large cache pool data LV
|
|
lvcreate -L1T -n cpool $vg
|
|
# Not allowed to create more then 10e6 chunks
|
|
fail lvconvert -y --type cache-pool --chunksize 128K $vg/cpool
|
|
|
|
# Let operation pass when max_chunk limit is raised
|
|
lvconvert -y --type cache-pool --chunksize 128K $vg/cpool \
|
|
--config 'allocation/cache_pool_max_chunks=10000000'
|
|
|
|
vgremove -f $vg
|