ed2e44f1194211572d1d51ef50e7c6d5c66df126
[kamaki] / docs / commands.rst
1 List of commands
2 ================
3
4 The commands described bellow are grouped by service. The examples showcase a sample set of group commands. The kamaki interactive shell (check `Usage section <usage.html#interactive-shell>`_ for details) is chosen as the execution environment.
5
6
7 astakos (Identity Manager)
8 --------------------------
9
10 .. code-block:: text
11
12     authenticate:  Authenticate a user
13
14 Showcase: get user information
15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16
17 In the following, the token has been set in a previous step (see `setup section <setup.html>`_ or the `quick setup guide <usage.html#quick-setup>`_)
18
19 .. code-block:: console
20     :emphasize-lines: 1,4
21
22     * Enter astakos context *
23     [kamaki]:astakos
24
25     * Authenticate user *
26     [astakos]:authenticate
27     auth_token        :  s0m3t0k3nth@t1sr3m0v3d==
28     auth_token_created:  2012-11-13T14:12:40.917034
29     auth_token_expires:  2012-12-13T14:12:40.917035
30     groups            : 
31                       default
32     has_credits       :  False
33     has_signed_terms  :  True
34     uniq              :  myaccount@grnet.gr
35     username          :  4215th3b357num9323v32
36
37 flavor (Compute/Cyclades)
38 -------------------------
39
40 .. code-block:: text
41
42     info:  Get flavor details
43     list:  List flavors
44
45 Showcase: show details for flavor with id 43
46 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47
48 .. code-block:: console
49     :emphasize-lines: 1,4
50
51     * Enter flavor context *
52     [kamaki]: flavor
53
54     * Get details about flavor with id 43 *
55     [flavor]: info 43
56     SNF:disk_template:  drbd
57     cpu              :  4
58     disk             :  10
59     id               :  43
60     name             :  C4R2048D10
61     ram              :  2048
62
63 image (Compute/Cyclades + Plankton)
64 -----------------------------------
65
66 .. code-block:: text
67
68     addmember  :  Add a member to an image
69     addproperty:  Add an image property
70     delete     :  Delete image
71     delmember  :  Remove a member from an image
72     delproperty:  Delete an image property
73     info       :  Get image details
74     list       :  List images
75     members    :  Get image members
76     meta       :  Get image metadata
77     properties :  Get image properties
78     public     :  List public images
79     register   :  (Re)Register an image
80     setmembers :  Set the members of an image
81     setproperty:  Update an image property
82     shared     :  List shared images
83
84 Showcase: Pick an image and list the properties
85 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86
87 .. code-block:: console
88     :emphasize-lines: 1,4,18
89
90     * Enter image context *
91     [kamaki]:image
92
93     * list all available images *
94     [image]:list
95     1395fdfb-51b4-419f-bb02-f7d632860611 Ubuntu Desktop LTS
96     1580deb4-edb3-4496-a27f-7a246c4c0528 Ubuntu Desktop
97     18a82962-43eb-4b32-8e28-8f8880af89d7 Kubuntu LTS
98     6aa6eafd-dccb-422d-a904-67fe2bdde87e Debian Desktop
99     6b5681e4-7502-46ae-b1e9-9fd837932095 maelstrom
100     78262ee7-949e-4d70-af3a-85360c3de57a Windows Server 2012
101     86bc2414-0fb3-4898-a637-240292243302 Fedora
102     926ab1c5-2d85-49d4-aebe-0fce712789b9 Windows Server 2008
103     b2dffe52-64a4-48c3-8a4c-8214cc3165cf Debian Base
104     baf2321c-57a0-4a69-825d-49f49cea163a CentOS
105     c1d27b46-d875-4f5c-b7f1-f39b5af62905 Kubuntu
106
107     * Get properties of image with id b2dffe52-64a4-48c3-8a4c-8214cc3165cf *
108     [image]:properties b2dffe52-64a4-48c3-8a4c-8214cc3165cf
109     description   :  Debian 6.0.6 (Squeeze) Base System
110     gui           :  No GUI
111     kernel        :  2.6.32
112     os            :  debian
113     osfamily      :  linux
114     root_partition:  1
115     sortorder     :  1
116     users         :  root
117
118 server (Compute/Cyclades)
119 -------------------------
120
121 .. code-block:: text
122
123     addmeta :  Add server metadata
124     addr    :  List a server's nic address
125     console :  Get a VNC console
126     create  :  Create a server
127     delete  :  Delete a server
128     delmeta :  Delete server metadata
129     firewall:  Set the server's firewall profile
130     info    :  Get server details
131     list    :  List servers
132     meta    :  Get a server's metadata
133     reboot  :  Reboot a server
134     rename  :  Update a server's name
135     setmeta :  Update server's metadata
136     shutdown:  Shutdown a server
137     start   :  Start a server
138     stats   :  Get server statistics
139     wait    :  Wait for server to finish
140
141 Showcase: Create a server
142 ^^^^^^^^^^^^^^^^^^^^^^^^^
143
144 .. code-block:: console
145     :emphasize-lines: 1,4,21,35,44,62
146
147     * Enter server context *
148     [kamaki]:server
149
150     * See server-create help *
151     [server]:create -h
152     usage: create <name> <flavor id> <image id>
153             [--personality PERSONALITY] [-h] [--config CONFIG]
154
155     Create a server
156
157     optional arguments:
158       -v, --verbose         More info at response
159       --personality PERSONALITY
160                             add a personality file
161       -d, --debug           Include debug output
162       -h, --help            Show help message
163       -i, --include         Include protocol headers in the output
164       --config CONFIG       Path to configuration file
165       -s, --silent          Do not output anything
166
167     * List all available images *
168     [server]:/image list
169     1395fdfb-51b4-419f-bb02-f7d632860611 Ubuntu Desktop LTS
170     1580deb4-edb3-4496-a27f-7a246c4c0528 Ubuntu Desktop
171     18a82962-43eb-4b32-8e28-8f8880af89d7 Kubuntu LTS
172     6aa6eafd-dccb-422d-a904-67fe2bdde87e Debian Desktop
173     6b5681e4-7502-46ae-b1e9-9fd837932095 maelstrom
174     78262ee7-949e-4d70-af3a-85360c3de57a Windows Server 2012
175     86bc2414-0fb3-4898-a637-240292243302 Fedora
176     926ab1c5-2d85-49d4-aebe-0fce712789b9 Windows Server 2008
177     b2dffe52-64a4-48c3-8a4c-8214cc3165cf Debian Base
178     baf2321c-57a0-4a69-825d-49f49cea163a CentOS
179     c1d27b46-d875-4f5c-b7f1-f39b5af62905 Kubuntu
180
181     * See details of flavor with id 1 *
182     [server]:/flavor info 1
183     SNF:disk_template:  drbd
184     cpu              :  1
185     disk             :  20
186     id               :  1
187     name             :  C1R1024D20
188     ram              :  1024
189
190     * Create a debian server named 'My Small Debian Server'
191     [server]:create 'My Small Debian Server' 1 b2dffe52-64a4-48c3-8a4c-8214cc3165cf
192     adminPass:  L8gu2wbZ94
193     created  :  2012-11-23T16:56:04.190813+00:00
194     flavorRef:  1
195     hostId   :  
196     id       :  11687
197     imageRef :  b2dffe52-64a4-48c3-8a4c-8214cc3165cf
198     metadata : 
199              values: 
200                    os   :  debian
201                    users:  root
202     name     :  My Small Debian Server
203     progress :  0
204     status   :  BUILD
205     suspended:  False
206     updated  :  2012-11-23T16:56:04.761962+00:00
207
208     * wait for server to build (optional) *
209     [server]:wait 11687
210     Server 11687 still in BUILD mode |||||||||||||||||    | 80%
211     Server 11687 is now in ACTIVE mode
212
213 .. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
214
215 network (Compute/Cyclades)
216 --------------------------
217
218 .. code-block:: text
219
220     connect   :  Connect a server to a network
221     create    :  Create a network
222     delete    :  Delete a network
223     disconnect:  Disconnect a nic of a server to a network
224     info      :  Get network details
225     list      :  List networks
226     rename    :  Update network name
227
228 Showcase: Connect a network to a VM
229 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
230
231 .. code-block:: console
232     :emphasize-lines: 1,4,9,24,27,44
233
234     * Enter network context *
235     [kamaki]:network
236
237     * List user-owned VMs *
238     [network]:/server list
239     11687 (My Small Debian Server)
240     11688 (An Ubuntu server)
241
242     * Try network-connect (to get help) *
243     [network]:connect 
244     Syntax error
245     usage: connect <server id> <network id> [-s] [-h] [-i] [--config CONFIG]
246
247     Connect a server to a network
248
249     Syntax: connect  <server id> <network id>
250       --config    :  Path to configuration file
251       -d,--debug  :  Include debug output
252       -h,--help   :  Show help message
253       -i,--include:  Include protocol headers in the output
254       -s,--silent :  Do not output anything
255       -v,--verbose:  More info at response
256
257     * Connect VM with id 11687 to network with id 1409
258     [network]: connect 11687 1409
259
260     * Get details on network with id 1409
261     [network]:info 1409
262       attachments: 
263                  nic-11687-1
264       cidr       :  192.168.1.0/24
265       cidr6      :  None
266       created    :  2012-11-23T17:17:20.560098+00:00
267       dhcp       :  True
268       gateway    :  None
269       gateway6   :  None
270       id         :  1409
271       name       :  my network
272       public     :  False
273       status     :  ACTIVE
274       type       :  PRIVATE_MAC_FILTERED
275       updated    :  2012-11-23T17:18:25.095225+00:00
276
277     * Get connectivity details on VM with id 11687 *
278     [network]:/server addr 11687
279     id:  nic-11687-1
280         ipv4       :  192.168.1.1
281         ipv6       :  None
282         mac_address:  aa:0f:c2:0b:0e:85
283         network_id :  1409
284         firewallProfile:  DISABLED
285     id:  nic-11687-0
286         ipv4           :  83.212.106.111
287         ipv6           :  2001:648:2ffc:1116:a80c:f2ff:fe12:a9e
288         mac_address    :  aa:0c:f2:12:0a:9e
289         network_id     :  1369
290
291 .. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
292
293 store (Storage/Pithos+)
294 -----------------------
295
296 .. code-block:: text
297
298     append        :  Append local file to remote
299     cat           :  Print a file to console
300     copy          :  Copy an object
301     create        :  Create a container or a directory object
302     delete        :  Delete a container [or an object]
303     delgroup      :  Delete a user group on an account
304     delmeta       :  Delete an existing metadatum of account [, container [or object]]
305     delpermissions:  Delete all sharing permissions
306     download      :  Download a file
307     group         :  Get user groups details for account
308     hashmap       :  Get the hashmap of an object
309     info          :  Get information for account [, container [or object]]
310     list          :  List containers, object trees or objects in a directory
311     manifest      :  Create a remote file with uploaded parts by manifestation
312     meta          :  Get custom meta-content for account [, container [or object]]
313     mkdir         :  Create a directory
314     move          :  Copy an object
315     overwrite     :  Overwrite part (from start to end) of a remote file
316     permissions   :  Get object read/write permissions
317     publish       :  Publish an object
318     purge         :  Purge a container
319     quota         :  Get  quota for account [or container]
320     setgroup      :  Create/update a new user group on account
321     setmeta       :  Set a new metadatum for account [, container [or object]]
322     setpermissions:  Set sharing permissions
323     setquota      :  Set new quota (in KB) for account [or container]
324     setversioning :  Set new versioning (auto, none) for account [or container]
325     sharers       :  List the accounts that share objects with default account
326     truncate      :  Truncate remote file up to a size
327     unpublish     :  Unpublish an object
328     upload        :  Upload a file
329     versioning    :  Get  versioning for account [or container ]
330     versions      :  Get the version list of an object
331
332 Showcase: Upload and download a file
333 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
334
335 .. code-block:: console
336     :emphasize-lines: 1,7,11,16,21,29,33,37,41,44,51,55,60,64
337
338     * Create a random binarry file at current OS path *
339     [kamaki]:!dd bs=4M if=/dev/zero of=rndm_local.file count=5
340     5+0 records in
341     5+0 records out
342     20971520 bytes (21 MB) copied, 0.016162 s, 1.3 GB/s
343
344     * Enter store context *
345     [kamaki]:store
346
347
348     * Check local file *
349     [store]:!ls -lh rndm_local.file
350     -rw-rw-r-- 1 ******** ******** 20M Nov 26 15:36 rndm_local.file
351
352
353     * Create two containers *
354     [store]:create mycont1
355     [store]:create mycont2
356
357
358     * List accessible containers *    
359     [store]:list
360     1. mycont1 (0B, 0 objects)
361     2. mycont2 (0B, 0 objects)
362     3. pithos (0B, 0 objects)
363     4. trash (0B, 0 objects)
364
365
366     * Upload local file to 1st container *
367     [store]:upload rndm_local.file mycont1
368
369
370     * Check if file has been uploaded *
371     [store]:list mycont1
372     1.    20M rndm_local.file
373
374     * Create directory mydir on second container *
375     [store]:mkdir mycont2:mydir
376
377
378     * Move file from 1st to 2nd container (and in the directory) *
379     [store]:move mycont1:rndm_local.file mycont2:mydir/rndm_local.file
380
381     * Check contents of both containers *
382     [store]:list mycont1
383     [store]:list mycont2
384     1.      D mydir/
385     2.    20M mydir/rndm_local.file
386
387
388     * Copy file from 2nd to 1st container, with a new name *
389     [store]:copy mycont2:mydir/rndm_local.file mycont1:rndm_remote.file
390
391
392     * Check pasted file *
393     [store]:list mycont1
394     1.    20M rndm_remote.file
395
396
397     * Download pasted file to local file system *
398     [store]:download mycont1:rndm_remote.file rndm_remote.file
399
400
401     * Check if file is downloaded and if it is the same to original *
402     [store]:!ls -lh *.file
403     -rw-rw-r-- 1 ******** ******** 20M Nov 26 15:36 rndm_local.file
404     -rw-rw-r-- 1 ******** ******** 20M Nov 26 15:42 rndm_remote.file
405     [store]:!diff rndm_local.file rndm_remote.file
406
407 .. Note:: In kamaki shell, ! is used to execute OS shell commands (bash in the above)