Statistics
| Branch: | Tag: | Revision:

root / docs / commands.rst @ 7a3c66e1

History | View | Annotate | Download (15.7 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

    
284
port (Network/Cyclades)
285
-----------------------
286

    
287
.. code-block:: text
288

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

    
296
Showcase: Reserve and attach IP to server
297
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
298

    
299
.. code-block:: text
300

    
301
    * Enter port context *
302
    [kamaki]: port
303

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

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

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

    
323
network (Network/Cyclades)
324
--------------------------
325

    
326
.. code-block:: text
327

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

    
336
Showcase: Connect a network to a VM
337
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
338

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

    
342
    * Enter network context *
343
    [kamaki]: network
344

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

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

    
355
    Connect a server to a network
356

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

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

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

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

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

    
403
container (Storage/Pithos+)
404
---------------------------
405

    
406
.. code-block:: text
407

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

    
415
group (Storage/Pithos+)
416
-----------------------
417

    
418
.. code-block:: text
419

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

    
424
sharer (Storage/Pithos+)
425
------------------------
426

    
427
.. code-block:: text
428

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

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

    
435
.. code-block:: text
436

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

    
452
Showcase: Upload and download a file
453
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
454

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

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

    
464
    * Enter file context *
465
    [kamaki]: file
466

    
467

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

    
472

    
473
    * Create two containers *
474
    [file]: /container create mycont1
475
    [file]: /container create mycont2
476

    
477

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

    
485

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

    
489

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

    
494
    * Create directory mydir on second container *
495
    [file]: mkdir /mycont2/mydir
496

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

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

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

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

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

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

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