Blame SOURCES/lvm2-2_03_12-tests-check-16G-thin-pool-metadata-size.patch

31f061
 test/shell/thin-16g.sh | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++
31f061
 1 file changed, 88 insertions(+)
31f061
 create mode 100644 test/shell/thin-16g.sh
31f061
31f061
diff --git a/test/shell/thin-16g.sh b/test/shell/thin-16g.sh
31f061
new file mode 100644
31f061
index 0000000..ee7e22e
31f061
--- /dev/null
31f061
+++ b/test/shell/thin-16g.sh
31f061
@@ -0,0 +1,88 @@
31f061
+#!/usr/bin/env bash
31f061
+
31f061
+# Copyright (C) 2021 Red Hat, Inc. All rights reserved.
31f061
+#
31f061
+# This copyrighted material is made available to anyone wishing to use,
31f061
+# modify, copy, or redistribute it subject to the terms and conditions
31f061
+# of the GNU General Public License v.2.
31f061
+#
31f061
+# You should have received a copy of the GNU General Public License
31f061
+# along with this program; if not, write to the Free Software Foundation,
31f061
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
31f061
+
31f061
+# Test usability of 16g thin pool metadata  LV
31f061
+
31f061
+
31f061
+SKIP_WITH_LVMPOLLD=1
31f061
+
31f061
+. lib/inittest
31f061
+
31f061
+aux have_thin 1 0 0 || skip
31f061
+
31f061
+aux prepare_vg 1 50000
31f061
+
31f061
+lvcreate -T -L10 --poolmetadatasize 16g $vg/pool
31f061
+check lv_field $vg/pool_tmeta size "<15.88g"
31f061
+lvremove -f $vg
31f061
+
31f061
+# Cropped way
31f061
+lvcreate -T -L10 --poolmetadatasize 16g --config 'allocation/thin_pool_crop_metadata=1' $vg/pool
31f061
+check lv_field $vg/pool_tmeta size "15.81g"
31f061
+lvremove -f $vg
31f061
+
31f061
+lvcreate -L16G -n meta $vg
31f061
+lvcreate -L10  -n pool $vg
31f061
+lvconvert --yes --thinpool $vg/pool --poolmetadata meta
31f061
+# Uncropped size 33554432 sectors - 16GiB
31f061
+dmsetup table ${vg}-pool_tmeta | grep 33554432
31f061
+lvremove -f $vg
31f061
+
31f061
+# Uses 20G metadata volume, but crops the size in DM table
31f061
+lvcreate -L20G -n meta $vg
31f061
+lvcreate -L10  -n pool $vg
31f061
+lvconvert --yes --thinpool $vg/pool --poolmetadata meta --config 'allocation/thin_pool_crop_metadata=1'
31f061
+check lv_field $vg/lvol0_pmspare size "16.00g"
31f061
+# Size should be cropped to 33161216 sectors  ~15.81GiB
31f061
+dmsetup table ${vg}-pool_tmeta | grep 33161216
31f061
+
31f061
+# Also size remains unchanged with activation has no cropping,
31f061
+# but metadata have no CROP_METADATA flag set
31f061
+lvchange -an $vg
31f061
+lvchange -ay $vg
31f061
+# Size still stays cropped to 33161216 sectors  ~15.81GiB
31f061
+dmsetup table ${vg}-pool_tmeta | grep 33161216
31f061
+lvremove -f $vg
31f061
+
31f061
+# Minimal size is 2M
31f061
+lvcreate -L1M -n meta $vg
31f061
+lvcreate -L10 -n pool $vg
31f061
+not lvconvert --yes --thinpool $vg/pool --poolmetadata meta
31f061
+lvremove -f $vg
31f061
+
31f061
+# Uses 20G metadata volume, but crops the size in DM table
31f061
+lvcreate -L1 --poolmetadatasize 10G -T $vg/pool
31f061
+lvresize -L+10G $vg/pool_tmeta --config 'allocation/thin_pool_crop_metadata=1'
31f061
+check lv_field $vg/lvol0_pmspare size "15.81g"
31f061
+# Size should be cropped to 33161216 sectors  ~15.81GiB
31f061
+dmsetup table ${vg}-pool_tmeta | grep 33161216
31f061
+
31f061
+# Without cropping we can grop to ~15.88GiB
31f061
+lvresize -L+10G $vg/pool_tmeta
31f061
+check lv_field $vg/lvol0_pmspare size "<15.88g"
31f061
+lvremove -f $vg
31f061
+
31f061
+# User has already 'bigger' metadata and wants them uncropped
31f061
+lvcreate -L16G -n meta $vg
31f061
+lvcreate -L10  -n pool $vg
31f061
+lvconvert --yes --thinpool $vg/pool --poolmetadata meta --config 'allocation/thin_pool_crop_metadata=1'
31f061
+
31f061
+# No change with cropping
31f061
+lvresize -l+1 $vg/pool_tmeta --config 'allocation/thin_pool_crop_metadata=1'
31f061
+dmsetup table ${vg}-pool_tmeta | grep 33161216
31f061
+
31f061
+# Resizes to 'uncropped' size 16GiB with ANY size
31f061
+lvresize -l+1 $vg/pool_tmeta
31f061
+dmsetup table ${vg}-pool_tmeta | grep 33554432
31f061
+check lv_field $vg/pool_tmeta size "16.00g"
31f061
+
31f061
+vgremove -ff $vg