]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: add test for reweighting multiple items in the tree 106/head
authorSage Weil <sage@inktank.com>
Tue, 12 Mar 2013 00:38:00 +0000 (17:38 -0700)
committerSage Weil <sage@inktank.com>
Tue, 12 Mar 2013 00:38:00 +0000 (17:38 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/test/cli/crushtool/reweight_multiple.t [new file with mode: 0644]
src/test/cli/crushtool/simple.template.multitree [new file with mode: 0644]
src/test/cli/crushtool/simple.template.multitree.reweighted [new file with mode: 0644]

diff --git a/src/test/cli/crushtool/reweight_multiple.t b/src/test/cli/crushtool/reweight_multiple.t
new file mode 100644 (file)
index 0000000..7eff673
--- /dev/null
@@ -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 (file)
index 0000000..e2967a1
--- /dev/null
@@ -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 (file)
index 0000000..caad7ab
--- /dev/null
@@ -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