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