From: Loic Dachary Date: Sun, 12 Jan 2014 16:51:10 +0000 (+0100) Subject: crush: tests for crushtool --build X-Git-Tag: v0.77~26^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d3393e9d104d54a06a202d5c488244c0608c484f;p=ceph.git crush: tests for crushtool --build Signed-off-by: Loic Dachary --- diff --git a/src/test/cli/crushtool/build.t b/src/test/cli/crushtool/build.t new file mode 100644 index 00000000000..e7a56327118 --- /dev/null +++ b/src/test/cli/crushtool/build.t @@ -0,0 +1,114 @@ + $ map="$TESTDIR/build.crushmap" + +# +# display the crush tree by default +# + $ crushtool --outfn "$map" --build --num_osds 5 node straw 2 rack straw 1 root straw 0 + .* (re) + # id\tweight\ttype name\treweight (esc) + -7\t5\troot root (esc) + -4\t2\t\track rack0 (esc) + -1\t2\t\t\tnode node0 (esc) + 0\t1\t\t\t\tosd.0\t1\t (esc) + 1\t1\t\t\t\tosd.1\t1\t (esc) + -5\t2\t\track rack1 (esc) + -2\t2\t\t\tnode node1 (esc) + 2\t1\t\t\t\tosd.2\t1\t (esc) + 3\t1\t\t\t\tosd.3\t1\t (esc) + -6\t1\t\track rack2 (esc) + -3\t1\t\t\tnode node2 (esc) + 4\t1\t\t\t\tosd.4\t1\t (esc) + + +# +# silence all messages with --debug-crush 0 +# + $ CEPH_ARGS="--debug-crush 0" crushtool --outfn "$map" --build --num_osds 5 node straw 2 rack straw 1 root straw 0 + +# +# display a warning if there is more than one root +# + $ crushtool --outfn "$map" --build --num_osds 5 node straw 2 rack straw 1 + .* (re) + # id\tweight\ttype name\treweight (esc) + -6\t1\track rack2 (esc) + -3\t1\t\tnode node2 (esc) + 4\t1\t\t\tosd.4\t1\t (esc) + -5\t2\track rack1 (esc) + -2\t2\t\tnode node1 (esc) + 2\t1\t\t\tosd.2\t1\t (esc) + 3\t1\t\t\tosd.3\t1\t (esc) + -4\t2\track rack0 (esc) + -1\t2\t\tnode node0 (esc) + 0\t1\t\t\tosd.0\t1\t (esc) + 1\t1\t\t\tosd.1\t1\t (esc) + + .* The crush rulesets will use the root rack0 (re) + and ignore the others. + There are 3 roots, they can be + grouped into a single root by appending something like: + root straw 0 + +# +# crush rulesets are generated using the OSDMap helpers +# + $ CEPH_ARGS="--debug-crush 0" crushtool --outfn "$map" --build --num_osds 1 root straw 0 + $ crushtool -o "$map.txt" -d "$map" + $ cat "$map.txt" + # begin crush map + tunable choose_local_tries 0 + tunable choose_local_fallback_tries 0 + tunable choose_total_tries 50 + tunable chooseleaf_descend_once 1 + + # devices + device 0 device0 + + # types + type 0 device + type 1 root + + # buckets + root root { + \tid -1\t\t# do not change unnecessarily (esc) + \t# weight 1.000 (esc) + \talg straw (esc) + \thash 0\t# rjenkins1 (esc) + \titem device0 weight 1.000 (esc) + } + + # rules + rule replicated_ruleset { + \truleset 0 (esc) + \ttype replicated (esc) + \tmin_size 1 (esc) + \tmax_size 10 (esc) + \tstep take root (esc) + \tstep chooseleaf firstn 0 type root (esc) + \tstep emit (esc) + } + rule erasure_ruleset { + \truleset 1 (esc) + \ttype erasure (esc) + \tmin_size 3 (esc) + \tmax_size 20 (esc) + \tstep set_chooseleaf_tries 5 (esc) + \tstep take root (esc) + \tstep chooseleaf indep 0 type root (esc) + \tstep emit (esc) + } + + # end crush map + $ rm "$map" "$map.txt" + +# +# Wrong number of arguments +# + $ crushtool --outfn "$map" --debug-crush 0 --build --num_osds 5 node straw 0 + remaining args: [--debug-crush,0,node,straw,0] + layers must be specified with 3-tuples of (name, buckettype, size) + [1] + +# Local Variables: +# compile-command: "cd ../../.. ; make crushtool && test/run-cli-tests" +# End: