Statistics
| Branch: | Tag: | Revision:

root / docs / commands.rst @ ab154b94

History | View | Annotate | Download (15.8 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
    membership    Project membership management commands
69
    reinstate     Reinstate a terminated project (special privileges needed)
70

    
71
quota (Account/Astakos)
72
-----------------------
73

    
74
.. code-block:: text
75

    
76
    list          Get user quotas
77
    info          Get quota for a service (cyclades, pithos, astakos)
78

    
79
resource (Astakos)
80
------------------
81

    
82
.. code-block:: text
83

    
84
    list          List user resources
85

    
86
flavor (Compute/Cyclades)
87
-------------------------
88

    
89
.. code-block:: text
90

    
91
    info:  Get flavor details
92
    list:  List flavors
93

    
94
Showcase: show details for flavor with id 43
95
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
96

    
97
.. code-block:: console
98
    :emphasize-lines: 1,4
99

    
100
    * Enter flavor context *
101
    [kamaki]: flavor
102

    
103
    * Get details about flavor with id 43 *
104
    [flavor]: info 43
105
    SNF:disk_template:  drbd
106
    cpu:  4
107
    disk:  10
108
    id:  43
109
    name:  C4R2048D10
110
    ram:  2048
111

    
112
image (Image/Plankton)
113
----------------------
114

    
115
.. code-block:: text
116

    
117
    info          Get image metadata
118
    list          List images accessible by user
119
    register      (Re)Register an image file to an Image service
120
    modify        Add / update metadata and properties for an image
121
    unregister    Unregister an image (does not delete the image file)
122

    
123
Showcase: Pick an image and list the properties
124
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
125

    
126
.. code-block:: console
127
    :emphasize-lines: 1,4,18
128

    
129
    * Enter image context *
130
    [kamaki]: image
131

    
132
    * list all available images *
133
    [image]: list
134
    926ab1c5-2d85-49d4-aebe-0fce712789b9 Windows Server 2008
135
     container_format:  bare
136
     disk_format:  diskdump
137
     id:  926ab1c5-2d85-49d4-aebe-0fce712789b9
138
     size:  11917066240
139
     status:  available
140
    78262ee7-949e-4d70-af3a-85360c3de57a Windows Server 2012
141
     container_format:  bare
142
     disk_format:  diskdump
143
     id:  78262ee7-949e-4d70-af3a-85360c3de57a
144
     size:  11697913856
145
     status:  available
146
    5ed5a29b-292c-4fe0-b32c-2e2b65628635 ubuntu
147
     container_format:  bare
148
     disk_format:  diskdump
149
     id:  5ed5a29b-292c-4fe0-b32c-2e2b65628635
150
     size:  2578100224
151
     status:  available
152
    1f8454f0-8e3e-4b6c-ab8e-5236b728dffe Debian_Wheezy_Base
153
     container_format:  bare
154
     disk_format:  diskdump
155
     id:  1f8454f0-8e3e-4b6c-ab8e-5236b728dffe
156
     size:  795107328
157
     status:  available
158

    
159
    * Get details for image with id 1f8454f0-8e3e-4b6c-ab8e-5236b728dffe *
160
    [image]: info 1f8454f0-8e3e-4b6c-ab8e-5236b728dffe
161
     name: Debian_Wheezy_Base
162
     container_format:  bare
163
     disk_format:  diskdump
164
     id:  1f8454f0-8e3e-4b6c-ab8e-5236b728dffe
165
     size:  795107328
166
     status:  available
167
     owner:  s0m3-u53r-1d (user@example.com)
168
        DESCRIPTION:  Debian Wheezy Base (Stable)
169
        GUI:  No GUI
170
        KERNEL:  2.6.32
171
        OS:  debian
172
        OSFAMILY:  linux
173
        ROOT_PARTITION:  1
174
        SORTORDER:  1
175
        USERS:  root
176

    
177
imagecompute (Compute/Cyclades)
178
-------------------------------
179

    
180
.. code-block:: text
181

    
182
    info      Get detailed information on an image
183
    list      List images
184
    modify    Modify image properties (metadata)
185
    delete    Delete an image (WARNING: image file is also removed)
186

    
187
server (Compute/Cyclades)
188
-------------------------
189

    
190
.. code-block:: text
191

    
192
    info      Detailed information on a Virtual Machine
193
    modify    Modify attributes of a virtual server
194
    create    Create a server (aka Virtual Machine)
195
    list      List virtual servers accessible by user
196
    reboot    Reboot a virtual server
197
    start     Start an existing virtual server
198
    shutdown  Shutdown an active virtual server
199
    delete    Delete a virtual server
200
    wait      Wait for server to finish [BUILD, STOPPED, REBOOT, ACTIVE]
201

    
202
Showcase: Create a server
203
^^^^^^^^^^^^^^^^^^^^^^^^^
204

    
205
.. code-block:: console
206
    :emphasize-lines: 1,4,21,35,44,62
207

    
208
    [kamaki]: server
209

    
210
    [server]: create -h
211
    usage: create --name NAME --flavor-id FLAVOR_ID --image-id IMAGE_ID
212
            [--personality PERSONALITY] [-h] [--config CONFIG] [--cloud CLOUD]
213

    
214
    Create a server
215

    
216
    optional arguments:
217
      -v, --verbose         More info at response
218
      --personality PERSONALITY
219
                            add a personality file
220
      -d, --debug           Include debug output
221
      -h, --help            Show help message
222
      -i, --include         Include protocol headers in the output
223
      --config CONFIG       Path to configuration file
224
      -s, --silent          Do not output anything
225
      --cloud CLOUD         Chose a cloud to connect to
226

    
227
    * List all available images *
228
    [server]: /image compute list
229
    1395fdfb-51b4-419f-bb02-f7d632860611 Ubuntu Desktop LTS
230
    1580deb4-edb3-4496-a27f-7a246c4c0528 Ubuntu Desktop
231
    18a82962-43eb-4b32-8e28-8f8880af89d7 Kubuntu LTS
232
    6aa6eafd-dccb-422d-a904-67fe2bdde87e Debian Desktop
233
    6b5681e4-7502-46ae-b1e9-9fd837932095 maelstrom
234
    78262ee7-949e-4d70-af3a-85360c3de57a Windows Server 2012
235
    86bc2414-0fb3-4898-a637-240292243302 Fedora
236
    926ab1c5-2d85-49d4-aebe-0fce712789b9 Windows Server 2008
237
    b2dffe52-64a4-48c3-8a4c-8214cc3165cf Debian Base
238
    baf2321c-57a0-4a69-825d-49f49cea163a CentOS
239
    c1d27b46-d875-4f5c-b7f1-f39b5af62905 Kubuntu
240

    
241
    * See details of flavor with id 1 *
242
    [server]: /flavor info 1
243
    SNF:disk_template:  drbd
244
    cpu              :  1
245
    disk             :  20
246
    id               :  1
247
    name             :  C1R1024D20
248
    ram              :  1024
249

    
250
    * Create a debian server named 'My Small Debian Server'
251
    [server]: create --name='My Small Debian Server' --flavor-id=1 --image-id=b2dffe52-64a4-48c3-8a4c-8214cc3165cf
252
    adminPass:  L8gu2wbZ94
253
    created  :  2012-11-23T16:56:04.190813+00:00
254
    flavorRef:  1
255
    hostId   :  
256
    id       :  11687
257
    imageRef :  b2dffe52-64a4-48c3-8a4c-8214cc3165cf
258
    metadata : 
259
               os   :  debian
260
               users:  root
261
    name     :  My Small Debian Server
262
    progress :  0
263
    status   :  BUILD
264
    suspended:  False
265
    updated  :  2012-11-23T16:56:04.761962+00:00
266

    
267
    * wait for server to build (optional) *
268
    [server]: wait 11687
269
    Server 11687 still in BUILD mode |||||||||||||||||    | 80%
270
    Server 11687 is now in ACTIVE mode
271

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

    
274
ip (Network/Cyclades)
275
---------------------
276

    
277
.. code-block:: text
278

    
279
    info      Get details on a floating IP
280
    create    Reserve an IP on a network
281
    list      List reserved floating IPs
282
    delete    Unreserve an IP (also delete the port, if attached)
283
    attach    Attach an IP on a virtual server
284
    detach    Detach an IP from a virtual server
285

    
286
port (Network/Cyclades)
287
-----------------------
288

    
289
.. code-block:: text
290

    
291
    info      Get details about a port
292
    list      List all ports
293
    create    Create a new port (== connect server to network)
294
    modify    Modify the attributes of a port
295
    delete    Delete a port (== disconnect server from network)
296
    wait      Wait for port to finish [ACTIVE, DOWN, BUILD, ERROR]
297

    
298
Showcase: Reserve and attach IP to server
299
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
300

    
301
.. code-block:: text
302

    
303
    * Enter port context *
304
    [kamaki]: port
305

    
306
    * Reserve an IP and see servers and networks*
307
    [port]: /ip create
308
    123.456.78.9
309
    [port]: /server list
310
    42   My Windows Server
311
    43   My Linux Server
312
    [port]: /network list
313
    101  My Network 1
314
    102  My Network 2
315

    
316
    * Attach IP to server
317
    [port]: port create --device-id=43 --network-id=101 --ip-address=123.456.78.9 --wait
318
    Creating new port 7 between server 43 and network 101
319
    Port 7 still in BUILD mode |||||||||||||||||    | 80%
320
    Port 7 is now in ACTIVE mode
321

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

    
325
network (Network/Cyclades)
326
--------------------------
327

    
328
.. code-block:: text
329

    
330
    info        Get details about a network
331
    disconnect  Disconnect a network from a device
332
    modify      Modify network attributes
333
    create      Create a new network
334
    list        List networks
335
    connect     Connect a network with a device (server or router)
336
    delete      Delete a network
337

    
338
Showcase: Connect a network to a VM
339
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
340

    
341
.. code-block:: console
342
    :emphasize-lines: 1,4,9,24,27,44
343

    
344
    * Enter network context *
345
    [kamaki]: network
346

    
347
    * List user-owned VMs *
348
    [network]: /server list
349
    11687 (My Small Debian Server)
350
    11688 (An Ubuntu server)
351

    
352
    * Try network-connect (to get help) *
353
    [network]: connect 
354
    Syntax error
355
    usage: connect <network id> --device-id <DEVICE_ID> [-s] [-h] [-i] [--config CONFIG]
356

    
357
    Connect a server to a network
358

    
359
    Syntax: connect  <server id> <network id>
360
      --config    :  Path to configuration file
361
      -d,--debug  :  Include debug output
362
      -h,--help   :  Show help message
363
      -i,--include:  Include protocol headers in the output
364
      -s,--silent :  Do not output anything
365
      -v,--verbose:  More info at response
366

    
367
    * Connect VM with id 11687 to network with id 1409
368
    [network]: connect 11687 --device-id=1409 --wait
369
    Creating port between network 1409 and server 11687
370
    New port: 8
371

    
372
    * Get details on network with id 1409
373
    [network]: info 1409
374
      attachments:
375
                8
376
      cidr    :  192.168.1.0/24
377
      cidr6   :  None
378
      created :  2012-11-23T17:17:20.560098+00:00
379
      dhcp    :  True
380
      gateway :  None
381
      gateway6:  None
382
      id      :  1409
383
      name    :  my network
384
      public  :  False
385
      status  :  ACTIVE
386
      type    :  MAC_FILTERED
387
      updated :  2012-11-23T17:18:25.095225+00:00
388

    
389
    * Get connectivity details on VM with id 11687 *
390
    [network]: /server info 11687 --nics 
391
    nic-11687-1
392
        ipv4       :  192.168.1.1
393
        ipv6       :  None
394
        mac_address:  aa:0f:c2:0b:0e:85
395
        network_id :  1409
396
        firewallProfile:  DISABLED
397
    nic-11687-0
398
        ipv4           :  83.212.106.111
399
        ipv6           :  2001:648:2ffc:1116:a80c:f2ff:fe12:a9e
400
        mac_address    :  aa:0c:f2:12:0a:9e
401
        network_id     :  1369
402

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

    
405
container (Storage/Pithos+)
406
---------------------------
407

    
408
.. code-block:: text
409

    
410
    info      Get information about a container
411
    modify    Modify the properties of a container
412
    create    Create a new container
413
    list      List all containers, or their contents
414
    empty     Empty a container
415
    delete    Delete a container
416

    
417
group (Storage/Pithos+)
418
-----------------------
419

    
420
.. code-block:: text
421

    
422
    create    Create a group of users
423
    list      List all groups and group members
424
    delete    Delete a user group
425

    
426
sharer (Storage/Pithos+)
427
------------------------
428

    
429
.. code-block:: text
430

    
431
    info      Details on a Pithos+ sharer account (default: current account)
432
    list      List accounts who share file objects with current user
433

    
434
file (Storage/Pithos+)
435
----------------------
436

    
437
.. code-block:: text
438

    
439
    info      Get information/details about a file
440
    truncate  Truncate remote file up to size
441
    mkdir     Create a directory
442
    create    Create an empty file
443
    move      Move objects, even between different accounts or containers
444
    list      List all objects in a container or a directory object
445
    upload    Upload a file
446
    cat       Fetch remote file contents
447
    modify    Modify the attributes of a file or directory object
448
    append    Append local file to (existing) remote object
449
    download  Download a remove file or directory object to local file system
450
    copy      Copy objects, even between different accounts or containers
451
    overwrite Overwrite part of a remote file
452
    delete    Delete a file or directory object
453

    
454
Showcase: Upload and download a file
455
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
456

    
457
.. code-block:: console
458
    :emphasize-lines: 1,7,11,16,21,29,33,37,41,44,51,55,60,64
459

    
460
    * Create a random binarry file at current OS path *
461
    [kamaki]: !dd bs=4M if=/dev/zero of=rndm_local.file count=5
462
    5+0 records in
463
    5+0 records out
464
    20971520 bytes (21 MB) copied, 0.016162 s, 1.3 GB/s
465

    
466
    * Enter file context *
467
    [kamaki]: file
468

    
469

    
470
    * Check local file *
471
    [file]: !ls -lh rndm_local.file
472
    -rw-rw-r-- 1 ******** ******** 20M Nov 26 15:36 rndm_local.file
473

    
474

    
475
    * Create two containers *
476
    [file]: /container create mycont1
477
    [file]: /container create mycont2
478

    
479

    
480
    * List accessible containers *    
481
    [file]: /container list
482
    1. mycont1 (0B, 0 objects)
483
    2. mycont2 (0B, 0 objects)
484
    3. pithos (0B, 0 objects)
485
    4. trash (0B, 0 objects)
486

    
487

    
488
    * Upload local file to 1st container *
489
    [file]: upload /mycont1/rndm_local.file
490

    
491

    
492
    * Check if file has been uploaded *
493
    [file]: list /mycont1
494
    1.    20M rndm_local.file
495

    
496
    * Create directory mydir on second container *
497
    [file]: mkdir /mycont2/mydir
498

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

    
502
    * Check contents of both containers *
503
    [file]: list /mycont1
504
    [file]: list /mycont2
505
    1.      D mydir/
506
    2.    20M mydir/rndm_local.file
507

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

    
511
    * Check pasted file *
512
    [file]: list /mycont1
513
    1.    20M rndm_remote.file
514

    
515
    * Download pasted file to local file system *
516
    [file]: download /mycont1/rndm_remote.file
517
    Downloading: |||||||||||||||||   | 72%
518

    
519
    * Check if file is downloaded and if it is the same to original *
520
    [file]: !ls -lh *.file
521
    -rw-rw-r-- 1 ******** ******** 20M Nov 26 15:36 rndm_local.file
522
    -rw-rw-r-- 1 ******** ******** 20M Nov 26 15:42 rndm_remote.file
523
    [file]: !diff rndm_local.file rndm_remote.file
524

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