]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | $ crushtool -i "$TESTDIR/simple.template" --add-item 0 1.0 device0 --loc host host0 --loc cluster cluster0 -o one > /dev/null |
2 | $ crushtool -i one --add-item 1 1.0 device1 --loc host host0 --loc cluster cluster0 -o two > /dev/null | |
31f18b77 FG |
3 | $ crushtool -i two --create-simple-rule simple-rule cluster0 host firstn -o two > /dev/null |
4 | $ crushtool -d two | |
5 | # begin crush map | |
6 | ||
7 | # devices | |
8 | device 0 device0 | |
9 | device 1 device1 | |
10 | ||
11 | # types | |
12 | type 0 device | |
13 | type 1 host | |
14 | type 2 cluster | |
15 | ||
16 | # buckets | |
17 | host host0 { | |
18 | \tid -2\t\t# do not change unnecessarily (esc) | |
19 | \t# weight 2.000 (esc) | |
20 | \talg straw (esc) | |
21 | \thash 0\t# rjenkins1 (esc) | |
22 | \titem device0 weight 1.000 (esc) | |
23 | \titem device1 weight 1.000 (esc) | |
24 | } | |
25 | cluster cluster0 { | |
26 | \tid -1\t\t# do not change unnecessarily (esc) | |
27 | \t# weight 2.000 (esc) | |
28 | \talg straw (esc) | |
29 | \thash 0\t# rjenkins1 (esc) | |
30 | \titem host0 weight 2.000 (esc) | |
31 | } | |
32 | ||
33 | # rules | |
34 | rule data { | |
c07f9fc5 | 35 | \tid 0 (esc) |
31f18b77 FG |
36 | \ttype replicated (esc) |
37 | \tmin_size 1 (esc) | |
38 | \tmax_size 10 (esc) | |
39 | \tstep take cluster0 (esc) | |
40 | \tstep chooseleaf firstn 0 type host (esc) | |
41 | \tstep emit (esc) | |
42 | } | |
43 | rule metadata { | |
c07f9fc5 | 44 | \tid 1 (esc) |
31f18b77 FG |
45 | \ttype replicated (esc) |
46 | \tmin_size 1 (esc) | |
47 | \tmax_size 10 (esc) | |
48 | \tstep take cluster0 (esc) | |
49 | \tstep chooseleaf firstn 0 type host (esc) | |
50 | \tstep emit (esc) | |
51 | } | |
52 | rule rbd { | |
c07f9fc5 | 53 | \tid 2 (esc) |
31f18b77 FG |
54 | \ttype replicated (esc) |
55 | \tmin_size 1 (esc) | |
56 | \tmax_size 10 (esc) | |
57 | \tstep take cluster0 (esc) | |
58 | \tstep chooseleaf firstn 0 type host (esc) | |
59 | \tstep emit (esc) | |
60 | } | |
61 | rule simple-rule { | |
c07f9fc5 | 62 | \tid 3 (esc) |
31f18b77 FG |
63 | \ttype replicated (esc) |
64 | \tmin_size 1 (esc) | |
65 | \tmax_size 10 (esc) | |
66 | \tstep take cluster0 (esc) | |
67 | \tstep chooseleaf firstn 0 type host (esc) | |
68 | \tstep emit (esc) | |
69 | } | |
70 | ||
71 | # end crush map | |
72 | $ crushtool -i two --remove-rule simple-rule -o two > /dev/null | |
73 | $ crushtool -d two | |
74 | # begin crush map | |
75 | ||
76 | # devices | |
77 | device 0 device0 | |
78 | device 1 device1 | |
79 | ||
80 | # types | |
81 | type 0 device | |
82 | type 1 host | |
83 | type 2 cluster | |
84 | ||
85 | # buckets | |
86 | host host0 { | |
87 | \tid -2\t\t# do not change unnecessarily (esc) | |
88 | \t# weight 2.000 (esc) | |
89 | \talg straw (esc) | |
90 | \thash 0\t# rjenkins1 (esc) | |
91 | \titem device0 weight 1.000 (esc) | |
92 | \titem device1 weight 1.000 (esc) | |
93 | } | |
94 | cluster cluster0 { | |
95 | \tid -1\t\t# do not change unnecessarily (esc) | |
96 | \t# weight 2.000 (esc) | |
97 | \talg straw (esc) | |
98 | \thash 0\t# rjenkins1 (esc) | |
99 | \titem host0 weight 2.000 (esc) | |
100 | } | |
101 | ||
102 | # rules | |
103 | rule data { | |
c07f9fc5 | 104 | \tid 0 (esc) |
31f18b77 FG |
105 | \ttype replicated (esc) |
106 | \tmin_size 1 (esc) | |
107 | \tmax_size 10 (esc) | |
108 | \tstep take cluster0 (esc) | |
109 | \tstep chooseleaf firstn 0 type host (esc) | |
110 | \tstep emit (esc) | |
111 | } | |
112 | rule metadata { | |
c07f9fc5 | 113 | \tid 1 (esc) |
31f18b77 FG |
114 | \ttype replicated (esc) |
115 | \tmin_size 1 (esc) | |
116 | \tmax_size 10 (esc) | |
117 | \tstep take cluster0 (esc) | |
118 | \tstep chooseleaf firstn 0 type host (esc) | |
119 | \tstep emit (esc) | |
120 | } | |
121 | rule rbd { | |
c07f9fc5 | 122 | \tid 2 (esc) |
31f18b77 FG |
123 | \ttype replicated (esc) |
124 | \tmin_size 1 (esc) | |
125 | \tmax_size 10 (esc) | |
126 | \tstep take cluster0 (esc) | |
127 | \tstep chooseleaf firstn 0 type host (esc) | |
128 | \tstep emit (esc) | |
129 | } | |
130 | ||
131 | # end crush map | |
7c673cae FG |
132 | $ crushtool -d two -o final |
133 | $ cmp final "$TESTDIR/simple.template.two" | |
134 | $ crushtool -i two --add-item 1 1.0 device1 --loc host host0 --loc cluster cluster0 -o three 2>/dev/null >/dev/null || echo FAIL | |
135 | FAIL | |
136 | $ crushtool -i two --remove-item device1 -o four > /dev/null | |
137 | $ crushtool -d four -o final | |
138 | $ cmp final "$TESTDIR/simple.template.four" | |
139 | $ crushtool -i two --update-item 1 2.0 osd1 --loc host host1 --loc cluster cluster0 -o five > /dev/null | |
140 | $ crushtool -d five -o final | |
141 | $ cmp final "$TESTDIR/simple.template.five" | |
142 | $ crushtool -i five --update-item 1 2.0 osd1 --loc host host1 --loc cluster cluster0 -o six > /dev/null | |
143 | $ crushtool -i five --show-location 1 | |
144 | cluster\tcluster0 (esc) | |
145 | host\thost1 (esc) | |
146 | $ crushtool -d six -o final | |
147 | $ cmp final "$TESTDIR/simple.template.five" |