Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / test / cli / crushtool / choose-args.t
1   $ cp "$TESTDIR/choose-args.crush" .
2   $ crushtool -c choose-args.crush -o choose-args.compiled
3   $ crushtool -d choose-args.compiled -o choose-args.conf
4   $ crushtool -c choose-args.conf -o choose-args.recompiled
5   $ cmp choose-args.crush choose-args.conf
6   $ cmp choose-args.compiled choose-args.recompiled
7   $ crushtool -c choose-args.conf -o /dev/null --dump
8   {
9       "devices": [
10           {
11               "id": 0,
12               "name": "device0"
13           },
14           {
15               "id": 1,
16               "name": "device1"
17           },
18           {
19               "id": 2,
20               "name": "device2"
21           }
22       ],
23       "types": [
24           {
25               "type_id": 0,
26               "name": "device"
27           },
28           {
29               "type_id": 1,
30               "name": "host"
31           },
32           {
33               "type_id": 2,
34               "name": "rack"
35           },
36           {
37               "type_id": 3,
38               "name": "root"
39           }
40       ],
41       "buckets": [
42           {
43               "id": -1,
44               "name": "host0",
45               "type_id": 1,
46               "type_name": "host",
47               "weight": 65536,
48               "alg": "straw",
49               "hash": "rjenkins1",
50               "items": [
51                   {
52                       "id": 0,
53                       "weight": 65536,
54                       "pos": 0
55                   }
56               ]
57           },
58           {
59               "id": -2,
60               "name": "host1",
61               "type_id": 1,
62               "type_name": "host",
63               "weight": 65536,
64               "alg": "straw",
65               "hash": "rjenkins1",
66               "items": [
67                   {
68                       "id": 1,
69                       "weight": 65536,
70                       "pos": 0
71                   }
72               ]
73           },
74           {
75               "id": -3,
76               "name": "rack0",
77               "type_id": 2,
78               "type_name": "rack",
79               "weight": 196608,
80               "alg": "straw",
81               "hash": "rjenkins1",
82               "items": [
83                   {
84                       "id": -1,
85                       "weight": 65536,
86                       "pos": 0
87                   },
88                   {
89                       "id": -2,
90                       "weight": 65536,
91                       "pos": 1
92                   },
93                   {
94                       "id": -5,
95                       "weight": 65536,
96                       "pos": 2
97                   }
98               ]
99           },
100           {
101               "id": -4,
102               "name": "root",
103               "type_id": 3,
104               "type_name": "root",
105               "weight": 262144,
106               "alg": "straw",
107               "hash": "rjenkins1",
108               "items": [
109                   {
110                       "id": -3,
111                       "weight": 262144,
112                       "pos": 0
113                   }
114               ]
115           },
116           {
117               "id": -5,
118               "name": "host2",
119               "type_id": 1,
120               "type_name": "host",
121               "weight": 65536,
122               "alg": "straw",
123               "hash": "rjenkins1",
124               "items": [
125                   {
126                       "id": 2,
127                       "weight": 65536,
128                       "pos": 0
129                   }
130               ]
131           }
132       ],
133       "rules": [
134           {
135               "rule_id": 3,
136               "rule_name": "data",
137               "ruleset": 3,
138               "type": 1,
139               "min_size": 2,
140               "max_size": 2,
141               "steps": [
142                   {
143                       "op": "take",
144                       "item": -4,
145                       "item_name": "root"
146                   },
147                   {
148                       "op": "chooseleaf_firstn",
149                       "num": 0,
150                       "type": "rack"
151                   },
152                   {
153                       "op": "emit"
154                   }
155               ]
156           }
157       ],
158       "tunables": {
159           "choose_local_tries": 2,
160           "choose_local_fallback_tries": 5,
161           "choose_total_tries": 19,
162           "chooseleaf_descend_once": 0,
163           "chooseleaf_vary_r": 0,
164           "chooseleaf_stable": 0,
165           "straw_calc_version": 0,
166           "allowed_bucket_algs": 22,
167           "profile": "argonaut",
168           "optimal_tunables": 0,
169           "legacy_tunables": 1,
170           "minimum_required_version": "argonaut",
171           "require_feature_tunables": 0,
172           "require_feature_tunables2": 0,
173           "has_v2_rules": 0,
174           "require_feature_tunables3": 0,
175           "has_v3_rules": 0,
176           "has_v4_buckets": 0,
177           "require_feature_tunables5": 0,
178           "has_v5_rules": 0
179       },
180       "choose_args": {
181           "1": [],
182           "2": [
183               {
184                   "bucket_id": -3,
185                   "ids": [
186                       -20,
187                       30,
188                       -25
189                   ]
190               }
191           ],
192           "3": [
193               {
194                   "bucket_id": -3,
195                   "weight_set": [
196                       [
197                           1.000000,
198                           2.000000,
199                           5.000000
200                       ],
201                       [
202                           3.000000,
203                           2.000000,
204                           5.000000
205                       ]
206                   ],
207                   "ids": [
208                       -20,
209                       -30,
210                       -25
211                   ]
212               }
213           ],
214           "4": [
215               {
216                   "bucket_id": -2,
217                   "weight_set": [
218                       [
219                           1.000000
220                       ],
221                       [
222                           3.000000
223                       ]
224                   ]
225               }
226           ],
227           "5": [
228               {
229                   "bucket_id": -1,
230                   "ids": [
231                       -450
232                   ]
233               }
234           ],
235           "6": [
236               {
237                   "bucket_id": -1,
238                   "ids": [
239                       -450
240                   ]
241               },
242               {
243                   "bucket_id": -2,
244                   "weight_set": [
245                       [
246                           1.000000
247                       ],
248                       [
249                           3.000000
250                       ]
251                   ]
252               },
253               {
254                   "bucket_id": -3,
255                   "weight_set": [
256                       [
257                           1.000000,
258                           2.000000,
259                           5.000000
260                       ],
261                       [
262                           3.000000,
263                           2.000000,
264                           5.000000
265                       ]
266                   ],
267                   "ids": [
268                       -20,
269                       -30,
270                       -25
271                   ]
272               }
273           ]
274       }
275   }
276   
277
278   $ crushtool -c choose-args.conf -o /dev/null --dump | jq .for_json_validation
279   null