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 # make sure we're at luminous+ before using crush device classes
23 ceph osd require-osd-release luminous
24 ceph osd crush class create ssd
25 ceph osd crush class create hdd
26 ceph osd crush set-device-class ssd osd
.0
27 ceph osd crush set-device-class hdd osd
.1
28 ceph osd crush rule create-replicated foo-ssd default
host ssd
29 ceph osd crush rule create-replicated foo-hdd default
host hdd
31 ceph osd erasure-code-profile
set ec-foo-ssd crush-device-class
=ssd m
=2 k
=2
32 ceph osd pool create ec-foo
2 erasure ec-foo-ssd
33 ceph osd pool
rm ec-foo ec-foo
--yes-i-really-really-mean-it
35 ceph osd crush rule
ls |
grep foo
37 ceph osd crush rule
rm foo
38 ceph osd crush rule
rm foo
# idempotent
39 ceph osd crush rule
rm bar
41 # can't delete in-use rules, tho:
42 expect_false ceph osd crush rule
rm replicated_rule
45 expect_false ceph osd crush add-bucket foo osd
46 ceph osd crush add-bucket foo root
49 ceph osd crush add
$o1 1 host=host1 root
=foo
50 ceph osd crush add
$o1 1 host=host1 root
=foo
# idemptoent
51 ceph osd crush add
$o2 1 host=host2 root
=foo
52 ceph osd crush add
$o2 1 host=host2 root
=foo
# idempotent
53 ceph osd crush add-bucket bar root
54 ceph osd crush add-bucket bar root
# idempotent
55 ceph osd crush link host1 root
=bar
56 ceph osd crush link host1 root
=bar
# idempotent
57 ceph osd crush link host2 root
=bar
58 ceph osd crush link host2 root
=bar
# idempotent
60 ceph osd tree |
grep -c osd.
$o1 |
grep -q 2
61 ceph osd tree |
grep -c host1 |
grep -q 2
62 ceph osd tree |
grep -c osd.
$o2 |
grep -q 2
63 ceph osd tree |
grep -c host2 |
grep -q 2
64 expect_false ceph osd crush
rm host1 foo
# not empty
65 ceph osd crush unlink host1 foo
66 ceph osd crush unlink host1 foo
67 ceph osd tree |
grep -c host1 |
grep -q 1
69 expect_false ceph osd crush
rm foo
# not empty
70 expect_false ceph osd crush
rm bar
# not empty
71 ceph osd crush unlink host1 bar
72 ceph osd tree |
grep -c host1 |
grep -q 1 # now an orphan
73 ceph osd crush
rm osd.
$o1 host1
74 ceph osd crush
rm host1
75 ceph osd tree |
grep -c host1 |
grep -q 0
77 expect_false ceph osd crush
rm bar
# not empty
78 ceph osd crush unlink host2
80 # reference foo and bar with a rule
81 ceph osd crush rule create-simple foo-rule foo
host firstn
82 expect_false ceph osd crush
rm foo
83 ceph osd crush rule
rm foo-rule
87 ceph osd crush
rm osd.
$o2 host2
88 ceph osd crush
rm host2
90 ceph osd crush add-bucket foo
host
91 ceph osd crush move foo root
=default rack
=localrack
93 ceph osd crush create-or-move osd.
$o1 1.0 root
=default
94 ceph osd crush move osd.
$o1 host=foo
95 ceph osd
find osd.
$o1 |
grep host |
grep foo
97 ceph osd crush
rm osd.
$o1
98 ceph osd crush
rm osd.
$o2
100 ceph osd crush
rm foo
104 ceph osd crush add
$o3 123 root
=default
105 ceph osd tree |
grep osd.
$o3 |
grep 123
106 ceph osd crush reweight osd.
$o3 113
107 expect_false ceph osd crush reweight osd.
$o3 123456
108 ceph osd tree |
grep osd.
$o3 |
grep 113
109 ceph osd crush
rm osd.
$o3
112 # test reweight-subtree
115 ceph osd crush add
$o4 123 root
=default
host=foobaz
116 ceph osd crush add
$o5 123 root
=default
host=foobaz
117 ceph osd tree |
grep osd.
$o4 |
grep 123
118 ceph osd tree |
grep osd.
$o5 |
grep 123
119 ceph osd crush reweight-subtree foobaz
155
120 expect_false ceph osd crush reweight-subtree foobaz
123456
121 ceph osd tree |
grep osd.
$o4 |
grep 155
122 ceph osd tree |
grep osd.
$o5 |
grep 155
123 ceph osd crush
rm osd.
$o4
124 ceph osd crush
rm osd.
$o5