Statistics
| Branch: | Tag: | Revision:

root / docs / commands.rst @ 9d84caa4

History | View | Annotate | Download (16.2 kB)

1
List of commands
2
================
3

    
4
Kamaki commands follow this scheme::
5

    
6
    [kamaki] <object> <action> [identifiers] [non-positional arguments]
7

    
8
In this context, objects are not services, but virtual objects like a server, a
9
file or an image. The action concerns objects of the specified type. Some
10
actions (e.g. "delete" or "info") need to operate on an existing object. The
11
identifiers strictly identify this object and they should have the form of an id
12
(e.g., `server delete <SERVER_ID>`).
13

    
14
The examples bellow showcase some commands. The kamaki-shell (check
15
`Usage section <usage.html#interactive-shell>`_ for details) is chosen as the
16
execution environment.
17

    
18

    
19
user (Identity/Astakos)
20
-----------------------
21

    
22
.. code-block:: text
23

    
24
    info          Get info for (current) session user
25
    uuid2name     Get user name(s) from uuid(s)
26
    authenticate  Authenticate a user and get all authentication information
27
    list          List (cached) session users
28
    add           Authenticate user by token and add to kamaki session (cache)
29
    name2uuid     Get user uuid(s) from name(s)
30
    select        Select user from the (cached) list as current session user
31
    delete        Delete user (token) from the (cached) list of session users
32

    
33
Showcase: get user information
34
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35

    
36
In the following, cloud URL and TOKEN were set in a previous step (see
37
`setup section <setup.html>`_ or the
38
`quick setup guide <usage.html#quick-setup>`_)
39

    
40
.. code-block:: console
41
    :emphasize-lines: 1,4
42

    
43
    * Enter user context *
44
    [kamaki]: user
45

    
46
    * Authenticate user *
47
    [user]: info
48
    ...
49
    name:  My Real Name
50
    id:  ab1cde23-45fg-6h7i-8j9k-10l1m11no2pq
51

    
52
    [user]: exit
53
    [kamaki]:
54

    
55
project (Astakos)
56
-----------------
57

    
58
.. code-block:: text
59

    
60
    info          Get details for a project
61
    unsuspend     Resume a suspended project (special privileges needed)
62
    suspend       Suspend a project (special privileges needed)
63
    list          List all projects
64
    create        Apply for a new project
65
    modify        Modify a project
66
    terminate     Terminate a project (special privileges needed)
67
    application   Application management commands
68
    reinstate     Reinstate a terminated project (special privileges needed)
69

    
70
membership (Astakos)
71
--------------------
72

    
73
.. code-block:: text
74

    
75
    info    Details on a membership
76
    enroll  Enroll somebody to a project you manage
77
    join    Join a project
78
    list    List all memberships
79
    accept  Accept a membership for a project you manage
80
    leave   Leave a project you have membership to
81
    remove  Remove a membership for a project you manage
82
    reject  Reject a membership for a project you manage
83
    cancel  Cancel your (probably pending) membership to a project
84

    
85
quota (Account/Astakos)
86
-----------------------
87

    
88
.. code-block:: text
89

    
90
    list          Get user quotas
91
    info          Get quota for a service (cyclades, pithos, astakos)
92

    
93
resource (Astakos)
94
------------------
95

    
96
.. code-block:: text
97

    
98
    list          List user resources
99

    
100
flavor (Compute/Cyclades)
101
-------------------------
102

    
103
.. code-block:: text
104

    
105
    info:  Get flavor details
106
    list:  List flavors
107

    
108
Showcase: show details for flavor with id 43
109
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110

    
111
.. code-block:: console
112
    :emphasize-lines: 1,4
113

    
114
    * Enter flavor context *
115
    [kamaki]: flavor
116

    
117
    * Get details about flavor with id 43 *
118
    [flavor]: info 43
119
    SNF:disk_template:  drbd
120
    cpu:  4
121
    disk:  10
122
    id:  43
123
    name:  C4R2048D10
124
    ram:  2048
125

    
126
image (Image/Plankton)
127
----------------------
128

    
129
.. code-block:: text
130

    
131
    info          Get image metadata
132
    list          List images accessible by user
133
    register      (Re)Register an image file to an Image service
134
    modify        Add / update metadata and properties for an image
135
    unregister    Unregister an image (does not delete the image file)
136

    
137
Showcase: Pick an image and list the properties
138
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
139

    
140
.. code-block:: console
141
    :emphasize-lines: 1,4,18
142

    
143
    * Enter image context *
144
    [kamaki]: image
145

    
146
    * list all available images *
147
    [image]: list
148
    926ab1c5-2d85-49d4-aebe-0fce712789b9 Windows Server 2008
149
     container_format:  bare
150
     disk_format:  diskdump
151
     id:  926ab1c5-2d85-49d4-aebe-0fce712789b9
152
     size:  11917066240
153
     status:  available
154
    78262ee7-949e-4d70-af3a-85360c3de57a Windows Server 2012
155
     container_format:  bare
156
     disk_format:  diskdump
157
     id:  78262ee7-949e-4d70-af3a-85360c3de57a
158
     size:  11697913856
159
     status:  available
160
    5ed5a29b-292c-4fe0-b32c-2e2b65628635 ubuntu
161
     container_format:  bare
162
     disk_format:  diskdump
163
     id:  5ed5a29b-292c-4fe0-b32c-2e2b65628635
164
     size:  2578100224
165
     status:  available
166
    1f8454f0-8e3e-4b6c-ab8e-5236b728dffe Debian_Wheezy_Base
167
     container_format:  bare
168
     disk_format:  diskdump
169
     id:  1f8454f0-8e3e-4b6c-ab8e-5236b728dffe
170
     size:  795107328
171
     status:  available
172

    
173
    * Get details for image with id 1f8454f0-8e3e-4b6c-ab8e-5236b728dffe *
174
    [image]: info 1f8454f0-8e3e-4b6c-ab8e-5236b728dffe
175
     name: Debian_Wheezy_Base
176
     container_format:  bare
177
     disk_format:  diskdump
178
     id:  1f8454f0-8e3e-4b6c-ab8e-5236b728dffe
179
     size:  795107328
180
     status:  available
181
     owner:  s0m3-u53r-1d (user@example.com)
182
        DESCRIPTION:  Debian Wheezy Base (Stable)
183
        GUI:  No GUI
184
        KERNEL:  2.6.32
185
        OS:  debian
186
        OSFAMILY:  linux
187
        ROOT_PARTITION:  1
188
        SORTORDER:  1
189
        USERS:  root
190

    
191
imagecompute (Compute/Cyclades)
192
-------------------------------
193

    
194
.. code-block:: text
195

    
196
    info      Get detailed information on an image
197
    list      List images
198
    modify    Modify image properties (metadata)
199
    delete    Delete an image (WARNING: image file is also removed)
200

    
201
server (Compute/Cyclades)
202
-------------------------
203

    
204
.. code-block:: text
205

    
206
    info      Detailed information on a Virtual Machine
207
    modify    Modify attributes of a virtual server
208
    create    Create a server (aka Virtual Machine)
209
    list      List virtual servers accessible by user
210
    reboot    Reboot a virtual server
211
    start     Start an existing virtual server
212
    shutdown  Shutdown an active virtual server
213
    delete    Delete a virtual server
214
    wait      Wait for server to finish [BUILD, STOPPED, REBOOT, ACTIVE]
215

    
216
Showcase: Create a server
217
^^^^^^^^^^^^^^^^^^^^^^^^^
218

    
219
.. code-block:: console
220
    :emphasize-lines: 1,4,21,35,44,62
221

    
222
    [kamaki]: server
223

    
224
    [server]: create -h
225
    usage: create --name NAME --flavor-id FLAVOR_ID --image-id IMAGE_ID
226
            [--personality PERSONALITY] [-h] [--config CONFIG] [--cloud CLOUD]
227

    
228
    Create a server
229

    
230
    optional arguments:
231
      -v, --verbose         More info at response
232
      --personality PERSONALITY
233
                            add a personality file
234
      -d, --debug           Include debug output
235
      -h, --help            Show help message
236
      -i, --include         Include protocol headers in the output
237
      --config CONFIG       Path to configuration file
238
      -s, --silent          Do not output anything
239
      --cloud CLOUD         Chose a cloud to connect to
240

    
241
    * List all available images *
242
    [server]: /image compute list
243
    1395fdfb-51b4-419f-bb02-f7d632860611 Ubuntu Desktop LTS
244
    1580deb4-edb3-4496-a27f-7a246c4c0528 Ubuntu Desktop
245
    18a82962-43eb-4b32-8e28-8f8880af89d7 Kubuntu LTS
246
    6aa6eafd-dccb-422d-a904-67fe2bdde87e Debian Desktop
247
    6b5681e4-7502-46ae-b1e9-9fd837932095 maelstrom
248
    78262ee7-949e-4d70-af3a-85360c3de57a Windows Server 2012
249
    86bc2414-0fb3-4898-a637-240292243302 Fedora
250
    926ab1c5-2d85-49d4-aebe-0fce712789b9 Windows Server 2008
251
    b2dffe52-64a4-48c3-8a4c-8214cc3165cf Debian Base
252
    baf2321c-57a0-4a69-825d-49f49cea163a CentOS
253
    c1d27b46-d875-4f5c-b7f1-f39b5af62905 Kubuntu
254

    
255
    * See details of flavor with id 1 *
256
    [server]: /flavor info 1
257
    SNF:disk_template:  drbd
258
    cpu              :  1
259
    disk             :  20
260
    id               :  1
261
    name             :  C1R1024D20
262
    ram              :  1024
263

    
264
    * Create a debian server named 'My Small Debian Server'
265
    [server]: create --name='My Small Debian Server' --flavor-id=1 --image-id=b2dffe52-64a4-48c3-8a4c-8214cc3165cf
266
    adminPass:  L8gu2wbZ94
267
    created  :  2012-11-23T16:56:04.190813+00:00
268
    flavorRef:  1
269
    hostId   :  
270
    id       :  11687
271
    imageRef :  b2dffe52-64a4-48c3-8a4c-8214cc3165cf
272
    metadata : 
273
               os   :  debian
274
               users:  root
275
    name     :  My Small Debian Server
276
    progress :  0
277
    status   :  BUILD
278
    suspended:  False
279
    updated  :  2012-11-23T16:56:04.761962+00:00
280

    
281
    * wait for server to build (optional) *
282
    [server]: wait 11687
283
    Server 11687 still in BUILD mode |||||||||||||||||    | 80%
284
    Server 11687 is now in ACTIVE mode
285

    
286
.. Note:: In kamaki shell, / is used to access commands from top-level
287

    
288
ip (Network/Cyclades)
289
---------------------
290

    
291
.. code-block:: text
292

    
293
    info      Get details on a floating IP
294
    create    Reserve an IP on a network
295
    list      List reserved floating IPs
296
    delete    Unreserve an IP (also delete the port, if attached)
297
    attach    Attach an IP on a virtual server
298
    detach    Detach an IP from a virtual server
299

    
300
port (Network/Cyclades)
301
-----------------------
302

    
303
.. code-block:: text
304

    
305
    info      Get details about a port
306
    list      List all ports
307
    create    Create a new port (== connect server to network)
308
    modify    Modify the attributes of a port
309
    delete    Delete a port (== disconnect server from network)
310
    wait      Wait for port to finish [ACTIVE, DOWN, BUILD, ERROR]
311

    
312
Showcase: Reserve and attach IP to server
313
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
314

    
315
.. code-block:: text
316

    
317
    * Enter port context *
318
    [kamaki]: port
319

    
320
    * Reserve an IP and see servers and networks*
321
    [port]: /ip create
322
    123.456.78.9
323
    [port]: /server list
324
    42   My Windows Server
325
    43   My Linux Server
326
    [port]: /network list
327
    101  My Network 1
328
    102  My Network 2
329

    
330
    * Attach IP to server
331
    [port]: port create --device-id=43 --network-id=101 --ip-address=123.456.78.9 --wait
332
    Creating new port 7 between server 43 and network 101
333
    Port 7 still in BUILD mode |||||||||||||||||    | 80%
334
    Port 7 is now in ACTIVE mode
335

    
336
.. Note:: In kamaki shell, / is used to access top-level command groups while
337
    working in command group contexts
338

    
339
network (Network/Cyclades)
340
--------------------------
341

    
342
.. code-block:: text
343

    
344
    info        Get details about a network
345
    disconnect  Disconnect a network from a device
346
    modify      Modify network attributes
347
    create      Create a new network
348
    list        List networks
349
    connect     Connect a network with a device (server or router)
350
    delete      Delete a network
351

    
352
Showcase: Connect a network to a VM
353
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
354

    
355
.. code-block:: console
356
    :emphasize-lines: 1,4,9,24,27,44
357

    
358
    * Enter network context *
359
    [kamaki]: network
360

    
361
    * List user-owned VMs *
362
    [network]: /server list
363
    11687 (My Small Debian Server)
364
    11688 (An Ubuntu server)
365

    
366
    * Try network-connect (to get help) *
367
    [network]: connect 
368
    Syntax error
369
    usage: connect <network id> --device-id <DEVICE_ID> [-s] [-h] [-i] [--config CONFIG]
370

    
371
    Connect a server to a network
372

    
373
    Syntax: connect  <server id> <network id>
374
      --config    :  Path to configuration file
375
      -d,--debug  :  Include debug output
376
      -h,--help   :  Show help message
377
      -i,--include:  Include protocol headers in the output
378
      -s,--silent :  Do not output anything
379
      -v,--verbose:  More info at response
380

    
381
    * Connect VM with id 11687 to network with id 1409
382
    [network]: connect 11687 --device-id=1409 --wait
383
    Creating port between network 1409 and server 11687
384
    New port: 8
385

    
386
    * Get details on network with id 1409
387
    [network]: info 1409
388
      attachments:
389
                8
390
      cidr    :  192.168.1.0/24
391
      cidr6   :  None
392
      created :  2012-11-23T17:17:20.560098+00:00
393
      dhcp    :  True
394
      gateway :  None
395
      gateway6:  None
396
      id      :  1409
397
      name    :  my network
398
      public  :  False
399
      status  :  ACTIVE
400
      type    :  MAC_FILTERED
401
      updated :  2012-11-23T17:18:25.095225+00:00
402

    
403
    * Get connectivity details on VM with id 11687 *
404
    [network]: /server info 11687 --nics 
405
    nic-11687-1
406
        ipv4       :  192.168.1.1
407
        ipv6       :  None
408
        mac_address:  aa:0f:c2:0b:0e:85
409
        network_id :  1409
410
        firewallProfile:  DISABLED
411
    nic-11687-0
412
        ipv4           :  83.212.106.111
413
        ipv6           :  2001:648:2ffc:1116:a80c:f2ff:fe12:a9e
414
        mac_address    :  aa:0c:f2:12:0a:9e
415
        network_id     :  1369
416

    
417
.. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
418

    
419
container (Storage/Pithos+)
420
---------------------------
421

    
422
.. code-block:: text
423

    
424
    info      Get information about a container
425
    modify    Modify the properties of a container
426
    create    Create a new container
427
    list      List all containers, or their contents
428
    empty     Empty a container
429
    delete    Delete a container
430

    
431
group (Storage/Pithos+)
432
-----------------------
433

    
434
.. code-block:: text
435

    
436
    create    Create a group of users
437
    list      List all groups and group members
438
    delete    Delete a user group
439

    
440
sharer (Storage/Pithos+)
441
------------------------
442

    
443
.. code-block:: text
444

    
445
    info      Details on a Pithos+ sharer account (default: current account)
446
    list      List accounts who share file objects with current user
447

    
448
file (Storage/Pithos+)
449
----------------------
450

    
451
.. code-block:: text
452

    
453
    info      Get information/details about a file
454
    truncate  Truncate remote file up to size
455
    mkdir     Create a directory
456
    create    Create an empty file
457
    move      Move objects, even between different accounts or containers
458
    list      List all objects in a container or a directory object
459
    upload    Upload a file
460
    cat       Fetch remote file contents
461
    modify    Modify the attributes of a file or directory object
462
    append    Append local file to (existing) remote object
463
    download  Download a remove file or directory object to local file system
464
    copy      Copy objects, even between different accounts or containers
465
    overwrite Overwrite part of a remote file
466
    delete    Delete a file or directory object
467

    
468
Showcase: Upload and download a file
469
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
470

    
471
.. code-block:: console
472
    :emphasize-lines: 1,7,11,16,21,29,33,37,41,44,51,55,60,64
473

    
474
    * Create a random binarry file at current OS path *
475
    [kamaki]: !dd bs=4M if=/dev/zero of=rndm_local.file count=5
476
    5+0 records in
477
    5+0 records out
478
    20971520 bytes (21 MB) copied, 0.016162 s, 1.3 GB/s
479

    
480
    * Enter file context *
481
    [kamaki]: file
482

    
483

    
484
    * Check local file *
485
    [file]: !ls -lh rndm_local.file
486
    -rw-rw-r-- 1 ******** ******** 20M Nov 26 15:36 rndm_local.file
487

    
488

    
489
    * Create two containers *
490
    [file]: /container create mycont1
491
    [file]: /container create mycont2
492

    
493

    
494
    * List accessible containers *    
495
    [file]: /container list
496
    1. mycont1 (0B, 0 objects)
497
    2. mycont2 (0B, 0 objects)
498
    3. pithos (0B, 0 objects)
499
    4. trash (0B, 0 objects)
500

    
501

    
502
    * Upload local file to 1st container *
503
    [file]: upload /mycont1/rndm_local.file
504

    
505

    
506
    * Check if file has been uploaded *
507
    [file]: list /mycont1
508
    1.    20M rndm_local.file
509

    
510
    * Create directory mydir on second container *
511
    [file]: mkdir /mycont2/mydir
512

    
513
    * Move file from 1st to 2nd container (and in the directory) *
514
    [file]: move /mycont1/rndm_local.file /mycont2/mydir/rndm_local.file
515

    
516
    * Check contents of both containers *
517
    [file]: list /mycont1
518
    [file]: list /mycont2
519
    1.      D mydir/
520
    2.    20M mydir/rndm_local.file
521

    
522
    * Copy file from 2nd to 1st container, with a new name *
523
    [file]: copy /mycont2/mydir/rndm_local.file /mycont1/rndm_remote.file
524

    
525
    * Check pasted file *
526
    [file]: list /mycont1
527
    1.    20M rndm_remote.file
528

    
529
    * Download pasted file to local file system *
530
    [file]: download /mycont1/rndm_remote.file
531
    Downloading: |||||||||||||||||   | 72%
532

    
533
    * Check if file is downloaded and if it is the same to original *
534
    [file]: !ls -lh *.file
535
    -rw-rw-r-- 1 ******** ******** 20M Nov 26 15:36 rndm_local.file
536
    -rw-rw-r-- 1 ******** ******** 20M Nov 26 15:42 rndm_remote.file
537
    [file]: !diff rndm_local.file rndm_remote.file
538

    
539
.. Note:: In kamaki shell, ! is used to execute OS shell commands (e.g., bash)