From: Sage Weil Date: Tue, 12 Mar 2013 00:38:00 +0000 (-0700) Subject: crush: add test for reweighting multiple items in the tree X-Git-Tag: v0.60~31^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f8bc21a8bafd699c0a8480f1906eeebf2f7b0fdc;p=ceph.git crush: add test for reweighting multiple items in the tree Signed-off-by: Sage Weil --- diff --git a/src/test/cli/crushtool/reweight_multiple.t b/src/test/cli/crushtool/reweight_multiple.t new file mode 100644 index 000000000000..7eff6733c491 --- /dev/null +++ b/src/test/cli/crushtool/reweight_multiple.t @@ -0,0 +1,5 @@ + $ crushtool -c "$TESTDIR/simple.template.multitree" -o mt + $ crushtool -i mt --reweight-item osd1 2.5 -o mt + crushtool reweighting item osd1 to 2.5 + $ crushtool -d mt -o mt.txt + $ diff mt.txt "$TESTDIR/simple.template.multitree.reweighted" diff --git a/src/test/cli/crushtool/simple.template.multitree b/src/test/cli/crushtool/simple.template.multitree new file mode 100644 index 000000000000..e2967a1c66f1 --- /dev/null +++ b/src/test/cli/crushtool/simple.template.multitree @@ -0,0 +1,70 @@ +# begin crush map + +# devices +device 0 device0 +device 1 osd1 + +# types +type 0 device +type 1 host +type 2 cluster + +# buckets +host host0 { + # weight 1.000 + alg straw + hash 0 # rjenkins1 + item device0 weight 1.000 +} +host host1 { + # weight 2.000 + alg straw + hash 0 # rjenkins1 + item osd1 weight 2.000 +} +cluster cluster0 { + # weight 3.000 + alg straw + hash 0 # rjenkins1 + item host0 weight 1.000 + item host1 weight 2.000 +} + +cluster cluster1 { + # weight 3.000 + alg straw + hash 0 # rjenkins1 + item host0 weight 1.000 + item host1 weight 2.000 +} + +# rules +rule data { + ruleset 0 + type replicated + min_size 1 + max_size 10 + step take cluster0 + step chooseleaf firstn 0 type host + step emit +} +rule metadata { + ruleset 1 + type replicated + min_size 1 + max_size 10 + step take cluster0 + step chooseleaf firstn 0 type host + step emit +} +rule rbd { + ruleset 2 + type replicated + min_size 1 + max_size 10 + step take cluster1 + step chooseleaf firstn 0 type host + step emit +} + +# end crush map diff --git a/src/test/cli/crushtool/simple.template.multitree.reweighted b/src/test/cli/crushtool/simple.template.multitree.reweighted new file mode 100644 index 000000000000..caad7ab771ab --- /dev/null +++ b/src/test/cli/crushtool/simple.template.multitree.reweighted @@ -0,0 +1,73 @@ +# begin crush map + +# devices +device 0 device0 +device 1 osd1 + +# types +type 0 device +type 1 host +type 2 cluster + +# buckets +host host0 { + id -1 # do not change unnecessarily + # weight 1.000 + alg straw + hash 0 # rjenkins1 + item device0 weight 1.000 +} +host host1 { + id -2 # do not change unnecessarily + # weight 2.500 + alg straw + hash 0 # rjenkins1 + item osd1 weight 2.500 +} +cluster cluster0 { + id -3 # do not change unnecessarily + # weight 3.500 + alg straw + hash 0 # rjenkins1 + item host0 weight 1.000 + item host1 weight 2.500 +} +cluster cluster1 { + id -4 # do not change unnecessarily + # weight 3.500 + alg straw + hash 0 # rjenkins1 + item host0 weight 1.000 + item host1 weight 2.500 +} + +# rules +rule data { + ruleset 0 + type replicated + min_size 1 + max_size 10 + step take cluster0 + step chooseleaf firstn 0 type host + step emit +} +rule metadata { + ruleset 1 + type replicated + min_size 1 + max_size 10 + step take cluster0 + step chooseleaf firstn 0 type host + step emit +} +rule rbd { + ruleset 2 + type replicated + min_size 1 + max_size 10 + step take cluster1 + step chooseleaf firstn 0 type host + step emit +} + +# end crush map