summaryrefslogtreecommitdiffstats
path: root/src/test/cli/osdmaptool/test-map-pgs.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/test/cli/osdmaptool/test-map-pgs.t
parentInitial commit. (diff)
downloadceph-upstream/18.2.2.tar.xz
ceph-upstream/18.2.2.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/test/cli/osdmaptool/test-map-pgs.t43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/cli/osdmaptool/test-map-pgs.t b/src/test/cli/osdmaptool/test-map-pgs.t
new file mode 100644
index 000000000..f9f7897b2
--- /dev/null
+++ b/src/test/cli/osdmaptool/test-map-pgs.t
@@ -0,0 +1,43 @@
+ $ NUM_OSDS=500
+ $ POOL_COUNT=1 # data + metadata + rbd
+ $ SIZE=3
+ $ PG_BITS=4
+#
+# create an osdmap with a few hundred devices and a realistic crushmap
+#
+ $ OSD_MAP="osdmap"
+ $ osdmaptool --osd_pool_default_size $SIZE --pg_bits $PG_BITS --createsimple $NUM_OSDS "$OSD_MAP" > /dev/null --with-default-pool
+ osdmaptool: osdmap file 'osdmap'
+ $ CRUSH_MAP="crushmap"
+ $ CEPH_ARGS="--debug-crush 0" crushtool --outfn "$CRUSH_MAP" --build --num_osds $NUM_OSDS node straw 10 rack straw 10 root straw 0
+ $ osdmaptool --import-crush "$CRUSH_MAP" "$OSD_MAP" > /dev/null
+ osdmaptool: osdmap file 'osdmap'
+ $ OUT="$TESTDIR/out"
+#
+# --test-map-pgs
+#
+ $ osdmaptool --mark-up-in --test-map-pgs "$OSD_MAP" > "$OUT"
+ osdmaptool: osdmap file 'osdmap'
+ $ PG_NUM=$(($NUM_OSDS << $PG_BITS))
+ $ grep "pg_num $PG_NUM" "$OUT" || cat $OUT
+ pool 1 pg_num 8000
+ $ TOTAL=$((POOL_COUNT * $PG_NUM))
+ $ grep -E "size $SIZE[[:space:]]$TOTAL" $OUT || cat $OUT
+ size 3\t8000 (esc)
+ $ STATS_CRUSH=$(grep '^ avg ' "$OUT")
+#
+# --test-map-pgs --test-random is expected to change nothing regarding the totals
+#
+ $ osdmaptool --mark-up-in --test-random --test-map-pgs "$OSD_MAP" > "$OUT"
+ osdmaptool: osdmap file 'osdmap'
+ $ PG_NUM=$(($NUM_OSDS << $PG_BITS))
+ $ grep "pg_num $PG_NUM" "$OUT" || cat $OUT
+ pool 1 pg_num 8000
+ $ TOTAL=$((POOL_COUNT * $PG_NUM))
+ $ grep -E "size $SIZE[[:space:]]$TOTAL" $OUT || cat $OUT
+ size 3\t8000 (esc)
+ $ STATS_RANDOM=$(grep '^ avg ' "$OUT")
+#
+# cleanup
+#
+ $ rm -f "$CRUSH_MAP" "$OSD_MAP" "$OUT"