1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 03:27:58 +03:00

tests: check for metadata test working properly

Add more tests to check they guard minimum free space in metadata
for new thin volume creation.
This commit is contained in:
Zdenek Kabelac 2016-09-16 21:55:04 +02:00
parent 561f773bb4
commit 1a30adc062

View File

@ -1,5 +1,5 @@
#!/bin/sh
# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
# Copyright (C) 2014-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
@ -60,13 +60,73 @@ aux have_thin 1 10 0 || skip
aux prepare_dmeventd
aux lvmconf "activation/thin_pool_autoextend_percent = 10" \
"activation/thin_pool_autoextend_threshold = 70"
aux prepare_pvs 3 256
vgcreate -s 1M $vg $(cat DEVICES)
# Testing dmeventd does NOT autoresize when default threshold 100% is left
lvcreate -L200M -V50M -n thin -T $vg/pool
lvcreate -V2M -n thin2 $vg/pool
lvcreate -L2M -n $lv1 $vg
lvcreate -L32M -n $lv2 $vg
lvcreate -L32M -n $lv3 $vg
lvchange -an $vg/thin $vg/thin2 $vg/pool
# Filling 2M metadata volume
# (Test for less then 25% free space in metadata)
fake_metadata_ 400 2 >data
"$LVM_TEST_THIN_RESTORE_CMD" -i data -o "$DM_DEV_DIR/mapper/$vg-$lv1"
# Swap volume with restored fake metadata
lvconvert -y --chunksize 64k --thinpool $vg/pool --poolmetadata $vg/$lv1
# Not alllowed when thin-pool metadata free space is <75% for 2M meta
fail lvcreate -V20 $vg/pool
lvchange -an $vg/pool
# Consume more then (100% - 4MiB) out of 32MiB metadata volume (>87.5%)
# (Test for less then 4MiB free space in metadata, which is less then 25%)
fake_metadata_ 7400 2 >data
"$LVM_TEST_THIN_RESTORE_CMD" -i data -o "$DM_DEV_DIR/mapper/$vg-$lv2"
# Swap volume with restored fake metadata
lvconvert -y --chunksize 64k --thinpool $vg/pool --poolmetadata $vg/$lv2
lvchange -ay $vg/pool
# Check generated metadata consume more then 88%
test "$(meta_percent_)" -gt "88"
lvchange -an $vg/pool
# Creation of thin LV is prohibited when metadata are above this value
fail lvcreate -V20 $vg/pool 2>&1 | tee out
grep "free space" out
lvs -a $vg
# Check that even with 99% threshold policy - metadata will go below 88%
lvextend --use-policies --config "\
activation/thin_pool_autoextend_percent=1 \
activation/thin_pool_autoextend_threshold=99" $vg/pool
test "$(meta_percent_)" -lt "88"
# After such operatoin creation of thin LV has to pass
lvcreate -V20 $vg/pool
# Let's revalidate pool metadata (thin_check upon deactivation/activation)
lvchange -an $vg
lvchange -ay $vg/pool
lvremove -f $vg
#########################################################
# Test automatic resize with help of dmeventd DOES work #
#########################################################
aux lvmconf "activation/thin_pool_autoextend_percent = 10" \
"activation/thin_pool_autoextend_threshold = 70"
# Testing dmeventd autoresize
lvcreate -L200M -V500M -n thin -T $vg/pool 2>&1 | tee out
not grep "WARNING: Sum" out