5 function expect_false
()
8 if "$@"; then return 1; else return 0; fi
14 ceph osd crush rule dump
15 ceph osd crush rule
ls
16 ceph osd crush rule list
18 ceph osd crush rule create-simple foo default
host
19 ceph osd crush rule create-simple foo default
host
20 ceph osd crush rule create-simple bar default
host
22 ceph osd crush rule
ls |
grep foo
24 ceph osd crush rule
rm foo
25 ceph osd crush rule
rm foo
# idempotent
26 ceph osd crush rule
rm bar
28 # can't delete in-use rules, tho:
29 expect_false ceph osd crush rule
rm replicated_rule
32 expect_false ceph osd crush add-bucket foo osd
33 ceph osd crush add-bucket foo root
36 ceph osd crush add
$o1 1 host=host1 root
=foo
37 ceph osd crush add
$o1 1 host=host1 root
=foo
# idemptoent
38 ceph osd crush add
$o2 1 host=host2 root
=foo
39 ceph osd crush add
$o2 1 host=host2 root
=foo
# idempotent
40 ceph osd crush add-bucket bar root
41 ceph osd crush add-bucket bar root
# idempotent
42 ceph osd crush link host1 root
=bar
43 ceph osd crush link host1 root
=bar
# idempotent
44 ceph osd crush link host2 root
=bar
45 ceph osd crush link host2 root
=bar
# idempotent
47 ceph osd tree |
grep -c osd.
$o1 |
grep -q 2
48 ceph osd tree |
grep -c host1 |
grep -q 2
49 ceph osd tree |
grep -c osd.
$o2 |
grep -q 2
50 ceph osd tree |
grep -c host2 |
grep -q 2
51 expect_false ceph osd crush
rm host1 foo
# not empty
52 ceph osd crush unlink host1 foo
53 ceph osd crush unlink host1 foo
54 ceph osd tree |
grep -c host1 |
grep -q 1
56 expect_false ceph osd crush
rm foo
# not empty
57 expect_false ceph osd crush
rm bar
# not empty
58 ceph osd crush unlink host1 bar
59 ceph osd tree |
grep -c host1 |
grep -q 1 # now an orphan
60 ceph osd crush
rm osd.
$o1 host1
61 ceph osd crush
rm host1
62 ceph osd tree |
grep -c host1 |
grep -q 0
64 expect_false ceph osd crush
rm bar
# not empty
65 ceph osd crush unlink host2
67 # reference foo and bar with a rule
68 ceph osd crush rule create-simple foo-rule foo
host firstn
69 expect_false ceph osd crush
rm foo
70 ceph osd crush rule
rm foo-rule
74 ceph osd crush
rm osd.
$o2 host2
75 ceph osd crush
rm host2
77 ceph osd crush add-bucket foo
host
78 ceph osd crush move foo root
=default rack
=localrack
80 ceph osd crush create-or-move osd.
$o1 1.0 root
=default
81 ceph osd crush move osd.
$o1 host=foo
82 ceph osd
find osd.
$o1 |
grep host |
grep foo
84 ceph osd crush
rm osd.
$o1
85 ceph osd crush
rm osd.
$o2
91 ceph osd crush add
$o3 123 root
=default
92 ceph osd tree |
grep osd.
$o3 |
grep 123
93 ceph osd crush reweight osd.
$o3 113
94 ceph osd tree |
grep osd.
$o3 |
grep 113
95 ceph osd crush
rm osd.
$o3
98 # test reweight-subtree
101 ceph osd crush add
$o4 123 root
=default
host=foobaz
102 ceph osd crush add
$o5 123 root
=default
host=foobaz
103 ceph osd tree |
grep osd.
$o4 |
grep 123
104 ceph osd tree |
grep osd.
$o5 |
grep 123
105 ceph osd crush reweight-subtree foobaz
155
106 ceph osd tree |
grep osd.
$o4 |
grep 155
107 ceph osd tree |
grep osd.
$o5 |
grep 155
108 ceph osd crush
rm osd.
$o4
109 ceph osd crush
rm osd.
$o5