]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/cli-integration/rbd/formatted-output.t
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / test / cli-integration / rbd / formatted-output.t
CommitLineData
7c673cae
FG
1ls on empty pool never containing images
2========================================
3 $ ceph osd pool create rbd_other 8
4 pool 'rbd_other' created
d2e6a577 5 $ rbd pool init rbd_other
7c673cae
FG
6 $ rados -p rbd rm rbd_directory >/dev/null 2>&1 || true
7 $ rbd ls
8 $ rbd ls --format json
181888fb 9 []
7c673cae 10 $ rbd ls --format xml
181888fb 11 <images></images>
7c673cae
FG
12
13create
14=======
11fdf7f2 15 $ RBD_FORCE_ALLOW_V1=1 rbd create -s 1024 --image-format 1 foo --log-to-stderr=false
7c673cae
FG
16 rbd: image format 1 is deprecated
17 $ rbd create -s 512 --image-format 2 bar
18 $ rbd create -s 2048 --image-format 2 --image-feature layering baz
11fdf7f2 19 $ RBD_FORCE_ALLOW_V1=1 rbd create -s 1 --image-format 1 quux --log-to-stderr=false
7c673cae
FG
20 rbd: image format 1 is deprecated
21 $ rbd create -s 1G --image-format 2 quuy
22
23snapshot
24========
25 $ rbd snap create bar@snap
26 $ rbd resize -s 1024 --no-progress bar
27 $ rbd resize -s 2G --no-progress quuy
28 $ rbd snap create bar@snap2
29 $ rbd snap create foo@snap
30
31clone
32=====
33 $ rbd snap protect bar@snap
34 $ rbd clone --image-feature layering,exclusive-lock,object-map,fast-diff bar@snap rbd_other/child
35 $ rbd snap create rbd_other/child@snap
36 $ rbd flatten rbd_other/child 2> /dev/null
37 $ rbd bench rbd_other/child --io-type write --io-pattern seq --io-total 1B > /dev/null 2>&1
38 $ rbd clone bar@snap rbd_other/deep-flatten-child
39 $ rbd snap create rbd_other/deep-flatten-child@snap
40 $ rbd flatten rbd_other/deep-flatten-child 2> /dev/null
41
42lock
43====
44 $ rbd lock add quux id
45 $ rbd lock add baz id1 --shared tag
46 $ rbd lock add baz id2 --shared tag
47 $ rbd lock add baz id3 --shared tag
48
49test formatting
50===============
51 $ rbd children foo@snap
52 $ rbd children bar@snap
53 rbd_other/child
54 $ rbd children bar@snap2
55TODO: figure out why .* does not match the block_name_prefix line in rbd info.
56For now, use a more inclusive regex.
57 $ rbd info foo
58 rbd image 'foo':
11fdf7f2
TL
59 \tsize 1 GiB in 256 objects (esc)
60 \torder 22 (4 MiB objects) (esc)
61 \tsnapshot_count: 1 (esc)
7c673cae
FG
62 [^^]+ (re)
63 \tformat: 1 (esc)
64 $ rbd info foo --format json | python -mjson.tool | sed 's/,$/, /'
65 {
66 "block_name_prefix": "rb.0.*", (glob)
67 "format": 1,
11fdf7f2 68 "id": "",
7c673cae
FG
69 "name": "foo",
70 "object_size": 4194304,
71 "objects": 256,
72 "order": 22,
11fdf7f2
TL
73 "size": 1073741824,
74 "snapshot_count": 1
7c673cae
FG
75 }
76The version of xml_pp included in ubuntu precise always prints a 'warning'
77whenever it is run. grep -v to ignore it, but still work on other distros.
78 $ rbd info foo --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
79 <image>
80 <name>foo</name>
11fdf7f2 81 <id></id>
7c673cae
FG
82 <size>1073741824</size>
83 <objects>256</objects>
84 <order>22</order>
85 <object_size>4194304</object_size>
11fdf7f2 86 <snapshot_count>1</snapshot_count>
7c673cae
FG
87 <block_name_prefix>rb.0.*</block_name_prefix> (glob)
88 <format>1</format>
89 </image>
90 $ rbd info foo@snap
91 rbd image 'foo':
11fdf7f2
TL
92 \tsize 1 GiB in 256 objects (esc)
93 \torder 22 (4 MiB objects) (esc)
94 \tsnapshot_count: 1 (esc)
7c673cae
FG
95 [^^]+ (re)
96 \tformat: 1 (esc)
97 \tprotected: False (esc)
98 $ rbd info foo@snap --format json | python -mjson.tool | sed 's/,$/, /'
99 {
100 "block_name_prefix": "rb.0.*", (glob)
101 "format": 1,
11fdf7f2 102 "id": "",
7c673cae
FG
103 "name": "foo",
104 "object_size": 4194304,
105 "objects": 256,
106 "order": 22,
107 "protected": "false",
11fdf7f2
TL
108 "size": 1073741824,
109 "snapshot_count": 1
7c673cae
FG
110 }
111 $ rbd info foo@snap --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
112 <image>
113 <name>foo</name>
11fdf7f2 114 <id></id>
7c673cae
FG
115 <size>1073741824</size>
116 <objects>256</objects>
117 <order>22</order>
118 <object_size>4194304</object_size>
11fdf7f2 119 <snapshot_count>1</snapshot_count>
7c673cae
FG
120 <block_name_prefix>rb.0*</block_name_prefix> (glob)
121 <format>1</format>
122 <protected>false</protected>
123 </image>
124 $ rbd info bar
125 rbd image 'bar':
11fdf7f2
TL
126 \tsize 1 GiB in 256 objects (esc)
127 \torder 22 (4 MiB objects) (esc)
128 \tsnapshot_count: 2 (esc)
129 \tid:* (glob)
7c673cae
FG
130 [^^]+ (re)
131 \tformat: 2 (esc)
132 \tfeatures: layering, exclusive-lock, object-map, fast-diff, deep-flatten (esc)
11fdf7f2 133 \top_features: (esc)
7c673cae 134 \tflags: (esc)
31f18b77 135 \tcreate_timestamp:* (glob)
11fdf7f2
TL
136 \taccess_timestamp:* (glob)
137 \tmodify_timestamp:* (glob)
7c673cae
FG
138 $ rbd info bar --format json | python -mjson.tool | sed 's/,$/, /'
139 {
11fdf7f2 140 "access_timestamp": "*", (glob)
7c673cae 141 "block_name_prefix": "rbd_data.*", (glob)
31f18b77 142 "create_timestamp": "*", (glob)
7c673cae
FG
143 "features": [
144 "layering",
145 "exclusive-lock",
146 "object-map",
147 "fast-diff",
148 "deep-flatten"
149 ],
150 "flags": [],
151 "format": 2,
11fdf7f2
TL
152 "id": "*", (glob)
153 "modify_timestamp": "*", (glob)
7c673cae
FG
154 "name": "bar",
155 "object_size": 4194304,
156 "objects": 256,
11fdf7f2 157 "op_features": [],
7c673cae 158 "order": 22,
11fdf7f2
TL
159 "size": 1073741824,
160 "snapshot_count": 2
7c673cae
FG
161 }
162 $ rbd info bar --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
163 <image>
164 <name>bar</name>
11fdf7f2 165 <id>*</id> (glob)
7c673cae
FG
166 <size>1073741824</size>
167 <objects>256</objects>
168 <order>22</order>
169 <object_size>4194304</object_size>
11fdf7f2 170 <snapshot_count>2</snapshot_count>
7c673cae
FG
171 <block_name_prefix>rbd_data.*</block_name_prefix> (glob)
172 <format>2</format>
173 <features>
174 <feature>layering</feature>
175 <feature>exclusive-lock</feature>
176 <feature>object-map</feature>
177 <feature>fast-diff</feature>
178 <feature>deep-flatten</feature>
179 </features>
11fdf7f2 180 <op_features></op_features>
7c673cae 181 <flags></flags>
31f18b77 182 <create_timestamp>*</create_timestamp> (glob)
11fdf7f2
TL
183 <access_timestamp>*</access_timestamp> (glob)
184 <modify_timestamp>*</modify_timestamp> (glob)
7c673cae
FG
185 </image>
186 $ rbd info bar@snap
187 rbd image 'bar':
11fdf7f2
TL
188 \tsize 512 MiB in 128 objects (esc)
189 \torder 22 (4 MiB objects) (esc)
190 \tsnapshot_count: 2 (esc)
191 \tid:* (glob)
7c673cae
FG
192 [^^]+ (re)
193 \tformat: 2 (esc)
194 \tfeatures: layering, exclusive-lock, object-map, fast-diff, deep-flatten (esc)
11fdf7f2 195 \top_features: (esc)
7c673cae 196 \tflags: (esc)
31f18b77 197 \tcreate_timestamp:* (glob)
11fdf7f2
TL
198 \taccess_timestamp:* (glob)
199 \tmodify_timestamp:* (glob)
7c673cae
FG
200 \tprotected: True (esc)
201 $ rbd info bar@snap --format json | python -mjson.tool | sed 's/,$/, /'
202 {
11fdf7f2 203 "access_timestamp": "*", (glob)
7c673cae 204 "block_name_prefix": "rbd_data.*", (glob)
31f18b77 205 "create_timestamp": "*", (glob)
7c673cae
FG
206 "features": [
207 "layering",
208 "exclusive-lock",
209 "object-map",
210 "fast-diff",
211 "deep-flatten"
212 ],
213 "flags": [],
214 "format": 2,
11fdf7f2
TL
215 "id": "*", (glob)
216 "modify_timestamp": "*", (glob)
7c673cae
FG
217 "name": "bar",
218 "object_size": 4194304,
219 "objects": 128,
11fdf7f2 220 "op_features": [],
7c673cae
FG
221 "order": 22,
222 "protected": "true",
11fdf7f2
TL
223 "size": 536870912,
224 "snapshot_count": 2
7c673cae
FG
225 }
226 $ rbd info bar@snap --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
227 <image>
228 <name>bar</name>
11fdf7f2 229 <id>*</id> (glob)
7c673cae
FG
230 <size>536870912</size>
231 <objects>128</objects>
232 <order>22</order>
233 <object_size>4194304</object_size>
11fdf7f2 234 <snapshot_count>2</snapshot_count>
7c673cae
FG
235 <block_name_prefix>rbd_data.*</block_name_prefix> (glob)
236 <format>2</format>
237 <features>
238 <feature>layering</feature>
239 <feature>exclusive-lock</feature>
240 <feature>object-map</feature>
241 <feature>fast-diff</feature>
242 <feature>deep-flatten</feature>
243 </features>
11fdf7f2 244 <op_features></op_features>
7c673cae 245 <flags></flags>
31f18b77 246 <create_timestamp>*</create_timestamp> (glob)
11fdf7f2
TL
247 <access_timestamp>*</access_timestamp> (glob)
248 <modify_timestamp>*</modify_timestamp> (glob)
7c673cae
FG
249 <protected>true</protected>
250 </image>
251 $ rbd info bar@snap2
252 rbd image 'bar':
11fdf7f2
TL
253 \tsize 1 GiB in 256 objects (esc)
254 \torder 22 (4 MiB objects) (esc)
255 \tsnapshot_count: 2 (esc)
256 \tid:* (glob)
7c673cae
FG
257 [^^]+ (re)
258 \tformat: 2 (esc)
259 \tfeatures: layering, exclusive-lock, object-map, fast-diff, deep-flatten (esc)
11fdf7f2 260 \top_features: (esc)
7c673cae 261 \tflags: (esc)
31f18b77 262 \tcreate_timestamp:* (glob)
11fdf7f2
TL
263 \taccess_timestamp:* (glob)
264 \tmodify_timestamp:* (glob)
7c673cae
FG
265 \tprotected: False (esc)
266 $ rbd info bar@snap2 --format json | python -mjson.tool | sed 's/,$/, /'
267 {
11fdf7f2 268 "access_timestamp": "*", (glob)
7c673cae 269 "block_name_prefix": "rbd_data.*", (glob)
31f18b77 270 "create_timestamp": "*", (glob)
7c673cae
FG
271 "features": [
272 "layering",
273 "exclusive-lock",
274 "object-map",
275 "fast-diff",
276 "deep-flatten"
277 ],
278 "flags": [],
279 "format": 2,
11fdf7f2
TL
280 "id": "*", (glob)
281 "modify_timestamp": "*", (glob)
7c673cae
FG
282 "name": "bar",
283 "object_size": 4194304,
284 "objects": 256,
11fdf7f2 285 "op_features": [],
7c673cae
FG
286 "order": 22,
287 "protected": "false",
11fdf7f2
TL
288 "size": 1073741824,
289 "snapshot_count": 2
7c673cae
FG
290 }
291 $ rbd info bar@snap2 --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
292 <image>
293 <name>bar</name>
11fdf7f2 294 <id>*</id> (glob)
7c673cae
FG
295 <size>1073741824</size>
296 <objects>256</objects>
297 <order>22</order>
298 <object_size>4194304</object_size>
11fdf7f2 299 <snapshot_count>2</snapshot_count>
7c673cae
FG
300 <block_name_prefix>rbd_data.*</block_name_prefix> (glob)
301 <format>2</format>
302 <features>
303 <feature>layering</feature>
304 <feature>exclusive-lock</feature>
305 <feature>object-map</feature>
306 <feature>fast-diff</feature>
307 <feature>deep-flatten</feature>
308 </features>
11fdf7f2 309 <op_features></op_features>
7c673cae 310 <flags></flags>
31f18b77 311 <create_timestamp>*</create_timestamp> (glob)
11fdf7f2
TL
312 <access_timestamp>*</access_timestamp> (glob)
313 <modify_timestamp>*</modify_timestamp> (glob)
7c673cae
FG
314 <protected>false</protected>
315 </image>
316 $ rbd info baz
317 rbd image 'baz':
11fdf7f2
TL
318 \tsize 2 GiB in 512 objects (esc)
319 \torder 22 (4 MiB objects) (esc)
320 \tsnapshot_count: 0 (esc)
321 \tid:* (glob)
7c673cae
FG
322 [^^]+ (re)
323 \tformat: 2 (esc)
324 \tfeatures: layering (esc)
11fdf7f2 325 \top_features: (esc)
7c673cae 326 \tflags: (esc)
31f18b77 327 \tcreate_timestamp:* (glob)
11fdf7f2
TL
328 \taccess_timestamp:* (glob)
329 \tmodify_timestamp:* (glob)
7c673cae
FG
330 $ rbd info baz --format json | python -mjson.tool | sed 's/,$/, /'
331 {
11fdf7f2 332 "access_timestamp": "*", (glob)
7c673cae 333 "block_name_prefix": "rbd_data.*", (glob)
31f18b77 334 "create_timestamp": "*", (glob)
7c673cae
FG
335 "features": [
336 "layering"
337 ],
338 "flags": [],
339 "format": 2,
11fdf7f2
TL
340 "id": "*", (glob)
341 "modify_timestamp": "*", (glob)
7c673cae
FG
342 "name": "baz",
343 "object_size": 4194304,
344 "objects": 512,
11fdf7f2 345 "op_features": [],
7c673cae 346 "order": 22,
11fdf7f2
TL
347 "size": 2147483648,
348 "snapshot_count": 0
7c673cae
FG
349 }
350 $ rbd info baz --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
351 <image>
352 <name>baz</name>
11fdf7f2 353 <id>*</id> (glob)
7c673cae
FG
354 <size>2147483648</size>
355 <objects>512</objects>
356 <order>22</order>
357 <object_size>4194304</object_size>
11fdf7f2 358 <snapshot_count>0</snapshot_count>
7c673cae
FG
359 <block_name_prefix>rbd_data.*</block_name_prefix> (glob)
360 <format>2</format>
361 <features>
362 <feature>layering</feature>
363 </features>
11fdf7f2 364 <op_features></op_features>
7c673cae 365 <flags></flags>
31f18b77 366 <create_timestamp>*</create_timestamp> (glob)
11fdf7f2
TL
367 <access_timestamp>*</access_timestamp> (glob)
368 <modify_timestamp>*</modify_timestamp> (glob)
7c673cae
FG
369 </image>
370 $ rbd info quux
371 rbd image 'quux':
11fdf7f2
TL
372 \tsize 1 MiB in 1 objects (esc)
373 \torder 22 (4 MiB objects) (esc)
374 \tsnapshot_count: 0 (esc)
7c673cae
FG
375 [^^]+ (re)
376 \tformat: 1 (esc)
377 $ rbd info quux --format json | python -mjson.tool | sed 's/,$/, /'
378 {
379 "block_name_prefix": "rb.0.*", (glob)
380 "format": 1,
11fdf7f2 381 "id": "",
7c673cae
FG
382 "name": "quux",
383 "object_size": 4194304,
384 "objects": 1,
385 "order": 22,
11fdf7f2
TL
386 "size": 1048576,
387 "snapshot_count": 0
7c673cae
FG
388 }
389 $ rbd info quux --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
390 <image>
391 <name>quux</name>
11fdf7f2 392 <id></id>
7c673cae
FG
393 <size>1048576</size>
394 <objects>1</objects>
395 <order>22</order>
396 <object_size>4194304</object_size>
11fdf7f2 397 <snapshot_count>0</snapshot_count>
7c673cae
FG
398 <block_name_prefix>rb.0.*</block_name_prefix> (glob)
399 <format>1</format>
400 </image>
401 $ rbd info rbd_other/child
402 rbd image 'child':
11fdf7f2
TL
403 \tsize 512 MiB in 128 objects (esc)
404 \torder 22 (4 MiB objects) (esc)
405 \tsnapshot_count: 1 (esc)
406 \tid:* (glob)
7c673cae
FG
407 [^^]+ (re)
408 \tformat: 2 (esc)
409 \tfeatures: layering, exclusive-lock, object-map, fast-diff (esc)
11fdf7f2 410 \top_features: (esc)
7c673cae 411 \tflags: (esc)
31f18b77 412 \tcreate_timestamp:* (glob)
11fdf7f2
TL
413 \taccess_timestamp:* (glob)
414 \tmodify_timestamp:* (glob)
7c673cae
FG
415 $ rbd info rbd_other/child --format json | python -mjson.tool | sed 's/,$/, /'
416 {
11fdf7f2 417 "access_timestamp": "*", (glob)
7c673cae 418 "block_name_prefix": "rbd_data.*", (glob)
31f18b77 419 "create_timestamp": "*", (glob)
7c673cae
FG
420 "features": [
421 "layering",
422 "exclusive-lock",
423 "object-map",
424 "fast-diff"
425 ],
426 "flags": [],
427 "format": 2,
11fdf7f2
TL
428 "id": "*", (glob)
429 "modify_timestamp": "*", (glob)
7c673cae
FG
430 "name": "child",
431 "object_size": 4194304,
432 "objects": 128,
11fdf7f2 433 "op_features": [],
7c673cae 434 "order": 22,
11fdf7f2
TL
435 "size": 536870912,
436 "snapshot_count": 1
7c673cae
FG
437 }
438 $ rbd info rbd_other/child --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
439 <image>
440 <name>child</name>
11fdf7f2 441 <id>*</id> (glob)
7c673cae
FG
442 <size>536870912</size>
443 <objects>128</objects>
444 <order>22</order>
445 <object_size>4194304</object_size>
11fdf7f2 446 <snapshot_count>1</snapshot_count>
7c673cae
FG
447 <block_name_prefix>rbd_data.*</block_name_prefix> (glob)
448 <format>2</format>
449 <features>
450 <feature>layering</feature>
451 <feature>exclusive-lock</feature>
452 <feature>object-map</feature>
453 <feature>fast-diff</feature>
454 </features>
11fdf7f2 455 <op_features></op_features>
7c673cae 456 <flags></flags>
31f18b77 457 <create_timestamp>*</create_timestamp> (glob)
11fdf7f2
TL
458 <access_timestamp>*</access_timestamp> (glob)
459 <modify_timestamp>*</modify_timestamp> (glob)
7c673cae
FG
460 </image>
461 $ rbd info rbd_other/child@snap
462 rbd image 'child':
11fdf7f2
TL
463 \tsize 512 MiB in 128 objects (esc)
464 \torder 22 (4 MiB objects) (esc)
465 \tsnapshot_count: 1 (esc)
466 \tid:* (glob)
7c673cae
FG
467 [^^]+ (re)
468 \tformat: 2 (esc)
469 \tfeatures: layering, exclusive-lock, object-map, fast-diff (esc)
11fdf7f2 470 \top_features: (esc)
7c673cae 471 \tflags: (esc)
31f18b77 472 \tcreate_timestamp:* (glob)
11fdf7f2
TL
473 \taccess_timestamp:* (glob)
474 \tmodify_timestamp:* (glob)
7c673cae
FG
475 \tprotected: False (esc)
476 \tparent: rbd/bar@snap (esc)
11fdf7f2 477 \toverlap: 512 MiB (esc)
7c673cae
FG
478 $ rbd info rbd_other/child@snap --format json | python -mjson.tool | sed 's/,$/, /'
479 {
11fdf7f2 480 "access_timestamp": "*", (glob)
7c673cae 481 "block_name_prefix": "rbd_data.*", (glob)
31f18b77 482 "create_timestamp": "*", (glob)
7c673cae
FG
483 "features": [
484 "layering",
485 "exclusive-lock",
486 "object-map",
487 "fast-diff"
488 ],
489 "flags": [],
490 "format": 2,
11fdf7f2
TL
491 "id": "*", (glob)
492 "modify_timestamp": "*", (glob)
7c673cae
FG
493 "name": "child",
494 "object_size": 4194304,
495 "objects": 128,
11fdf7f2 496 "op_features": [],
7c673cae
FG
497 "order": 22,
498 "parent": {
11fdf7f2 499 "id": "*", (glob)
7c673cae
FG
500 "image": "bar",
501 "overlap": 536870912,
502 "pool": "rbd",
11fdf7f2
TL
503 "pool_namespace": "",
504 "snapshot": "snap",
505 "trash": false
7c673cae
FG
506 },
507 "protected": "false",
11fdf7f2
TL
508 "size": 536870912,
509 "snapshot_count": 1
7c673cae
FG
510 }
511 $ rbd info rbd_other/child@snap --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
512 <image>
513 <name>child</name>
11fdf7f2 514 <id>*</id> (glob)
7c673cae
FG
515 <size>536870912</size>
516 <objects>128</objects>
517 <order>22</order>
518 <object_size>4194304</object_size>
11fdf7f2 519 <snapshot_count>1</snapshot_count>
7c673cae
FG
520 <block_name_prefix>rbd_data.*</block_name_prefix> (glob)
521 <format>2</format>
522 <features>
523 <feature>layering</feature>
524 <feature>exclusive-lock</feature>
525 <feature>object-map</feature>
526 <feature>fast-diff</feature>
527 </features>
11fdf7f2 528 <op_features></op_features>
7c673cae 529 <flags></flags>
31f18b77 530 <create_timestamp>*</create_timestamp> (glob)
11fdf7f2
TL
531 <access_timestamp>*</access_timestamp> (glob)
532 <modify_timestamp>*</modify_timestamp> (glob)
7c673cae
FG
533 <protected>false</protected>
534 <parent>
535 <pool>rbd</pool>
11fdf7f2 536 <pool_namespace></pool_namespace>
7c673cae 537 <image>bar</image>
11fdf7f2 538 <id>*</id> (glob)
7c673cae 539 <snapshot>snap</snapshot>
11fdf7f2 540 <trash>false</trash>
7c673cae
FG
541 <overlap>536870912</overlap>
542 </parent>
543 </image>
544 $ rbd info rbd_other/deep-flatten-child
545 rbd image 'deep-flatten-child':
11fdf7f2
TL
546 \tsize 512 MiB in 128 objects (esc)
547 \torder 22 (4 MiB objects) (esc)
548 \tsnapshot_count: 1 (esc)
549 \tid:* (glob)
7c673cae
FG
550 [^^]+ (re)
551 \tformat: 2 (esc)
552 \tfeatures: layering, exclusive-lock, object-map, fast-diff, deep-flatten (esc)
11fdf7f2 553 \top_features: (esc)
7c673cae 554 \tflags: (esc)
31f18b77 555 \tcreate_timestamp:* (glob)
11fdf7f2
TL
556 \taccess_timestamp:* (glob)
557 \tmodify_timestamp:* (glob)
7c673cae
FG
558 $ rbd info rbd_other/deep-flatten-child --format json | python -mjson.tool | sed 's/,$/, /'
559 {
11fdf7f2 560 "access_timestamp": "*", (glob)
7c673cae 561 "block_name_prefix": "rbd_data.*", (glob)
31f18b77 562 "create_timestamp": "*", (glob)
7c673cae
FG
563 "features": [
564 "layering",
565 "exclusive-lock",
566 "object-map",
567 "fast-diff",
568 "deep-flatten"
569 ],
570 "flags": [],
571 "format": 2,
11fdf7f2
TL
572 "id": "*", (glob)
573 "modify_timestamp": "*", (glob)
7c673cae
FG
574 "name": "deep-flatten-child",
575 "object_size": 4194304,
576 "objects": 128,
11fdf7f2 577 "op_features": [],
7c673cae 578 "order": 22,
11fdf7f2
TL
579 "size": 536870912,
580 "snapshot_count": 1
7c673cae
FG
581 }
582 $ rbd info rbd_other/deep-flatten-child --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
583 <image>
584 <name>deep-flatten-child</name>
11fdf7f2 585 <id>*</id> (glob)
7c673cae
FG
586 <size>536870912</size>
587 <objects>128</objects>
588 <order>22</order>
589 <object_size>4194304</object_size>
11fdf7f2 590 <snapshot_count>1</snapshot_count>
7c673cae
FG
591 <block_name_prefix>rbd_data.*</block_name_prefix> (glob)
592 <format>2</format>
593 <features>
594 <feature>layering</feature>
595 <feature>exclusive-lock</feature>
596 <feature>object-map</feature>
597 <feature>fast-diff</feature>
598 <feature>deep-flatten</feature>
599 </features>
11fdf7f2 600 <op_features></op_features>
7c673cae 601 <flags></flags>
31f18b77 602 <create_timestamp>*</create_timestamp> (glob)
11fdf7f2
TL
603 <access_timestamp>*</access_timestamp> (glob)
604 <modify_timestamp>*</modify_timestamp> (glob)
7c673cae
FG
605 </image>
606 $ rbd info rbd_other/deep-flatten-child@snap
607 rbd image 'deep-flatten-child':
11fdf7f2
TL
608 \tsize 512 MiB in 128 objects (esc)
609 \torder 22 (4 MiB objects) (esc)
610 \tsnapshot_count: 1 (esc)
611 \tid:* (glob)
7c673cae
FG
612 [^^]+ (re)
613 \tformat: 2 (esc)
614 \tfeatures: layering, exclusive-lock, object-map, fast-diff, deep-flatten (esc)
11fdf7f2 615 \top_features: (esc)
7c673cae 616 \tflags: (esc)
31f18b77 617 \tcreate_timestamp:* (glob)
11fdf7f2
TL
618 \taccess_timestamp:* (glob)
619 \tmodify_timestamp:* (glob)
7c673cae
FG
620 \tprotected: False (esc)
621 $ rbd info rbd_other/deep-flatten-child@snap --format json | python -mjson.tool | sed 's/,$/, /'
622 {
11fdf7f2 623 "access_timestamp": "*", (glob)
7c673cae 624 "block_name_prefix": "rbd_data.*", (glob)
31f18b77 625 "create_timestamp": "*", (glob)
7c673cae
FG
626 "features": [
627 "layering",
628 "exclusive-lock",
629 "object-map",
630 "fast-diff",
631 "deep-flatten"
632 ],
633 "flags": [],
634 "format": 2,
11fdf7f2
TL
635 "id": "*", (glob)
636 "modify_timestamp": "*", (glob)
7c673cae
FG
637 "name": "deep-flatten-child",
638 "object_size": 4194304,
639 "objects": 128,
11fdf7f2 640 "op_features": [],
7c673cae
FG
641 "order": 22,
642 "protected": "false",
11fdf7f2
TL
643 "size": 536870912,
644 "snapshot_count": 1
7c673cae
FG
645 }
646 $ rbd info rbd_other/deep-flatten-child@snap --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
647 <image>
648 <name>deep-flatten-child</name>
11fdf7f2 649 <id>*</id> (glob)
7c673cae
FG
650 <size>536870912</size>
651 <objects>128</objects>
652 <order>22</order>
653 <object_size>4194304</object_size>
11fdf7f2 654 <snapshot_count>1</snapshot_count>
7c673cae
FG
655 <block_name_prefix>rbd_data.*</block_name_prefix> (glob)
656 <format>2</format>
657 <features>
658 <feature>layering</feature>
659 <feature>exclusive-lock</feature>
660 <feature>object-map</feature>
661 <feature>fast-diff</feature>
662 <feature>deep-flatten</feature>
663 </features>
11fdf7f2 664 <op_features></op_features>
7c673cae 665 <flags></flags>
31f18b77 666 <create_timestamp>*</create_timestamp> (glob)
11fdf7f2
TL
667 <access_timestamp>*</access_timestamp> (glob)
668 <modify_timestamp>*</modify_timestamp> (glob)
7c673cae
FG
669 <protected>false</protected>
670 </image>
671 $ rbd list
672 foo
673 quux
674 bar
675 baz
676 quuy
677 $ rbd list --format json | python -mjson.tool | sed 's/,$/, /'
678 [
679 "foo",
680 "quux",
681 "bar",
682 "baz",
683 "quuy"
684 ]
685 $ rbd list --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
686 <images>
687 <name>foo</name>
688 <name>quux</name>
689 <name>bar</name>
690 <name>baz</name>
691 <name>quuy</name>
692 </images>
693 $ rbd list -l
11fdf7f2
TL
694 NAME SIZE PARENT FMT PROT LOCK
695 foo 1 GiB 1
696 foo@snap 1 GiB 1
697 quux 1 MiB 1 excl
698 bar 1 GiB 2
699 bar@snap 512 MiB 2 yes
700 bar@snap2 1 GiB 2
701 baz 2 GiB 2 shr
702 quuy 2 GiB 2
7c673cae
FG
703 $ rbd list -l --format json | python -mjson.tool | sed 's/,$/, /'
704 [
705 {
706 "format": 1,
707 "image": "foo",
708 "size": 1073741824
709 },
710 {
711 "format": 1,
712 "image": "foo",
713 "protected": "false",
714 "size": 1073741824,
715 "snapshot": "snap"
716 },
717 {
718 "format": 1,
719 "image": "quux",
720 "lock_type": "exclusive",
721 "size": 1048576
722 },
723 {
724 "format": 2,
725 "image": "bar",
726 "size": 1073741824
727 },
728 {
729 "format": 2,
730 "image": "bar",
731 "protected": "true",
732 "size": 536870912,
733 "snapshot": "snap"
734 },
735 {
736 "format": 2,
737 "image": "bar",
738 "protected": "false",
739 "size": 1073741824,
740 "snapshot": "snap2"
741 },
742 {
743 "format": 2,
744 "image": "baz",
745 "lock_type": "shared",
746 "size": 2147483648
747 },
748 {
749 "format": 2,
750 "image": "quuy",
751 "size": 2147483648
752 }
753 ]
754 $ rbd list -l --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
755 <images>
756 <image>
757 <image>foo</image>
758 <size>1073741824</size>
759 <format>1</format>
760 </image>
761 <snapshot>
762 <image>foo</image>
763 <snapshot>snap</snapshot>
764 <size>1073741824</size>
765 <format>1</format>
766 <protected>false</protected>
767 </snapshot>
768 <image>
769 <image>quux</image>
770 <size>1048576</size>
771 <format>1</format>
772 <lock_type>exclusive</lock_type>
773 </image>
774 <image>
775 <image>bar</image>
776 <size>1073741824</size>
777 <format>2</format>
778 </image>
779 <snapshot>
780 <image>bar</image>
781 <snapshot>snap</snapshot>
782 <size>536870912</size>
783 <format>2</format>
784 <protected>true</protected>
785 </snapshot>
786 <snapshot>
787 <image>bar</image>
788 <snapshot>snap2</snapshot>
789 <size>1073741824</size>
790 <format>2</format>
791 <protected>false</protected>
792 </snapshot>
793 <image>
794 <image>baz</image>
795 <size>2147483648</size>
796 <format>2</format>
797 <lock_type>shared</lock_type>
798 </image>
799 <image>
800 <image>quuy</image>
801 <size>2147483648</size>
802 <format>2</format>
803 </image>
804 </images>
805 $ rbd list rbd_other
806 child
807 deep-flatten-child
808 $ rbd list rbd_other --format json | python -mjson.tool | sed 's/,$/, /'
809 [
810 "child",
811 "deep-flatten-child"
812 ]
813 $ rbd list rbd_other --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
814 <images>
815 <name>child</name>
816 <name>deep-flatten-child</name>
817 </images>
818 $ rbd list rbd_other -l
11fdf7f2
TL
819 NAME SIZE PARENT FMT PROT LOCK
820 child 512 MiB 2
821 child@snap 512 MiB rbd/bar@snap 2
822 deep-flatten-child 512 MiB 2
823 deep-flatten-child@snap 512 MiB 2
7c673cae
FG
824 $ rbd list rbd_other -l --format json | python -mjson.tool | sed 's/,$/, /'
825 [
826 {
827 "format": 2,
828 "image": "child",
829 "size": 536870912
830 },
831 {
832 "format": 2,
833 "image": "child",
834 "parent": {
835 "image": "bar",
836 "pool": "rbd",
11fdf7f2 837 "pool_namespace": "",
7c673cae
FG
838 "snapshot": "snap"
839 },
840 "protected": "false",
841 "size": 536870912,
842 "snapshot": "snap"
843 },
844 {
845 "format": 2,
846 "image": "deep-flatten-child",
847 "size": 536870912
848 },
849 {
850 "format": 2,
851 "image": "deep-flatten-child",
852 "protected": "false",
853 "size": 536870912,
854 "snapshot": "snap"
855 }
856 ]
857 $ rbd list rbd_other -l --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
858 <images>
859 <image>
860 <image>child</image>
861 <size>536870912</size>
862 <format>2</format>
863 </image>
864 <snapshot>
865 <image>child</image>
866 <snapshot>snap</snapshot>
867 <size>536870912</size>
868 <parent>
869 <pool>rbd</pool>
11fdf7f2 870 <pool_namespace></pool_namespace>
7c673cae
FG
871 <image>bar</image>
872 <snapshot>snap</snapshot>
873 </parent>
874 <format>2</format>
875 <protected>false</protected>
876 </snapshot>
877 <image>
878 <image>deep-flatten-child</image>
879 <size>536870912</size>
880 <format>2</format>
881 </image>
882 <snapshot>
883 <image>deep-flatten-child</image>
884 <snapshot>snap</snapshot>
885 <size>536870912</size>
886 <format>2</format>
887 <protected>false</protected>
888 </snapshot>
889 </images>
890 $ rbd lock list foo
891 $ rbd lock list foo --format json | python -mjson.tool | sed 's/,$/, /'
11fdf7f2 892 []
7c673cae
FG
893 $ rbd lock list foo --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
894 <locks></locks>
895 $ rbd lock list quux
896 There is 1 exclusive lock on this image.
897 Locker*ID*Address* (glob)
898 client.* id * (glob)
899 $ rbd lock list quux --format json | python -mjson.tool | sed 's/,$/, /'
11fdf7f2
TL
900 [
901 {
7c673cae 902 "address": "*", (glob)
11fdf7f2 903 "id": "id",
7c673cae
FG
904 "locker": "client.*" (glob)
905 }
11fdf7f2 906 ]
7c673cae
FG
907 $ rbd lock list quux --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
908 <locks>
11fdf7f2
TL
909 <lock>
910 <id>id</id>
7c673cae
FG
911 <locker>client.*</locker> (glob)
912 <address>*</address> (glob)
11fdf7f2 913 </lock>
7c673cae
FG
914 </locks>
915 $ rbd lock list baz
916 There are 3 shared locks on this image.
917 Lock tag: tag
918 Locker*ID*Address* (glob)
919 client.*id[123].* (re)
920 client.*id[123].* (re)
921 client.*id[123].* (re)
922 $ rbd lock list baz --format json | python -mjson.tool | sed 's/,$/, /'
11fdf7f2
TL
923 [
924 {
7c673cae 925 "address": "*", (glob)
11fdf7f2 926 "id": "id*", (glob)
7c673cae
FG
927 "locker": "client.*" (glob)
928 },
11fdf7f2 929 {
7c673cae 930 "address": "*", (glob)
11fdf7f2 931 "id": "id*", (glob)
7c673cae
FG
932 "locker": "client.*" (glob)
933 },
11fdf7f2 934 {
7c673cae 935 "address": "*", (glob)
11fdf7f2 936 "id": "id*", (glob)
7c673cae
FG
937 "locker": "client.*" (glob)
938 }
11fdf7f2 939 ]
7c673cae
FG
940 $ rbd lock list baz --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
941 <locks>
11fdf7f2
TL
942 <lock>
943 <id>id*</id> (glob)
7c673cae
FG
944 <locker>client.*</locker> (glob)
945 <address>*</address> (glob)
11fdf7f2
TL
946 </lock>
947 <lock>
948 <id>id*</id> (glob)
7c673cae
FG
949 <locker>client.*</locker> (glob)
950 <address>*</address> (glob)
11fdf7f2
TL
951 </lock>
952 <lock>
953 <id>id*</id> (glob)
7c673cae
FG
954 <locker>client.*</locker> (glob)
955 <address>*</address> (glob)
11fdf7f2 956 </lock>
7c673cae
FG
957 </locks>
958 $ rbd snap list foo
11fdf7f2
TL
959 SNAPID*NAME*SIZE*PROTECTED*TIMESTAMP* (glob)
960 *snap*1 GiB* (glob)
7c673cae
FG
961 $ rbd snap list foo --format json | python -mjson.tool | sed 's/,$/, /'
962 [
963 {
964 "id": *, (glob)
965 "name": "snap",
11fdf7f2 966 "protected": "false",
7c673cae
FG
967 "size": 1073741824,
968 "timestamp": ""
969 }
970 ]
971 $ rbd snap list foo --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
972 <snapshots>
973 <snapshot>
974 <id>*</id> (glob)
975 <name>snap</name>
976 <size>1073741824</size>
11fdf7f2 977 <protected>false</protected>
7c673cae
FG
978 <timestamp></timestamp>
979 </snapshot>
980 </snapshots>
981 $ rbd snap list bar
11fdf7f2
TL
982 SNAPID*NAME*SIZE*PROTECTED*TIMESTAMP* (glob)
983 *snap*512 MiB*yes* (glob)
984 *snap2*1 GiB* (glob)
7c673cae
FG
985 $ rbd snap list bar --format json | python -mjson.tool | sed 's/,$/, /'
986 [
987 {
988 "id": *, (glob)
989 "name": "snap",
11fdf7f2 990 "protected": "true",
7c673cae
FG
991 "size": 536870912,
992 "timestamp": * (glob)
993 },
994 {
995 "id": *, (glob)
996 "name": "snap2",
11fdf7f2 997 "protected": "false",
7c673cae
FG
998 "size": 1073741824,
999 "timestamp": * (glob)
1000 }
1001 ]
1002 $ rbd snap list bar --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
1003 <snapshots>
1004 <snapshot>
1005 <id>*</id> (glob)
1006 <name>snap</name>
1007 <size>536870912</size>
11fdf7f2 1008 <protected>true</protected>
7c673cae
FG
1009 <timestamp>*</timestamp> (glob)
1010 </snapshot>
1011 <snapshot>
1012 <id>*</id> (glob)
1013 <name>snap2</name>
1014 <size>1073741824</size>
11fdf7f2 1015 <protected>false</protected>
7c673cae
FG
1016 <timestamp>*</timestamp> (glob)
1017 </snapshot>
1018 </snapshots>
1019 $ rbd snap list baz
1020 $ rbd snap list baz --format json | python -mjson.tool | sed 's/,$/, /'
1021 []
1022 $ rbd snap list baz --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
1023 <snapshots></snapshots>
1024 $ rbd snap list rbd_other/child
11fdf7f2
TL
1025 SNAPID*NAME*SIZE*PROTECTED*TIMESTAMP* (glob)
1026 *snap*512 MiB* (glob)
7c673cae
FG
1027 $ rbd snap list rbd_other/child --format json | python -mjson.tool | sed 's/,$/, /'
1028 [
1029 {
1030 "id": *, (glob)
1031 "name": "snap",
11fdf7f2 1032 "protected": "false",
7c673cae
FG
1033 "size": 536870912,
1034 "timestamp": * (glob)
1035 }
1036 ]
1037 $ rbd snap list rbd_other/child --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
1038 <snapshots>
1039 <snapshot>
1040 <id>*</id> (glob)
1041 <name>snap</name>
1042 <size>536870912</size>
11fdf7f2 1043 <protected>false</protected>
7c673cae
FG
1044 <timestamp>*</timestamp> (glob)
1045 </snapshot>
1046 </snapshots>
1047 $ rbd disk-usage --pool rbd_other 2>/dev/null
11fdf7f2
TL
1048 NAME PROVISIONED USED
1049 child@snap 512 MiB 0 B
1050 child 512 MiB 4 MiB
1051 deep-flatten-child@snap 512 MiB 0 B
1052 deep-flatten-child 512 MiB 0 B
1053 <TOTAL> 1 GiB 4 MiB
7c673cae
FG
1054 $ rbd disk-usage --pool rbd_other --format json | python -mjson.tool | sed 's/,$/, /'
1055 {
1056 "images": [
1057 {
1058 "name": "child",
1059 "provisioned_size": 536870912,
1060 "snapshot": "snap",
1061 "used_size": 0
1062 },
1063 {
1064 "name": "child",
1065 "provisioned_size": 536870912,
1066 "used_size": 4194304
1067 },
1068 {
1069 "name": "deep-flatten-child",
1070 "provisioned_size": 536870912,
1071 "snapshot": "snap",
1072 "used_size": 0
1073 },
1074 {
1075 "name": "deep-flatten-child",
1076 "provisioned_size": 536870912,
1077 "used_size": 0
1078 }
1079 ],
1080 "total_provisioned_size": 1073741824,
1081 "total_used_size": 4194304
1082 }
1083 $ rbd disk-usage --pool rbd_other --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
1084 <stats>
1085 <images>
1086 <image>
1087 <name>child</name>
1088 <snapshot>snap</snapshot>
1089 <provisioned_size>536870912</provisioned_size>
1090 <used_size>0</used_size>
1091 </image>
1092 <image>
1093 <name>child</name>
1094 <provisioned_size>536870912</provisioned_size>
1095 <used_size>4194304</used_size>
1096 </image>
1097 <image>
1098 <name>deep-flatten-child</name>
1099 <snapshot>snap</snapshot>
1100 <provisioned_size>536870912</provisioned_size>
1101 <used_size>0</used_size>
1102 </image>
1103 <image>
1104 <name>deep-flatten-child</name>
1105 <provisioned_size>536870912</provisioned_size>
1106 <used_size>0</used_size>
1107 </image>
1108 </images>
1109 <total_provisioned_size>1073741824</total_provisioned_size>
1110 <total_used_size>4194304</total_used_size>
1111 </stats>
1112
1113# cleanup
1114 $ rbd snap remove --no-progress rbd_other/deep-flatten-child@snap
1115 $ rbd snap remove --no-progress rbd_other/child@snap
1116 $ rbd snap unprotect bar@snap
1117 $ rbd snap purge bar 2> /dev/null
1118 $ rbd snap purge foo 2> /dev/null
1119 $ rbd rm rbd_other/deep-flatten-child 2> /dev/null
1120 $ rbd rm rbd_other/child 2> /dev/null
1121 $ rbd rm foo 2> /dev/null
1122 $ rbd rm bar 2> /dev/null
1123 $ rbd rm quux 2> /dev/null
1124 $ rbd rm quuy 2> /dev/null
1125 $ rbd rm baz 2> /dev/null
1126 $ ceph osd pool delete rbd_other rbd_other --yes-i-really-really-mean-it
1127 pool 'rbd_other' removed