]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/cli/osdmaptool/test-map-pgs.t
update sources to v12.1.1
[ceph.git] / ceph / src / test / cli / osdmaptool / test-map-pgs.t
CommitLineData
7c673cae
FG
1 $ NUM_OSDS=500
2 $ POOL_COUNT=1 # data + metadata + rbd
3 $ SIZE=3
4 $ PG_BITS=4
5#
6# create an osdmap with a few hundred devices and a realistic crushmap
7#
8 $ OSD_MAP="osdmap"
224ce89b 9 $ osdmaptool --osd_pool_default_size $SIZE --pg_bits $PG_BITS --createsimple $NUM_OSDS "$OSD_MAP" > /dev/null --with-default-pool
7c673cae
FG
10 osdmaptool: osdmap file 'osdmap'
11 $ CRUSH_MAP="crushmap"
12 $ CEPH_ARGS="--debug-crush 0" crushtool --outfn "$CRUSH_MAP" --build --num_osds $NUM_OSDS node straw 10 rack straw 10 root straw 0
13 $ osdmaptool --import-crush "$CRUSH_MAP" "$OSD_MAP" > /dev/null
14 osdmaptool: osdmap file 'osdmap'
15 $ OUT="$TESTDIR/out"
16#
17# --test-map-pgs
18#
19 $ osdmaptool --mark-up-in --test-map-pgs "$OSD_MAP" > "$OUT"
20 osdmaptool: osdmap file 'osdmap'
21 $ PG_NUM=$(($NUM_OSDS << $PG_BITS))
22 $ grep "pg_num $PG_NUM" "$OUT" || cat $OUT
224ce89b 23 pool 1 pg_num 8000
7c673cae
FG
24 $ TOTAL=$((POOL_COUNT * $PG_NUM))
25 $ grep -E "size $SIZE[[:space:]]$TOTAL" $OUT || cat $OUT
26 size 3\t8000 (esc)
27 $ STATS_CRUSH=$(grep '^ avg ' "$OUT")
28#
29# --test-map-pgs --test-random is expected to change nothing regarding the totals
30#
31 $ osdmaptool --mark-up-in --test-random --test-map-pgs "$OSD_MAP" > "$OUT"
32 osdmaptool: osdmap file 'osdmap'
33 $ PG_NUM=$(($NUM_OSDS << $PG_BITS))
34 $ grep "pg_num $PG_NUM" "$OUT" || cat $OUT
224ce89b 35 pool 1 pg_num 8000
7c673cae
FG
36 $ TOTAL=$((POOL_COUNT * $PG_NUM))
37 $ grep -E "size $SIZE[[:space:]]$TOTAL" $OUT || cat $OUT
38 size 3\t8000 (esc)
39 $ STATS_RANDOM=$(grep '^ avg ' "$OUT")
40# it is almost impossible to get the same stats with random and crush
41# if they are, it most probably means something went wrong somewhere
42 $ test "$STATS_CRUSH" != "$STATS_RANDOM"
43#
44# cleanup
45#
46 $ rm -f "$CRUSH_MAP" "$OSD_MAP" "$OUT"