16 |
16 |
It is essential for users to get a configuration token (to get in Okeanos.grnet.gr log `here <https://accounts.okeanos.grnet.gr/im/>`_) and provide it to kamaki:
|
17 |
17 |
|
18 |
18 |
.. code-block:: console
|
19 |
|
|
20 |
|
$ kamaki set token myt0k3n==
|
21 |
|
|
|
19 |
:emphasize-lines: 1
|
22 |
20 |
|
23 |
21 |
Example 1.1.1: Set user token to myt0k3n==
|
24 |
22 |
|
|
23 |
$ kamaki set token myt0k3n==
|
|
24 |
|
25 |
25 |
To use the storage service, a user should also provide the corresponding username:
|
26 |
26 |
|
27 |
27 |
.. code-block:: console
|
28 |
|
|
29 |
|
$ kamaki set account user@domain.com
|
30 |
|
|
|
28 |
:emphasize-lines: 1
|
31 |
29 |
|
32 |
30 |
Example 1.1.2: Set user name to user@domain.com
|
33 |
31 |
|
|
32 |
$ kamaki set account user@domain.com
|
|
33 |
|
34 |
34 |
Command line interfaces
|
35 |
35 |
-----------------------
|
36 |
36 |
Kamaki users can access synnefo services through either the interactive shell or the one-command behaviors. In practice, both systems relly on the same command set implementations and API clients, with identical responses and error messages. Still, there are some differenses.
|
... | ... | |
56 |
56 |
* without any parameters or arguments
|
57 |
57 |
|
58 |
58 |
.. code-block:: console
|
|
59 |
:emphasize-lines: 1
|
59 |
60 |
|
60 |
|
$ kamaki
|
61 |
|
|
62 |
|
|
63 |
|
Example 2.2.1: Running kamaki shell
|
|
61 |
Example 2.2.1: Run kamaki shell
|
64 |
62 |
|
|
63 |
$ kamaki
|
65 |
64 |
|
66 |
65 |
* with any kind of '-' prefixed arguments, except '-h', '--help'.
|
67 |
66 |
|
68 |
67 |
.. code-block:: console
|
|
68 |
:emphasize-lines: 1
|
69 |
69 |
|
70 |
|
$ kamaki --config myconfig.file
|
|
70 |
Example 2.2.2: Run kamaki shell with custom configuration file
|
71 |
71 |
|
72 |
|
|
73 |
|
Example 2.2.2: Running kamaki shell with custom configuration file
|
|
72 |
$ kamaki --config myconfig.file
|
74 |
73 |
|
75 |
74 |
|
76 |
75 |
Run as one-command
|
... | ... | |
80 |
79 |
* with the '-h' or '--help' arguments (help for kamaki one-command)
|
81 |
80 |
|
82 |
81 |
.. code-block:: console
|
83 |
|
|
84 |
|
$kamaki -h
|
85 |
|
|
|
82 |
:emphasize-lines: 1
|
86 |
83 |
|
87 |
84 |
Example 2.3.1: Kamaki help
|
88 |
85 |
|
|
86 |
$kamaki -h
|
|
87 |
|
89 |
88 |
* with one or more command parameters:
|
90 |
89 |
|
91 |
90 |
.. code-block:: console
|
92 |
|
|
93 |
|
$ kamaki server list
|
94 |
|
|
|
91 |
:emphasize-lines: 1
|
95 |
92 |
|
96 |
93 |
Example 2.3.2: List VMs managed by user
|
97 |
94 |
|
|
95 |
$ kamaki server list
|
|
96 |
|
98 |
97 |
Commands
|
99 |
98 |
^^^^^^^^
|
100 |
99 |
|
... | ... | |
103 |
102 |
Typically, commands consist of a group name (e.g. store for storage commands) one or more terms (e.g. list for listing) and the command specific parameters (e.g. the name of the container), if any.
|
104 |
103 |
|
105 |
104 |
.. code-block:: console
|
106 |
|
|
107 |
|
$ kamaki store list mycontainer
|
108 |
|
|
|
105 |
:emphasize-lines: 1
|
109 |
106 |
|
110 |
107 |
Example 3.1.1: List stored files in container mycontainer.
|
111 |
108 |
|
|
109 |
$ kamaki store list mycontainer
|
|
110 |
|
112 |
111 |
Example 2.3.2 showcases a command without parameters (the group is "server", the command is "list").
|
113 |
112 |
|
114 |
113 |
The "server" command group is also refered in the following example.
|
115 |
114 |
|
116 |
115 |
.. code-block:: console
|
117 |
|
|
118 |
|
$ kamaki server info 42
|
119 |
|
|
|
116 |
:emphasize-lines: 1
|
120 |
117 |
|
121 |
118 |
Example 3.1.2 Show information about a user-managed VM with id 42
|
122 |
119 |
|
|
120 |
$ kamaki server info 42
|
|
121 |
|
123 |
122 |
Client commands can feature an arbitarry number of terms:
|
124 |
123 |
|
125 |
124 |
.. code-block:: text
|
... | ... | |
146 |
145 |
Showcase: get user information, provided the token was set
|
147 |
146 |
|
148 |
147 |
.. code-block:: console
|
149 |
|
:emphasize-lines: 3-11
|
|
148 |
:emphasize-lines: 1,4
|
150 |
149 |
|
|
150 |
* Enter astakos context *
|
151 |
151 |
[kamaki]:astakos
|
|
152 |
|
|
153 |
* Authenticate user *
|
152 |
154 |
[astakos]:authenticate
|
153 |
155 |
auth_token : s0m3t0k3nth@t1sr3m0v3d==
|
154 |
156 |
auth_token_created: 2012-11-13T14:12:40.917034
|
... | ... | |
159 |
161 |
has_signed_terms : True
|
160 |
162 |
uniq : myaccount@grnet.gr
|
161 |
163 |
username : 4215th3b357num9323v32
|
162 |
|
[astakos]:
|
163 |
164 |
|
164 |
165 |
flavor (Compute/Cyclades)
|
165 |
166 |
"""""""""""""""""""""""""
|
... | ... | |
172 |
173 |
Showcase: show details for flavor with id 43
|
173 |
174 |
|
174 |
175 |
.. code-block:: console
|
175 |
|
:emphasize-lines: 3-8
|
|
176 |
:emphasize-lines: 1,4
|
176 |
177 |
|
|
178 |
* Enter flavor context *
|
177 |
179 |
[kamaki]: flavor
|
|
180 |
|
|
181 |
* Get details about flavor with id 43 *
|
178 |
182 |
[flavor]: info 43
|
179 |
183 |
SNF:disk_template: drbd
|
180 |
184 |
cpu : 4
|
... | ... | |
182 |
186 |
id : 43
|
183 |
187 |
name : C4R2048D10
|
184 |
188 |
ram : 2048
|
185 |
|
[flavor]:
|
186 |
189 |
|
187 |
190 |
image (Compute/Cyclades + Glance)
|
188 |
191 |
""""""""""""""""""""""""""""""""""
|
... | ... | |
205 |
208 |
setproperty: Update an image property
|
206 |
209 |
shared : List shared images
|
207 |
210 |
|
208 |
|
Showcase: show a list of public images, list the properties of Debian Base
|
|
211 |
Showcase: Pick an image and list the properties
|
209 |
212 |
|
210 |
213 |
.. code-block:: console
|
211 |
|
:emphasize-lines: 3-13,15-22
|
|
214 |
:emphasize-lines: 1,4,18
|
212 |
215 |
|
|
216 |
* Enter image context *
|
213 |
217 |
[kamaki]:image
|
|
218 |
|
|
219 |
* list all available images *
|
214 |
220 |
[image]:list
|
215 |
|
1395fdfb-51b4-419f-bb02-f7d632860611 (Ubuntu Desktop LTS (Long Term Support))
|
|
221 |
1395fdfb-51b4-419f-bb02-f7d632860611 (Ubuntu Desktop LTS)
|
216 |
222 |
1580deb4-edb3-4496-a27f-7a246c4c0528 (Ubuntu Desktop)
|
217 |
|
18a82962-43eb-4b32-8e28-8f8880af89d7 (Kubuntu LTS (Long Term Support))
|
|
223 |
18a82962-43eb-4b32-8e28-8f8880af89d7 (Kubuntu LTS)
|
218 |
224 |
6aa6eafd-dccb-422d-a904-67fe2bdde87e (Debian Desktop)
|
219 |
225 |
6b5681e4-7502-46ae-b1e9-9fd837932095 (maelstrom)
|
220 |
226 |
78262ee7-949e-4d70-af3a-85360c3de57a (Windows Server 2012)
|
... | ... | |
223 |
229 |
b2dffe52-64a4-48c3-8a4c-8214cc3165cf (Debian Base)
|
224 |
230 |
baf2321c-57a0-4a69-825d-49f49cea163a (CentOS)
|
225 |
231 |
c1d27b46-d875-4f5c-b7f1-f39b5af62905 (Kubuntu)
|
|
232 |
|
|
233 |
* Get properties of image with id b2dffe52-64a4-48c3-8a4c-8214cc3165cf *
|
226 |
234 |
[image]:properties b2dffe52-64a4-48c3-8a4c-8214cc3165cf
|
227 |
235 |
description : Debian 6.0.6 (Squeeze) Base System
|
228 |
236 |
gui : No GUI
|
... | ... | |
232 |
240 |
root_partition: 1
|
233 |
241 |
sortorder : 1
|
234 |
242 |
users : root
|
235 |
|
[image]:
|
236 |
243 |
|
237 |
244 |
server (Compute/Cyclades)
|
238 |
245 |
"""""""""""""""""""""""""
|
... | ... | |
257 |
264 |
stats : Get server statistics
|
258 |
265 |
wait : Wait for server to finish
|
259 |
266 |
|
260 |
|
Showcase: Create a server: Show create help, find a flavor and an image make a server. Wait for server to be build, get server details. Note that the progress bar feature is optional (see )
|
|
267 |
Showcase: Create a server.
|
261 |
268 |
|
262 |
269 |
.. code-block:: console
|
263 |
|
:emphasize-lines: 3-16,18-33,35-40,42-56,58,59,61-66
|
|
270 |
:emphasize-lines: 1,4,21,35,44,62
|
264 |
271 |
|
|
272 |
* Enter server context *
|
265 |
273 |
[kamaki]:server
|
|
274 |
|
|
275 |
* See server-create help *
|
266 |
276 |
[server]:create -h
|
267 |
277 |
usage: create <name> <flavor id> <image id>
|
268 |
278 |
[--personality PERSONALITY] [-h] [--config CONFIG]
|
... | ... | |
278 |
288 |
-i, --include Include protocol headers in the output
|
279 |
289 |
--config CONFIG Path to configuration file
|
280 |
290 |
-s, --silent Do not output anything
|
|
291 |
|
|
292 |
* List all available images *
|
281 |
293 |
[server]:/image list
|
282 |
294 |
1395fdfb-51b4-419f-bb02-f7d632860611 (Ubuntu Desktop LTS)
|
283 |
295 |
1580deb4-edb3-4496-a27f-7a246c4c0528 (Ubuntu Desktop)
|
284 |
|
|18a82962-43eb-4b32-8e28-8f8880af89d7 (Kubuntu LTS)
|
285 |
|
|6aa6eafd-dccb-422d-a904-67fe2bdde87e (Debian Desktop)
|
286 |
|
|6b5681e4-7502-46ae-b1e9-9fd837932095 (maelstrom)
|
287 |
|
|78262ee7-949e-4d70-af3a-85360c3de57a (Windows Server 2012)
|
288 |
|
|86bc2414-0fb3-4898-a637-240292243302 (Fedora)
|
289 |
|
|926ab1c5-2d85-49d4-aebe-0fce712789b9 (Windows Server 2008)
|
290 |
|
|b2dffe52-64a4-48c3-8a4c-8214cc3165cf (Debian Base)
|
291 |
|
|baf2321c-57a0-4a69-825d-49f49cea163a (CentOS)
|
292 |
|
|c1d27b46-d875-4f5c-b7f1-f39b5af62905 (Kubuntu)
|
|
296 |
18a82962-43eb-4b32-8e28-8f8880af89d7 (Kubuntu LTS)
|
|
297 |
6aa6eafd-dccb-422d-a904-67fe2bdde87e (Debian Desktop)
|
|
298 |
6b5681e4-7502-46ae-b1e9-9fd837932095 (maelstrom)
|
|
299 |
78262ee7-949e-4d70-af3a-85360c3de57a (Windows Server 2012)
|
|
300 |
86bc2414-0fb3-4898-a637-240292243302 (Fedora)
|
|
301 |
926ab1c5-2d85-49d4-aebe-0fce712789b9 (Windows Server 2008)
|
|
302 |
b2dffe52-64a4-48c3-8a4c-8214cc3165cf (Debian Base)
|
|
303 |
baf2321c-57a0-4a69-825d-49f49cea163a (CentOS)
|
|
304 |
c1d27b46-d875-4f5c-b7f1-f39b5af62905 (Kubuntu)
|
|
305 |
|
|
306 |
* See details of flavor with id 1 *
|
293 |
307 |
[server]:/flavor info 1
|
294 |
308 |
SNF:disk_template: drbd
|
295 |
309 |
cpu : 1
|
... | ... | |
297 |
311 |
id : 1
|
298 |
312 |
name : C1R1024D20
|
299 |
313 |
ram : 1024
|
|
314 |
|
|
315 |
* Create a debian server named 'My Small Debian Server'
|
300 |
316 |
[server]:create 'My Small Debian Server' 1 b2dffe52-64a4-48c3-8a4c-8214cc3165cf
|
301 |
317 |
adminPass: L8gu2wbZ94
|
302 |
318 |
created : 2012-11-23T16:56:04.190813+00:00
|
... | ... | |
313 |
329 |
status : BUILD
|
314 |
330 |
suspended: False
|
315 |
331 |
updated : 2012-11-23T16:56:04.761962+00:00
|
|
332 |
|
|
333 |
* wait for server to build (optional) *
|
316 |
334 |
[server]:wait 11687
|
317 |
335 |
Server 11687 still in BUILD mode ||||||||||||||||| | 80% - 3s
|
318 |
336 |
Server 11687 is now in ACTIVE mode
|
319 |
|
[server]:
|
|
337 |
|
|
338 |
.. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
|
320 |
339 |
|
321 |
340 |
network (Compute/Cyclades)
|
322 |
341 |
""""""""""""""""""""""""""
|
... | ... | |
331 |
350 |
list : List networks
|
332 |
351 |
rename : Update network name
|
333 |
352 |
|
334 |
|
Showcase: Connect a network to a VM: create a network, list available VMs, connect to 'My Small Debian Server', check network info and server connectivity.
|
|
353 |
Showcase: Connect a network to a VM
|
335 |
354 |
|
336 |
355 |
.. code-block:: console
|
337 |
|
:emphasize-lines: 1, 2, 5, 14, 15, 30, 42
|
|
356 |
:emphasize-lines: 1,4,9,24,27,44
|
338 |
357 |
|
|
358 |
* Enter network context *
|
339 |
359 |
[kamaki]:network
|
|
360 |
|
|
361 |
* List user-owned VMs *
|
340 |
362 |
[network]:/server list
|
341 |
363 |
11687 (My Small Debian Server)
|
342 |
364 |
11688 (An Ubuntu server)
|
|
365 |
|
|
366 |
* Try network-connect (to get help) *
|
343 |
367 |
[network]:connect
|
|
368 |
Syntax error
|
|
369 |
usage: connect <server id> <network id> [-s] [-h] [-i] [--config CONFIG]
|
|
370 |
|
344 |
371 |
Connect a server to a network
|
|
372 |
|
345 |
373 |
Syntax: connect <server id> <network id>
|
346 |
374 |
--config : Path to configuration file
|
347 |
375 |
-d,--debug : Include debug output
|
... | ... | |
349 |
377 |
-i,--include: Include protocol headers in the output
|
350 |
378 |
-s,--silent : Do not output anything
|
351 |
379 |
-v,--verbose: More info at response
|
|
380 |
|
|
381 |
* Connect VM with id 11687 to network with id 1409
|
352 |
382 |
[network]: connect 11687 1409
|
|
383 |
|
|
384 |
* Get details on network with id 1409
|
353 |
385 |
[network]:info 1409
|
354 |
386 |
attachments:
|
355 |
387 |
nic-11687-1
|
... | ... | |
365 |
397 |
status : ACTIVE
|
366 |
398 |
type : PRIVATE_MAC_FILTERED
|
367 |
399 |
updated : 2012-11-23T17:18:25.095225+00:00
|
|
400 |
|
|
401 |
* Get connectivity details on VM with id 11687 *
|
368 |
402 |
[network]:/server addr 11687
|
369 |
403 |
id: nic-11687-1
|
370 |
404 |
ipv4 : 192.168.1.1
|
... | ... | |
377 |
411 |
ipv6 : 2001:648:2ffc:1116:a80c:f2ff:fe12:a9e
|
378 |
412 |
mac_address : aa:0c:f2:12:0a:9e
|
379 |
413 |
network_id : 1369
|
380 |
|
[network]:
|
381 |
|
|
382 |
414 |
|
|
415 |
.. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
|
383 |
416 |
|
384 |
417 |
store (Storage/Pithos+)
|
385 |
418 |
"""""""""""""""""""""""
|
... | ... | |
420 |
453 |
versioning : Get versioning for account [or container ]
|
421 |
454 |
versions : Get the version list of an object
|
422 |
455 |
|
|
456 |
Showcase: Upload and download a file.
|
|
457 |
|
|
458 |
.. code-block:: console
|
|
459 |
:emphasize-lines: 1,7,11,16,21,29,33,37,41,44,51,55,60,64
|
|
460 |
|
|
461 |
* Create a random binarry file at current OS path *
|
|
462 |
[kamaki]:!dd bs=4M if=/dev/zero of=rndm_local.file count=5
|
|
463 |
5+0 records in
|
|
464 |
5+0 records out
|
|
465 |
20971520 bytes (21 MB) copied, 0.016162 s, 1.3 GB/s
|
|
466 |
|
|
467 |
* Enter store context *
|
|
468 |
[kamaki]:store
|
|
469 |
|
|
470 |
|
|
471 |
* Check local file *
|
|
472 |
[store]:!ls -lh rndm_local.file
|
|
473 |
-rw-rw-r-- 1 ******** ******** 20M Nov 26 15:36 rndm_local.file
|
|
474 |
|
|
475 |
|
|
476 |
* Create two containers *
|
|
477 |
[store]:create mycont1
|
|
478 |
[store]:create mycont2
|
|
479 |
|
|
480 |
|
|
481 |
* List accessible containers *
|
|
482 |
[store]:list
|
|
483 |
1. mycont1 (0B, 0 objects)
|
|
484 |
2. mycont2 (0B, 0 objects)
|
|
485 |
3. pithos (0B, 0 objects)
|
|
486 |
4. trash (0B, 0 objects)
|
|
487 |
|
|
488 |
|
|
489 |
* Upload local file to 1st container *
|
|
490 |
[store]:upload rndm_local.file mycont1
|
|
491 |
|
|
492 |
|
|
493 |
* Check if file has been uploaded *
|
|
494 |
[store]:list mycont1
|
|
495 |
1. 20M rndm_local.file
|
|
496 |
|
|
497 |
* Create director mydir on second container *
|
|
498 |
[store]:mkdir mycont2:mydir
|
|
499 |
|
|
500 |
|
|
501 |
* Move file from 1st to 2nd container (and in the directory) *
|
|
502 |
[store]:move mycont1:rndm_local.file mycont2:mydir/rndm_local.file
|
|
503 |
|
|
504 |
* Check the container of both containers *
|
|
505 |
[store]:list mycont1
|
|
506 |
[store]:list mycont2
|
|
507 |
1. D mydir/
|
|
508 |
2. 20M mydir/rndm_local.file
|
|
509 |
|
|
510 |
|
|
511 |
* Copy file from 2nd to 1st container, with a new name *
|
|
512 |
[store]:copy mycont2:mydir/rndm_local.file mycont1:rndm_remote.file
|
|
513 |
|
|
514 |
|
|
515 |
* Check pasted file *
|
|
516 |
[store]:list mycont1
|
|
517 |
1. 20M rndm_remote.file
|
|
518 |
|
|
519 |
|
|
520 |
* Download pasted file to local filesystem *
|
|
521 |
[store]:download mycont1:rndm_remote.file rndm_remote.file
|
|
522 |
|
|
523 |
|
|
524 |
* Check if file is downloaded and if it is the same to original *
|
|
525 |
[store]:!ls -lh *.file
|
|
526 |
-rw-rw-r-- 1 ******** ******** 20M Nov 26 15:36 rndm_local.file
|
|
527 |
-rw-rw-r-- 1 ******** ******** 20M Nov 26 15:42 rndm_remote.file
|
|
528 |
[store]:!diff rndm_local.file rndm_remote.file
|
|
529 |
|
|
530 |
.. Note:: In kamaki shell, ! is used to execute OS shell commands (bash in the above)
|
|
531 |
|
423 |
532 |
One-command interface
|
424 |
533 |
^^^^^^^^^^^^^^^^^^^^^
|
425 |
534 |
|
... | ... | |
433 |
542 |
To see the command groups, users should use -h or --help like in example 1.3.1. In the same way, help information for command groups and commands is printed. In the following examples, the help messages of kamaki, of a command group (server) and of a command in that group (list) are shown.
|
434 |
543 |
|
435 |
544 |
.. code-block:: console
|
|
545 |
:emphasize-lines: 1
|
|
546 |
|
|
547 |
Example 4.1.1: kamaki help shows available parameters and command groups
|
|
548 |
|
436 |
549 |
|
437 |
550 |
$ kamaki -h
|
438 |
|
usage: kamaki <cmd_group> [<cmd_subbroup> ...] <cmd> [-v] [-s] [-V] [-d] [-i]
|
439 |
|
[--config CONFIG]
|
440 |
|
[-o OPTIONS] [-h]
|
|
551 |
usage: kamaki <cmd_group> [<cmd_subbroup> ...] <cmd>
|
|
552 |
[-s] [-V] [-i] [--config CONFIG] [-o OPTIONS] [-h]
|
441 |
553 |
|
442 |
554 |
optional arguments:
|
443 |
555 |
-v, --verbose More info at response
|
... | ... | |
461 |
573 |
server : Compute/Cyclades API server commands
|
462 |
574 |
store : Pithos+ storage commands
|
463 |
575 |
|
|
576 |
.. code-block:: console
|
|
577 |
:emphasize-lines: 1
|
464 |
578 |
|
465 |
|
Example 4.1.1: kamaki help shows available parameters and command groups
|
|
579 |
Example 4.1.2: Cyclades help contains all first-level commands of cyclades command group
|
466 |
580 |
|
467 |
|
.. code-block:: console
|
468 |
581 |
|
469 |
582 |
$ kamaki cyclades -h
|
470 |
583 |
usage: kamaki server <...> [-v] [-s] [-V] [-d] [-i] [--config CONFIG]
|
... | ... | |
501 |
614 |
stats : Get server statistics
|
502 |
615 |
wait : Wait for server to finish [BUILD, STOPPED, REBOOT, ACTIVE]
|
503 |
616 |
|
|
617 |
.. code-block:: console
|
|
618 |
:emphasize-lines: 1
|
504 |
619 |
|
505 |
|
Example 4.1.2: Cyclades help contains all first-level commands of cyclades command group
|
|
620 |
Example 4.1.3: Help for command "server list" with syntax, description and avaiable user options
|
506 |
621 |
|
507 |
|
.. code-block:: console
|
508 |
622 |
|
509 |
623 |
$ kamaki server list -h
|
510 |
|
usage: kamaki server list [-v] [-s] [-V] [-d] [-i] [--config CONFIG]
|
511 |
|
[-o OPTIONS] [-h] [-l]
|
|
624 |
usage: kamaki server list [-V] [-i] [--config CONFIG] [-h] [-l]
|
512 |
625 |
|
513 |
626 |
List servers
|
514 |
627 |
|
... | ... | |
524 |
637 |
-h, --help Show help message
|
525 |
638 |
-l show detailed output
|
526 |
639 |
|
527 |
|
|
528 |
|
Example 4.1.3: Help for command "server list" with syntax, description and avaiable user options
|
529 |
|
|
530 |
640 |
Using history
|
531 |
641 |
"""""""""""""
|
532 |
642 |
|
... | ... | |
535 |
645 |
Every syntactically correct command is appended at the end of that file. In order to see how to use history, use the kamaki help system:
|
536 |
646 |
|
537 |
647 |
.. code-block:: console
|
|
648 |
:emphasize-lines: 1
|
|
649 |
|
|
650 |
Example 4.2.1: Available history options
|
|
651 |
|
538 |
652 |
|
539 |
653 |
$ kamaki history -h
|
540 |
654 |
...
|
541 |
655 |
clean: Clean up history
|
542 |
656 |
show : Show history
|
543 |
657 |
|
544 |
|
|
545 |
|
Example 4.2.1: Available history options
|
546 |
|
|
547 |
658 |
The following example showcases how to use history in kamaki
|
548 |
659 |
|
549 |
660 |
.. code-block:: console
|
|
661 |
:emphasize-lines: 1
|
|
662 |
|
|
663 |
Example 4.2.2: Clean up everything, run a kamaki command, show full and filtered history
|
|
664 |
|
550 |
665 |
|
551 |
666 |
$ kamaki history clean --match clean
|
552 |
667 |
$ kamaki server list
|
... | ... | |
558 |
673 |
1. kamaki server list
|
559 |
674 |
3. kamaki history show --match server
|
560 |
675 |
|
561 |
|
|
562 |
|
Example 4.2.2: Clean up everything, run a kamaki command, show full and filtered history
|
563 |
|
|
564 |
676 |
Debug
|
565 |
677 |
"""""
|
566 |
678 |
|
... | ... | |
575 |
687 |
|
576 |
688 |
To run kamaki in verbose mode use the -v or --verbose option
|
577 |
689 |
|
578 |
|
Client commands
|
579 |
|
"""""""""""""""
|
580 |
|
|
|
690 |
One-command features
|
|
691 |
""""""""""""""""""""
|
581 |
692 |
|
582 |
693 |
Kamaki commands can be used along with advanced shell features.
|
583 |
694 |
|
584 |
695 |
.. code-block:: console
|
|
696 |
:emphasize-lines: 1
|
|
697 |
|
|
698 |
Example 4.4.1: Print username for token us3rt0k3n== using grep
|
|
699 |
|
585 |
700 |
|
586 |
|
$ kamaki server list -l > vmlist.txt
|
|
701 |
$ kamaki astakos authenticate -o token=us3rt0k3n== | grep uniq
|
|
702 |
uniq : user@synnefo.org
|
587 |
703 |
|
|
704 |
The -o argument can be used to overide temporarily various (set or unset) options. In one command, all -o options are forgoten just after the command had been completed, and the previous settings are restored (the configuration file is not modified).
|
588 |
705 |
|
589 |
|
Example 4.4.1: Store a vm list in file vmlist.txt in a unix shell
|
|
706 |
The astakos-authenticate command in example 4.4.1 run against an explicitly provided token, which temporarily overode the token provided in the configuration file.
|
590 |
707 |
|
591 |
708 |
Interactive shell
|
592 |
709 |
^^^^^^^^^^^^^^^^^
|
593 |
710 |
|
|
711 |
Kamaki interactive shell is details in this section
|
|
712 |
|
|
713 |
Command Contexts
|
|
714 |
""""""""""""""""
|
|
715 |
|
|
716 |
The kamaki interactive shell implements the notion of command contexts. Each command group is also a context where the users can **enter** by typing the group name. If the context switch is succesful, the kamaki shell prompt changes to present the new context ("store" in example 5.1.1).
|
|
717 |
|
|
718 |
.. code-block:: console
|
|
719 |
:emphasize-lines: 1
|
|
720 |
|
|
721 |
Example 5.1.1: Enter store commands context/group
|
|
722 |
|
|
723 |
|
|
724 |
$ kamaki
|
|
725 |
[kamaki]:store
|
|
726 |
[store]:
|
|
727 |
|
|
728 |
Type **exit** or **ctrl-D** to exit a context and return to the context of origin. If already at the top context (kamaki), an exit is equivalent to exiting the programm.
|
|
729 |
|
|
730 |
.. code-block:: console
|
|
731 |
:emphasize-lines: 1
|
|
732 |
|
|
733 |
Example 5.1.2: Exit store context and then exit kamaki
|
|
734 |
|
|
735 |
[store]: exit
|
|
736 |
[kamaki]: exit
|
|
737 |
$
|
|
738 |
|
|
739 |
A user might **browse** through different contexts during one session.
|
|
740 |
|
|
741 |
.. code-block:: console
|
|
742 |
:emphasize-lines: 1
|
|
743 |
|
|
744 |
Example 5.1.3: Execute list command in different contexts
|
|
745 |
|
|
746 |
$ kamaki
|
|
747 |
[kamaki]:config
|
|
748 |
[config]:list
|
|
749 |
... (configuration options listing) ...
|
|
750 |
[config]:exit
|
|
751 |
[kamaki]:store
|
|
752 |
[store]:list
|
|
753 |
... (storage containers listing) ...
|
|
754 |
[store]:exit
|
|
755 |
[kamaki]:server
|
|
756 |
[server]:list
|
|
757 |
... (VMs listing) ...
|
|
758 |
[server]: exit
|
|
759 |
[kamaki]:
|
|
760 |
|
|
761 |
Users have the option to avoid switching between contexts: all commands can run from the **top context**. As a result, examples 5.1.3 and 5.1.4 are equivalent.
|
|
762 |
|
|
763 |
.. code-block:: console
|
|
764 |
:emphasize-lines: 1
|
|
765 |
|
|
766 |
Example 5.1.4: Execute different "list" commands from top context
|
|
767 |
|
|
768 |
|
|
769 |
[kamaki]:config list
|
|
770 |
... (configuration options listing) ...
|
|
771 |
[kamaki]:store list
|
|
772 |
... (storage container listing) ...
|
|
773 |
[kamaki]:server list
|
|
774 |
... (VMs listing) ...
|
|
775 |
[kamaki]:
|
|
776 |
|
|
777 |
Help
|
|
778 |
""""
|
|
779 |
|
|
780 |
There are two help mechanisms: a context-level and a command-level.
|
|
781 |
|
|
782 |
**Context-level help** lists the available commands in a context and can also offer a short description for each command.
|
|
783 |
|
|
784 |
Context-level help syntax::
|
|
785 |
|
|
786 |
* Show available commands in current context *
|
|
787 |
[context]:help
|
|
788 |
[context]:?
|
|
789 |
|
|
790 |
* Show help for command cmd *
|
|
791 |
[context]:help cmd
|
|
792 |
[context]:?cmd
|
|
793 |
|
|
794 |
The context-level help results change from context to context
|
|
795 |
|
|
796 |
.. code-block:: console
|
|
797 |
:emphasize-lines: 1
|
|
798 |
|
|
799 |
Example 5.2.1: Get available commands, pick a context and get help there as well
|
|
800 |
|
|
801 |
|
|
802 |
[kamaki]:help
|
|
803 |
|
|
804 |
kamaki commands:
|
|
805 |
================
|
|
806 |
astakos config flavor history image network server store
|
|
807 |
|
|
808 |
interactive shell commands:
|
|
809 |
===========================
|
|
810 |
exit help shell
|
|
811 |
|
|
812 |
[kamaki]:?config
|
|
813 |
Configuration commands (config -h for more options)
|
|
814 |
|
|
815 |
[kamaki]:config
|
|
816 |
|
|
817 |
[config]:?
|
|
818 |
|
|
819 |
config commands:
|
|
820 |
================
|
|
821 |
delete get list set
|
|
822 |
|
|
823 |
interactive shell commands:
|
|
824 |
===========================
|
|
825 |
exit help shell
|
|
826 |
|
|
827 |
[config]:help set
|
|
828 |
Set a configuration option (set -h for more options)
|
|
829 |
|
|
830 |
In context-level, there is a distinction between kamaki-commands and interactive shell commands. The former are available in one-command mode and are releated to the cloud client setup and use, while the later are context-shell functions.
|
|
831 |
|
|
832 |
**Command-level help** prints the syntax, arguments and description of a specific (terminal) command
|
|
833 |
|
|
834 |
Command-level help syntax::
|
|
835 |
|
|
836 |
* Get help for command cmd1 cmd2 ... cmdN *
|
|
837 |
[context]:cmd1 cmd2 ... cmdN -h
|
|
838 |
<syntax>
|
|
839 |
|
|
840 |
<description>
|
|
841 |
|
|
842 |
<arguments and possible extentions>
|
|
843 |
|
|
844 |
Command-level help mechanism is exactly the same as the one used in one-command mode. For example, it is invoked by using the -h or --help parameter at any point.
|
|
845 |
|
|
846 |
.. code-block:: console
|
|
847 |
:emphasize-lines: 1
|
|
848 |
|
|
849 |
Example 5.2.2: Get command-level help for config and config-set
|
|
850 |
|
|
851 |
|
|
852 |
[kamaki]:config --help
|
|
853 |
config: Configuration commands
|
|
854 |
delete: Delete a configuration option (and use the default value)
|
|
855 |
get : Show a configuration option
|
|
856 |
list : List configuration options
|
|
857 |
set : Set a configuration option
|
|
858 |
|
|
859 |
[kamaki]:config
|
|
860 |
|
|
861 |
[config]:set -h
|
|
862 |
usage: set <option> <value> [-v] [-d] [-h] [-i] [--config CONFIG] [-s]
|
|
863 |
|
|
864 |
Set a configuration option
|
|
865 |
|
|
866 |
optional arguments:
|
|
867 |
-v, --verbose More info at response
|
|
868 |
-d, --debug Include debug output
|
|
869 |
-h, --help Show help message
|
|
870 |
-i, --include Include protocol headers in the output
|
|
871 |
--config CONFIG Path to configuration file
|
|
872 |
-s, --silent Do not output anything
|
|
873 |
|
|
874 |
There are many ways of producing a help message, as shown in example 5.2.3
|
|
875 |
|
|
876 |
.. code-block:: console
|
|
877 |
:emphasize-lines: 1
|
|
878 |
|
|
879 |
Example 5.2.3: Equivalent calls of command-level help for config-set
|
|
880 |
|
|
881 |
|
|
882 |
[config]:set -h
|
|
883 |
[config]:set -help
|
|
884 |
[kamaki]:config set -h
|
|
885 |
[kamaki]:config set --help
|
|
886 |
[store]:/config set -h
|
|
887 |
[server]:/config set --help
|
|
888 |
|
|
889 |
Accessing top-level commands
|
|
890 |
""""""""""""""""""""""""""""
|
|
891 |
|
|
892 |
When working in a context, it is often usefull to access other contexts or top-level commands. Kamaki offers access to top-level commands by using the / prefix, as shown bellow::
|
|
893 |
|
|
894 |
* access a command "anothercontext cmd1 cmd2 ... cmdN"
|
|
895 |
[context]:/anothercontext cmd1 cmd2 ... cmdN
|
|
896 |
|
|
897 |
An example (5.3.1) that showcases how top-level access improves user experience is the creation of a VM. A VM is created with the command server-create. This command is called with three parameters:
|
|
898 |
|
|
899 |
* the name of the new VM
|
|
900 |
* the flavor id
|
|
901 |
* the image id
|
|
902 |
|
|
903 |
It is often the case that a user who works in the context command, needs to create a new VM, but doesn't know the flavor or image id of preference. Therefore, it is nessecary to list all available flavors (flavor-list) or images (image-list. Both commands belong to different contexts.
|
|
904 |
|
|
905 |
.. code-block:: console
|
|
906 |
:emphasize-lines: 1
|
|
907 |
|
|
908 |
Example 5.3.1: Create a VM from server context
|
|
909 |
|
|
910 |
[server]:create -h
|
|
911 |
create <name> <flavor id> <image id> ...
|
|
912 |
...
|
|
913 |
|
|
914 |
[server]:/flavor list
|
|
915 |
...
|
|
916 |
20. AFLAVOR
|
|
917 |
SNF:disk_template: drbd
|
|
918 |
cpu : 4
|
|
919 |
disk : 10
|
|
920 |
id : 43
|
|
921 |
ram : 2048
|
|
922 |
|
|
923 |
[server]:/image list
|
|
924 |
1580deb4-edb3-7a246c4c0528 (Ubuntu Desktop)
|
|
925 |
18a82962-43eb-8f8880af89d7 (Windows 7)
|
|
926 |
531aa018-9a40-a4bfe6a0caff (Windows XP)
|
|
927 |
6aa6eafd-dccb-67fe2bdde87e (Debian Desktop)
|
|
928 |
|
|
929 |
[server]:create 'my debian' 43 6aa6eafd-dccb-67fe2bdde87e
|
|
930 |
...
|
|
931 |
|
|
932 |
An other example (5.3.2) showcases how to aquire and modify configuration settings from a different context. In this case, user token changes while the user is working, so a token modification is needed.
|
|
933 |
|
|
934 |
.. code-block:: console
|
|
935 |
:emphasize-lines: 1
|
|
936 |
|
|
937 |
Example 5.3.2: Set a new token from store context
|
|
938 |
|
|
939 |
|
|
940 |
[store]:list
|
|
941 |
(401) UNAUTHORIZED Access denied
|
|
942 |
|
|
943 |
[store]:/astakos authenticate
|
|
944 |
(401) UNAUTHORIZED Invalid X-Auth-Token
|
|
945 |
|
|
946 |
[store]:/config get token
|
|
947 |
my3xp1r3dt0k3n==
|
|
948 |
|
|
949 |
[store]:/config set token myfr35ht0k3n==
|
|
950 |
|
|
951 |
[store]:/config get token
|
|
952 |
myfr35ht0k3n==
|
|
953 |
|
|
954 |
[store]:list
|
|
955 |
1. pithos (10MB, 2 objects)
|
|
956 |
2. trash (0B, 0 objects)
|
|
957 |
|
|
958 |
The following example presents some equivalent calls that call *astakos-authenticate* after a *store-list* 401 failure.
|
|
959 |
|
|
960 |
.. code-block:: console
|
|
961 |
:emphasize-lines: 1,3,10,17,28
|
|
962 |
|
|
963 |
Example 5.3.3: Equivalent astakos-authenticate calls after a store-list 401 failure
|
|
964 |
|
|
965 |
* one-command *
|
|
966 |
$ kamaki store list
|
|
967 |
(401) UNAUTHORIZED Access denied
|
|
968 |
$ kamaki astakos authenticate
|
|
969 |
...
|
|
970 |
$
|
|
971 |
|
|
972 |
* from top-level context *
|
|
973 |
[kamaki]:store list
|
|
974 |
(401) UNAUTHORIZED Access denied
|
|
975 |
[kamaki]:astakos authenticate
|
|
976 |
...
|
|
977 |
[kamaki]
|
|
978 |
|
|
979 |
* maximum typing *
|
|
980 |
[store]:list
|
|
981 |
(401) UNAUTHORIZED Access denied
|
|
982 |
[store]:exit
|
|
983 |
[kamaki]:astakos
|
|
984 |
[astakos]:authenticate
|
|
985 |
...
|
|
986 |
[astakos]:exit
|
|
987 |
[kamaki]:store
|
|
988 |
[store]:
|
|
989 |
|
|
990 |
* minimum typing *
|
|
991 |
[store]: list
|
|
992 |
(401) UNAUTHORIZED Access denied
|
|
993 |
[store]:/astakos authenticate
|
|
994 |
...
|
|
995 |
[store]:
|
|
996 |
|
|
997 |
Config
|
|
998 |
""""""
|
|
999 |
|
|
1000 |
History
|
|
1001 |
"""""""
|
|
1002 |
|
|
1003 |
Tab completion
|
|
1004 |
""""""""""""""
|
594 |
1005 |
|
|
1006 |
OS Shell integration
|
|
1007 |
""""""""""""""""""""
|
595 |
1008 |
|
596 |
|
Creating applications over the Clients API
|
|
1009 |
Creating applications with the Clients API
|
597 |
1010 |
------------------------------------------
|