Statistics
| Branch: | Tag: | Revision:

root / docs / examplesdir / listing.rst @ abfaa6d9

History | View | Annotate | Download (18.9 kB)

1
Listing
2
=======
3

    
4
In this section we present the ways of kamaki for listing, an operation that is
5
common to most command groups.
6

    
7
The examples of this section run in a kamaki interactive shell.
8

    
9
.. code-block:: console
10

    
11
    $ kamaki
12
    kamaki v0.9 - Interactive Shell
13
    .
14
    /exit       terminate kamaki
15
    exit or ^D  exit context
16
    ? or help   available commands
17
    ?command    help on command
18
    !<command>  execute OS shell command
19
    .
20
    [kamaki]:
21

    
22
Simple listing
23
--------------
24

    
25
List configuration options, whether in the file or in memory
26

    
27
.. code-block:: console
28

    
29
    [kamaki]: config list
30
    cloud.default.url = https://astakos.example.com/identity/v2.0/
31
    cloud.default.token = my70k3n==
32
    global.default_cloud = default
33
    global.colors = on
34
    global.config_cli = config
35
    global.file_cli = pithos
36
    global.flavor_cli = cyclades
37
    global.history_cli = history
38
    global.history_file = /home/saxtouri/.kamaki.history
39
    global.image_cli = image
40
    global.log_file = /home/saxtouri/.kamaki.log
41
    global.log_token = one
42
    global.max_threads = 5
43
    global.network_cli = cyclades
44
    global.server_cli = cyclades
45
    global.user_cli = astakos
46
    [kamaki]:
47

    
48
List stored containers and then objects in container "pithos"
49

    
50
.. code-block:: console
51

    
52
    [kamaki]: file list
53
    pithos (36MB, 4 objects)
54
    trash (0B, 0 objects)
55
    [kamaki]: file list pithos
56
    . 2KB  info.txt
57
    . D    video/
58
    . 11MB video/tk1.mpg
59
    . 12MB video/tk2.mpg
60
    . 13MB video/tk3.mpg
61
    [kamaki]:
62

    
63
List virtual machines (servers)
64

    
65
.. code-block:: console
66

    
67
    [kamaki]: server list
68
    4201 example server 1
69
    4202 example server 2
70
    4203 example server 3
71
    4204 example server 4
72
    4205 example server 5
73
    4206 example server 6
74

    
75
List networks
76

    
77
.. code-block:: console
78

    
79
    [kamaki]: network list
80
    1 public_network
81
    42 my_private)network
82
    [kamaki]:
83

    
84
List flavors
85

    
86
.. code-block:: console
87

    
88
    [kamaki]: flavor list
89
    1 C1R1024D20drbd
90
    2 C1R1024D30drbd
91
    [kamaki]:
92

    
93
List images from Image API and from Compute APIs
94

    
95
.. code-block:: console
96

    
97
    [kamaki]: image list
98
    f1r57-1m4g3-1d Debian Base Alpha
99
    .container_format: bare
100
    .disk_format:      diskdump
101
    .size:             474066944
102
    .status:           available
103
    53c0nd-1m4g3-1d Beta Debian Base
104
    .container_format: bare
105
    .disk_format:      diskdump
106
    .size:             474066944
107
    .status:           available
108
    [kamaki]: image compute list
109
    f1r57-1m4g3-1d Debian Base Alpha
110
    53c0nd-1m4g3-1d Beta Debian Base
111
    [kamaki]:
112

    
113
Detailed pithos listing
114
-----------------------
115

    
116
Enter contect
117

    
118
.. code-block:: console
119

    
120
    [kamaki]: file
121
    [file]:
122

    
123
List pithos containers with details
124

    
125
.. code-block:: console
126

    
127
    [file]: list -l
128
    pithos
129
    bytes:    0 (0B)
130
    count:    3
131
    modified: 2013-06-17T12:35:11.613124+00:00
132
    policy:
133
    .       quota:      0
134
    .       versioning: auto
135
    trash
136
    bytes:    0 (0B)
137
    count:    0
138
    modified: 2013-06-06T14:24:23.675891+00:00
139
    policy:
140
    .       quota:      0
141
    .       versioning: auto
142
    [file]:
143

    
144
Create some more pithos container to experiment with
145

    
146
.. code-block:: console
147

    
148
    [file]: create cont1
149
    [file]: create cont2
150
    [file]: create cont3
151
    [file]: create cont4
152
    [file]: list
153
    cont1 (0B, 0 objects)
154
    cont2 (0B, 0 objects)
155
    cont3 (0B, 0 objects)
156
    cont4 (0B, 0 objects)
157
    pithos (36B, 5 objects)
158
    trash (0B, 0 objects)
159
    [file]:
160

    
161
List only 3, then list three by three
162

    
163
.. code-block:: console
164

    
165
    [file]: list -n 3
166
    cont1 (0B, 0 objects)
167
    cont2 (0B, 0 objects)
168
    cont3 (0B, 0 objects)
169
    [file]: list -n 3 --more
170
    cont1 (0B, 0 objects)
171
    cont2 (0B, 0 objects)
172
    cont3 (0B, 0 objects)
173
    (3 listed - 3 more - "enter" to continue)
174
    <enter is pressed>
175
    cont4 (0B, 0 objects)
176
    pithos (36B, 4 objects)
177
    trash (0B, 0 objects)
178
    [file]:
179

    
180
List contents of container `pithos`
181

    
182
.. code-block:: console
183

    
184
    [file]: list -l pithos
185
    info.txt
186
    by:        s0m3-u53r-1d
187
    bytes:     2000 (2ΚB)
188
    hash:      427ae41e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92
189
    modified:  2013-06-17T13:09:44.529579+00:00
190
    timestamp: 1371474584.5295789
191
    type:      plan-text/unicode
192
    uuid:      0493f1d9-9410-4f4b-a81f-fe42f9cefa70
193
    version:   1085
194
    .
195
    video
196
    by:        s0m3-u53r-1d
197
    bytes:     0
198
    hash:      e3b0c44298fc1c149afbf44ca495991b7852b855c8996fb92427ae41e4649b93
199
    modified:  2013-06-17T13:11:39.050090+00:00
200
    timestamp: 1371474699.0500901
201
    type:      application/directory
202
    uuid:      80e719f5-9d68-4333-9846-9943972ef1fd
203
    version:   1086
204
    .
205
    video/tk1.mpg
206
    by:        s0m3-u53r-1d
207
    bytes:     11000000 (11ΜΒB)
208
    hash:      fbf4c8996fb92427ae41e464e3b0c44298fc1c5991b7852b855149a9b934ca49
209
    modified:  2013-06-17T13:09:15.866515+00:00
210
    timestamp: 1371474555.8665149
211
    type:      video/mpeg
212
    uuid:      b0b46b39-c59a-4adc-a386-6a169cb9f8a5
213
    version:   1079
214
    .
215
    video/tk2.mpg
216
    by:        s0m3-u53r-1d
217
    bytes:     12000000 (12MB)
218
    hash:      44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b78e3b0c52b855
219
    modified:  2013-06-17T13:09:23.898652+00:00
220
    timestamp: 1371474563.8986521
221
    type:      video/mpeg
222
    uuid:      12a81309-db3c-4e30-ae9a-4ac2b8289def
223
    version:   1081
224
    .
225
    video/tk3.mpg
226
    by:        s0m3-u53r-1d
227
    bytes:     13000000 (13MB)
228
    hash:      1e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92427ae4
229
    modified:  2013-06-17T13:09:28.222536+00:00
230
    timestamp: 1371474568.2225361
231
    type:      video/mpeg
232
    uuid:      4195e8c3-9b9a-4e97-8c20-fdfef34892fe
233
    version:   1083
234
    [kamaki]:
235

    
236
List only objects starting with "video" and exit "file" context
237

    
238
.. code-block:: console
239

    
240
    [file]: list -l pithos:video/
241
    video/tk1.mpg
242
    by:        s0m3-u53r-1d
243
    bytes:     11000000 (11ΜΒB)
244
    hash:      fbf4c8996fb92427ae41e464e3b0c44298fc1c5991b7852b855149a9b934ca49
245
    modified:  2013-06-17T13:09:15.866515+00:00
246
    timestamp: 1371474555.8665149
247
    type:      video/mpeg
248
    uuid:      b0b46b39-c59a-4adc-a386-6a169cb9f8a5
249
    version:   1079
250
    .
251
    video/tk2.mpg
252
    by:        s0m3-u53r-1d
253
    bytes:     12000000 (12MB)
254
    hash:      44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b78e3b0c52b855
255
    modified:  2013-06-17T13:09:23.898652+00:00
256
    timestamp: 1371474563.8986521
257
    type:      video/mpeg
258
    uuid:      12a81309-db3c-4e30-ae9a-4ac2b8289def
259
    version:   1081
260
    .
261
    video/tk3.mpg
262
    by:        s0m3-u53r-1d
263
    bytes:     13000000 (13MB)
264
    hash:      1e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92427ae4
265
    modified:  2013-06-17T13:09:28.222536+00:00
266
    timestamp: 1371474568.2225361
267
    type:      video/mpeg
268
    uuid:      4195e8c3-9b9a-4e97-8c20-fdfef34892fe
269
    version:   1083
270

    
271

    
272
Exit context
273

    
274
.. code-block:: console
275

    
276
    [file]: exit
277
    [kamaki]:
278

    
279
Detailed Server Listing
280
-----------------------
281

    
282
Enter context
283

    
284
.. code-block:: console
285

    
286
    [kamaki]: server
287
    [server]:
288

    
289
List only 3, then list three by three, all with enumeration
290

    
291
.. code-block:: console
292

    
293
    [server]: list -n 3 --enumerate
294
    1. 4201 example server 1
295
    2. 4202 example server 2
296
    3. 4203 example server 3
297
    4. 4204 example server 4
298
    5. 4205 example server 5
299
    6. 4206 example server 6
300
    [server]: list -n 3 --more --enumerate
301
    1. 4201 example server 1
302
    2. 4202 example server 2
303
    3. 4203 example server 3
304
    (3 listed - 3 more - "enter" to continue)
305
    <press "enter">
306
    4. 4204 example server 4
307
    5. 4205 example server 5
308
    6. 4206 example server 6
309
    [server]:
310

    
311
Get json output returned by the compute API server (only first two VMs)
312

    
313
.. code-block:: console
314

    
315
    [server]: list -j -n 2
316
    [
317
        {
318
            "name": "example server 1",
319
            "links": [
320
              {
321
                "href": "https://example.com/compute/v2.0/servers/4201",
322
                "rel": "self"
323
              },
324
              {
325
                "href": "https://example.com/compute/v2.0/servers/4201",
326
                "rel": "bookmark"
327
              }
328
            ],
329
            "id": 4201
330
          },
331
          {
332
            "name": "example server 2",
333
            "links": [
334
              {
335
                "href": "https://example.com/compute/v2.0/servers/4202",
336
                "rel": "self"
337
              },
338
              {
339
                "href": "https://example.com/compute/v2.0/servers/4202",
340
                "rel": "bookmark"
341
              }
342
            ],
343
            "id": 4202
344
          }
345
    ]
346
    [server]:
347

    
348
Server details (first two only)
349

    
350
.. code-block:: console
351

    
352
    [server]: list -l -n 2
353
    4201 my example server 1
354
        accessIPv4:
355
        accessIPv6:
356
        addresses:
357
                    42:
358
                           OS-EXT-IPS:type: fixed
359
                           addr:            192.168.12.4
360
                           version:         4
361
                        . . . . . . .
362
                           OS-EXT-IPS:type: fixed
363
                           addr:            2001:648:2ffc:1222:a800:2ff:fee3:49f1
364
                           version:         6
365
        attachments:
366
                       firewallProfile: DISABLED
367
                       id:              nic-37231-0
368
                       ipv4:            192.168.12.4
369
                       ipv6:            2001:648:2ffc:1222:a800:2ff:fee3:49f1
370
                       mac_address:     aa:00:02:e3:49:f8
371
                       network_id:      4161
372
        config_drive:
373
        created:         2013-05-11T18:03:41.471605+00:00
374
        diagnostics:
375
                       created:     2013-05-11T18:04:23.298132+00:00
376
                       details:     None
377
                       level:       DEBUG
378
                       message:     Image customization finished successfully.
379
                       source:      image-info
380
                       source_date: 2013-05-11T18:04:23.286869+00:00
381
        flavor:
382
                    id:    1
383
                    links:
384
                            href: https://example.com/compute/v2.0/flavors/1
385
                            rel:  bookmark
386
                         . . . . . . .
387
                            href: https://example.com/compute/v2.0/flavors/1
388
                            rel:  self
389
        hostId:
390
        image:
391
                    id:    f1r57-1m4g3-1d
392
                    links:
393
                            href: https://example.com/compute/v2.0/images/f1r57-1m4g3-1d
394
                            rel:  bookmark
395
                         . . . . . . .
396
                            href: https://example.com/compute/v2.0/images/f1r57-1m4g3-1d
397
                            rel:  self
398
                         . . . . . . .
399
                            href: https:/example.com/image/v1.0/images/f1r57-1m4g3-1d
400
                            rel:  alternate
401
        key_name:        None
402
        links:
403
                       href: https://example.com/compute/v2.0/servers/4201
404
                       rel:  bookmark
405
                    . . . . . . .
406
                       href: https://example.com/compute/v2.0/servers/4201
407
                       rel:  self
408
        metadata:
409
                    os:    ubuntu
410
                    users: user
411
        progress:        100
412
        security_groups:
413
                       name: default
414
        status:          ACTIVE
415
        suspended:       False
416
        tenant_id:       s0m3-u53r-1d
417
        updated:         2013-06-17T07:57:50.054550+00:00
418
        user_id:         s0m3-u53r-1d
419
    4202 my example server 2
420
        accessIPv4:
421
        accessIPv6:
422
        addresses:
423
                    42:
424
                           OS-EXT-IPS:type: fixed
425
                           addr:            192.168.12.4
426
                           version:         4
427
                        . . . . . . .
428
                           OS-EXT-IPS:type: fixed
429
                           addr:            2002:648:2ffc:1222:a800:2ff:fee3:49f1
430
                           version:         6
431
        attachments:
432
                       firewallProfile: DISABLED
433
                       id:              nic-37231-0
434
                       ipv4:            192.168.12.4
435
                       ipv6:            2002:648:2ffc:1222:a800:2ff:fee3:49f1
436
                       mac_address:     aa:00:02:e3:49:f8
437
                       network_id:      42
438
        config_drive:
439
        created:         2013-05-11T18:03:41.471605+00:00
440
        diagnostics:
441
                       created:     2013-05-11T18:04:23.298132+00:00
442
                       details:     None
443
                       level:       DEBUG
444
                       message:     Image customization finished successfully.
445
                       source:      image-info
446
                       source_date: 2013-05-11T18:04:23.286869+00:00
447
        flavor:
448
                    id:    2
449
                    links:
450
                            href: https://example.com/compute/v2.0/flavors/2
451
                            rel:  bookmark
452
                         . . . . . . .
453
                            href: https://example.com/compute/v2.0/flavors/2
454
                            rel:  self
455
        hostId:
456
        image:
457
                    id:    53c0nd-1m4g3-1d
458
                    links:
459
                            href: https://example.com/compute/v2.0/images/53c0nd-1m4g3-1d
460
                            rel:  bookmark
461
                         . . . . . . .
462
                            href: https://example.com/compute/v2.0/images/53c0nd-1m4g3-1d
463
                            rel:  self
464
                         . . . . . . .
465
                            href: https:/example.com/image/v1.0/images/53c0nd-1m4g3-1d
466
                            rel:  alternate
467
        key_name:        None
468
        links:
469
                       href: https://example.com/compute/v2.0/servers/4202
470
                       rel:  bookmark
471
                    . . . . . . .
472
                       href: https://example.com/compute/v2.0/servers/4202
473
                       rel:  self
474
        metadata:
475
                    os:    ubuntu
476
                    users: user
477
        progress:        100
478
        security_groups:
479
                       name: default
480
        status:          ACTIVE
481
        suspended:       False
482
        tenant_id:       s0m3-u53r-1d
483
        updated:         2013-06-17T07:57:50.054550+00:00
484
        user_id:         s0m3-u53r-1d
485
    [server]:
486

    
487
Exit context
488

    
489
.. code-block:: console
490

    
491
    [server]: exit
492
    [kamaki]:
493

    
494
.. note:: `network` and `flavor list` behave in the same way as `server list`
495

    
496
Detailed image listing
497
----------------------
498

    
499
Enter context
500

    
501
.. code-block:: console
502

    
503
    [kamaki]: image
504
    [image]:
505

    
506
Detailed listing
507

    
508
.. code-block:: console
509

    
510
    [image]: list -l
511
    f1r57-1m4g3-1d Debian Base Alpha
512
        checksum:         9344d77620cde1dd77da...7b70badda34b26d782
513
        container_format: bare
514
        created_at:       2013-06-03 16:44:16
515
        deleted_at:
516
        disk_format:      diskdump
517
        is_public:        True
518
        location:         pithos://s0m3-5up3r-u53r-1d/pithos/debian_base1.diskdump
519
        owner:            s0m3-5up3r-u53r-1d
520
        properties:
521
                    description:    Debian 6.0.6 (Squeeze) Base System
522
                    gui:            No GUI
523
                    kernel:         2.6.32
524
                    os:             debian
525
                    osfamily:       linux
526
                    root_partition: 1
527
                    sortorder:      1
528
                    users:          root
529
        size:             474066944
530
        status:           available
531
        updated_at:       2013-06-03 16:44:16
532
    53c0nd-1m4g3-1d Beta Debian Base
533
        checksum:         9344d77620cde1dd77da...7b70badda34b26d782
534
        container_format: bare
535
        created_at:       2013-06-03 16:44:16
536
        deleted_at:
537
        disk_format:      diskdump
538
        is_public:        True
539
        location:         pithos://s0m3-5up3r-u53r-1d/pithos/debian_base2.diskdump
540
        owner:            s0m3-5up3r-u53r-1d
541
        properties:
542
                    description:    Debian 6.0.6 (Squeeze) Base System
543
                    gui:            No GUI
544
                    kernel:         2.6.32
545
                    os:             debian
546
                    osfamily:       linux
547
                    root_partition: 1
548
                    sortorder:      1
549
                    users:          root
550
        size:             474066944
551
        status:           available
552
        updated_at:       2013-06-03 16:44:16
553
    [image]: compute list
554
    f1r57-1m4g3-1d Debian Base Alpha
555
        created:   2013-06-03T16:21:53+00:00
556
        links:
557
             href: https://example.com/cyclades/compute/v2.0/images/f1r57-1m4g3-1d
558
             rel:  bookmark
559
          . . . . . . .
560
             href: https://example.com/cyclades/compute/v2.0/images/f1r57-1m4g3-1d
561
             rel:  self
562
          . . . . . . .
563
             href: https://example.com/cyclades/image/v1.0/images/f1r57-1m4g3-1d
564
             rel:  alternate
565
        metadata:
566
          description:    Debian 6.0.6 (Squeeze) Base System
567
          gui:            No GUI
568
          kernel:         2.6.32
569
          os:             debian
570
          osfamily:       linux
571
          root_partition: 1
572
          sortorder:      1
573
          users:          root
574
        progress:  100
575
        status:    ACTIVE
576
        tenant_id: s0m3-5up3r-u53r-1d
577
        updated:   2013-06-03T16:21:53+00:00
578
        user_id:   s0m3-5up3r-u53r-1d
579
    53c0nd-1m4g3-1d Beta Debian Base
580
        created:   2013-06-03T16:21:53+00:00
581
        links:
582
             href: https://example.com/cyclades/compute/v2.0/images/53c0nd-1m4g3-1d
583
             rel:  bookmark
584
          . . . . . . .
585
             href: https://example.com/cyclades/compute/v2.0/images/53c0nd-1m4g3-1d
586
             rel:  self
587
          . . . . . . .
588
             href: https://example.com/cyclades/image/v1.0/images/53c0nd-1m4g3-1d
589
             rel:  alternate
590
        metadata:
591
          description:    Debian 6.0.6 (Squeeze) Base System
592
          gui:            No GUI
593
          kernel:         2.6.32
594
          os:             debian
595
          osfamily:       linux
596
          root_partition: 1
597
          sortorder:      1
598
          users:          root
599
        progress:  100
600
        status:    ACTIVE
601
        tenant_id: s0m3-5up3r-u53r-1d
602
        updated:   2013-06-03T16:21:53+00:00
603
        user_id:   s0m3-5up3r-u53r-1d
604
    [image]:
605

    
606
Filter listing by prefix, suffix or words in image names
607

    
608
.. code-block:: console
609

    
610
    [image]: list --name-prefix=Debian
611
    f1r57-1m4g3-1d Debian Base Alpha
612
    [image]: list --name-suffix=Base
613
    53c0nd-1m4g3-1d Beta Debian Base
614
    [image]: list --name-like=Alpha
615
    f1r57-1m4g3-1d Debian Base Alpha
616
    [image]: list --name-like=Beta
617
    53c0nd-1m4g3-1d Beta Debian Base
618
    [image]: list --name-like="Debian Base"
619
    f1r57-1m4g3-1d Debian Base Alpha
620
    53c0nd-1m4g3-1d Beta Debian Base
621
    [image]:
622

    
623
Filter by owner and container format
624

    
625
.. code-block:: console
626

    
627
    [image]: list --owner=s0m3-u53r-1d
628
    f1r57-1m4g3-1d Debian Base Alpha
629
    53c0nd-1m4g3-1d Beta Debian Base
630
    [image]: list --container-format=bare
631
    f1r57-1m4g3-1d Debian Base Alpha
632
    53c0nd-1m4g3-1d Beta Debian Base
633
    [image]:
634

    
635
Exit context:
636

    
637
.. code-block:: console
638

    
639
    [image]: exit
640
    [kamaki]: