Statistics
| Branch: | Tag: | Revision:

root / docs / commands.rst @ df4781a4

History | View | Annotate | Download (16.3 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
    console   Create a VMC console and show connection information
215
    wait      Wait for server to finish [BUILD, STOPPED, REBOOT, ACTIVE]
216

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

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

    
223
    [kamaki]: server
224

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

    
229
    Create a server
230

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

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

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

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

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

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

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

    
292
.. code-block:: text
293

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

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

    
304
.. code-block:: text
305

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

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

    
316
.. code-block:: text
317

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

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

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

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

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

    
343
.. code-block:: text
344

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

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

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

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

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

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

    
372
    Connect a server to a network
373

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

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

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

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

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

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

    
423
.. code-block:: text
424

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

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

    
435
.. code-block:: text
436

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

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

    
444
.. code-block:: text
445

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

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

    
452
.. code-block:: text
453

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

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

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

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

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

    
484

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

    
489

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

    
494

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

    
502

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

    
506

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

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

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

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

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

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

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

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

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