mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 2 years ago
Clone

Blame SOURCES/lvm2-2_03_12-tests-check-thin-pool-corner-case-allocs.patch

abb29f
 test/shell/lvcreate-thin-limits.sh | 30 ++++++++++++++++++++++++++----
abb29f
 1 file changed, 26 insertions(+), 4 deletions(-)
abb29f
abb29f
diff --git a/test/shell/lvcreate-thin-limits.sh b/test/shell/lvcreate-thin-limits.sh
abb29f
index 6a9c33d..5dcc160 100644
abb29f
--- a/test/shell/lvcreate-thin-limits.sh
abb29f
+++ b/test/shell/lvcreate-thin-limits.sh
abb29f
@@ -27,13 +27,35 @@ aux can_use_16T || skip
abb29f
 aux have_thin 1 0 0 || skip
abb29f
 which mkfs.ext4 || skip
abb29f
 
abb29f
-aux prepare_pvs 1 16777216
abb29f
+# 16T device
abb29f
+aux prepare_pvs 2 8388608
abb29f
 get_devs
abb29f
 
abb29f
-vgcreate $SHARED -s 4K "$vg" "${DEVICES[@]}"
abb29f
+# gives 16777215M device
abb29f
+vgcreate $SHARED -s 4M "$vg" "${DEVICES[@]}"
abb29f
 
abb29f
-not lvcreate -T -L15.995T --poolmetadatasize 5G $vg/pool
abb29f
+# For 1st. pass only single PV
abb29f
+lvcreate -l100%PV --name $lv1 $vg "$dev2"
abb29f
 
abb29f
-lvs -ao+seg_pe_ranges $vg
abb29f
+for i in 1 0
abb29f
+do
abb29f
+	SIZE=$(get vg_field "$vg" vg_free --units m)
abb29f
+	SIZE=${SIZE%%\.*}
abb29f
+
abb29f
+	# ~16T - 2 * 5G + something  -> should not fit
abb29f
+	not lvcreate -Zn -T -L$(( SIZE - 2 * 5 * 1024 + 1 )) --poolmetadatasize 5G $vg/pool
abb29f
+
abb29f
+	check vg_field "$vg" lv_count "$i"
abb29f
+
abb29f
+	# Should fit  data + metadata + pmspare
abb29f
+	lvcreate -Zn -T -L$(( SIZE - 2 * 5 * 1024 )) --poolmetadatasize 5G $vg/pool
abb29f
+
abb29f
+	check vg_field "$vg" vg_free "0"
abb29f
+
abb29f
+	lvs -ao+seg_pe_ranges $vg
abb29f
+
abb29f
+        # Remove everything for 2nd. pass
abb29f
+	lvremove -ff $vg
abb29f
+done
abb29f
 
abb29f
 vgremove -ff $vg