summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2012-05-02 13:45:21 -0700
committerSage Weil <sage@newdream.net>2012-05-02 14:55:53 -0700
commitee00095abb2f55a211ccd278ae87f4ceb9900ed2 (patch)
tree67b2c4d7d47f8560e6b5440aca46244d65bc435f
parentce5842b60b4ab0e259b2166e94871c971760976e (diff)
downloadceph-ee00095abb2f55a211ccd278ae87f4ceb9900ed2.tar.gz
crushtool: extent cli test to include --remove-item and --update-item
Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r--src/test/cli/crushtool/add-item.t10
-rw-r--r--src/test/cli/crushtool/help.t3
-rw-r--r--src/test/cli/crushtool/simple.template.five65
-rw-r--r--src/test/cli/crushtool/simple.template.four56
-rw-r--r--src/test/cli/crushtool/simple.template.one (renamed from src/test/cli/crushtool/simple.template.out)0
-rw-r--r--src/test/cli/crushtool/simple.template.three58
-rw-r--r--src/test/cli/crushtool/simple.template.two58
7 files changed, 249 insertions, 1 deletions
diff --git a/src/test/cli/crushtool/add-item.t b/src/test/cli/crushtool/add-item.t
index aa5c23ce24d..80b91da59dc 100644
--- a/src/test/cli/crushtool/add-item.t
+++ b/src/test/cli/crushtool/add-item.t
@@ -1,4 +1,12 @@
$ crushtool -i "$TESTDIR/simple.template" --add-item 0 1.0 device0 --loc host host0 --loc cluster cluster0 -o one > /dev/null
$ crushtool -i one --add-item 1 1.0 device1 --loc host host0 --loc cluster cluster0 -o two > /dev/null
$ crushtool -d two -o final
- $ cmp final "$TESTDIR/simple.template.out"
+ $ cmp final "$TESTDIR/simple.template.two"
+ $ crushtool -i two --add-item 1 1.0 device1 --loc host host0 --loc cluster cluster0 -o three 2>/dev/null >/dev/null || echo FAIL
+ FAIL
+ $ crushtool -i two --remove-item device1 -o four > /dev/null
+ $ crushtool -d four -o final
+ $ cmp final "$TESTDIR/simple.template.four"
+ $ crushtool -i two --update-item 1 2.0 osd1 --loc host host1 --loc cluster cluster0 -o five > /dev/null
+ $ crushtool -d five -o final
+ $ cmp final "$TESTDIR/simple.template.five"
diff --git a/src/test/cli/crushtool/help.t b/src/test/cli/crushtool/help.t
index 7f91c1cbc3d..af411aee990 100644
--- a/src/test/cli/crushtool/help.t
+++ b/src/test/cli/crushtool/help.t
@@ -17,6 +17,9 @@
-i mapfn --add-item id weight name [--loc type name ...]
insert an item into the hierarchy at the
given location
+ -i mapfn --update-item id weight name [--loc type name ...]
+ insert or move an item into the hierarchy at the
+ given location
-i mapfn --remove-item name
remove the given item
-i mapfn --reweight-item name weight
diff --git a/src/test/cli/crushtool/simple.template.five b/src/test/cli/crushtool/simple.template.five
new file mode 100644
index 00000000000..240e81de021
--- /dev/null
+++ b/src/test/cli/crushtool/simple.template.five
@@ -0,0 +1,65 @@
+# begin crush map
+
+# devices
+device 0 device0
+device 1 osd1
+
+# types
+type 0 device
+type 1 host
+type 2 cluster
+
+# buckets
+host host0 {
+ id -2 # do not change unnecessarily
+ # weight 1.000
+ alg straw
+ hash 0 # rjenkins1
+ item device0 weight 1.000
+}
+host host1 {
+ id -3 # do not change unnecessarily
+ # weight 2.000
+ alg straw
+ hash 0 # rjenkins1
+ item osd1 weight 2.000
+}
+cluster cluster0 {
+ id -1 # do not change unnecessarily
+ # 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 cluster0
+ step chooseleaf firstn 0 type host
+ step emit
+}
+
+# end crush map
diff --git a/src/test/cli/crushtool/simple.template.four b/src/test/cli/crushtool/simple.template.four
new file mode 100644
index 00000000000..aa16bbdedc3
--- /dev/null
+++ b/src/test/cli/crushtool/simple.template.four
@@ -0,0 +1,56 @@
+# begin crush map
+
+# devices
+device 0 device0
+
+# types
+type 0 device
+type 1 host
+type 2 cluster
+
+# buckets
+host host0 {
+ id -2 # do not change unnecessarily
+ # weight 1.000
+ alg straw
+ hash 0 # rjenkins1
+ item device0 weight 1.000
+}
+cluster cluster0 {
+ id -1 # do not change unnecessarily
+ # weight 1.000
+ alg straw
+ hash 0 # rjenkins1
+ item host0 weight 1.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 cluster0
+ step chooseleaf firstn 0 type host
+ step emit
+}
+
+# end crush map
diff --git a/src/test/cli/crushtool/simple.template.out b/src/test/cli/crushtool/simple.template.one
index 9a3aee7349d..9a3aee7349d 100644
--- a/src/test/cli/crushtool/simple.template.out
+++ b/src/test/cli/crushtool/simple.template.one
diff --git a/src/test/cli/crushtool/simple.template.three b/src/test/cli/crushtool/simple.template.three
new file mode 100644
index 00000000000..9a3aee7349d
--- /dev/null
+++ b/src/test/cli/crushtool/simple.template.three
@@ -0,0 +1,58 @@
+# begin crush map
+
+# devices
+device 0 device0
+device 1 device1
+
+# types
+type 0 device
+type 1 host
+type 2 cluster
+
+# buckets
+host host0 {
+ id -2 # do not change unnecessarily
+ # weight 2.000
+ alg straw
+ hash 0 # rjenkins1
+ item device0 weight 1.000
+ item device1 weight 1.000
+}
+cluster cluster0 {
+ id -1 # do not change unnecessarily
+ # weight 2.000
+ alg straw
+ hash 0 # rjenkins1
+ item host0 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 cluster0
+ step chooseleaf firstn 0 type host
+ step emit
+}
+
+# end crush map
diff --git a/src/test/cli/crushtool/simple.template.two b/src/test/cli/crushtool/simple.template.two
new file mode 100644
index 00000000000..9a3aee7349d
--- /dev/null
+++ b/src/test/cli/crushtool/simple.template.two
@@ -0,0 +1,58 @@
+# begin crush map
+
+# devices
+device 0 device0
+device 1 device1
+
+# types
+type 0 device
+type 1 host
+type 2 cluster
+
+# buckets
+host host0 {
+ id -2 # do not change unnecessarily
+ # weight 2.000
+ alg straw
+ hash 0 # rjenkins1
+ item device0 weight 1.000
+ item device1 weight 1.000
+}
+cluster cluster0 {
+ id -1 # do not change unnecessarily
+ # weight 2.000
+ alg straw
+ hash 0 # rjenkins1
+ item host0 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 cluster0
+ step chooseleaf firstn 0 type host
+ step emit
+}
+
+# end crush map