Merge branch 'feature-logging' into develop
[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_created:  2012-11-13T14:12:40.917034
28     auth_token_expires:  2012-12-13T14:12:40.917035
29     email             :  
30                        myaccount@grnet.gr
31                        myotheraccount@grnet.gr
32     name              :  My Real Name
33     username          :  usually@an.email.org
34     uuid              :  ab1cde23-45fg-6h7i-8j9k-10l1m11no2pq
35
36 flavor (Compute/Cyclades)
37 -------------------------
38
39 .. code-block:: text
40
41     info:  Get flavor details
42     list:  List flavors
43
44 Showcase: show details for flavor with id 43
45 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46
47 .. code-block:: console
48     :emphasize-lines: 1,4
49
50     * Enter flavor context *
51     [kamaki]: flavor
52
53     * Get details about flavor with id 43 *
54     [flavor]: info 43
55     SNF:disk_template:  drbd
56     cpu              :  4
57     disk             :  10
58     id               :  43
59     name             :  C4R2048D10
60     ram              :  2048
61
62 image (Compute/Cyclades + Plankton)
63 -----------------------------------
64
65 .. code-block:: text
66
67     addmember  :  Add a member to an image
68     addproperty:  Add an image property
69     delete     :  Delete image
70     delmember  :  Remove a member from an image
71     delproperty:  Delete an image property
72     info       :  Get image details
73     list       :  List images
74     members    :  Get image members
75     meta       :  Get image metadata
76     properties :  Get image properties
77     public     :  List public images
78     register   :  (Re)Register an image
79     setmembers :  Set the members of an image
80     setproperty:  Update an image property
81     shared     :  List shared images
82
83 Showcase: Pick an image and list the properties
84 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
85
86 .. code-block:: console
87     :emphasize-lines: 1,4,18
88
89     * Enter image context *
90     [kamaki]:image
91
92     * list all available images *
93     [image]:list
94     1395fdfb-51b4-419f-bb02-f7d632860611 Ubuntu Desktop LTS
95     1580deb4-edb3-4496-a27f-7a246c4c0528 Ubuntu Desktop
96     18a82962-43eb-4b32-8e28-8f8880af89d7 Kubuntu LTS
97     6aa6eafd-dccb-422d-a904-67fe2bdde87e Debian Desktop
98     6b5681e4-7502-46ae-b1e9-9fd837932095 maelstrom
99     78262ee7-949e-4d70-af3a-85360c3de57a Windows Server 2012
100     86bc2414-0fb3-4898-a637-240292243302 Fedora
101     926ab1c5-2d85-49d4-aebe-0fce712789b9 Windows Server 2008
102     b2dffe52-64a4-48c3-8a4c-8214cc3165cf Debian Base
103     baf2321c-57a0-4a69-825d-49f49cea163a CentOS
104     c1d27b46-d875-4f5c-b7f1-f39b5af62905 Kubuntu
105
106     * Get properties of image with id b2dffe52-64a4-48c3-8a4c-8214cc3165cf *
107     [image]:properties b2dffe52-64a4-48c3-8a4c-8214cc3165cf
108     description   :  Debian 6.0.6 (Squeeze) Base System
109     gui           :  No GUI
110     kernel        :  2.6.32
111     os            :  debian
112     osfamily      :  linux
113     root_partition:  1
114     sortorder     :  1
115     users         :  root
116
117 server (Compute/Cyclades)
118 -------------------------
119
120 .. code-block:: text
121
122     addmeta :  Add server metadata
123     addr    :  List a server's nic address
124     console :  Get a VNC console
125     create  :  Create a server
126     delete  :  Delete a server
127     delmeta :  Delete server metadata
128     firewall:  Set the server's firewall profile
129     info    :  Get server details
130     list    :  List servers
131     meta    :  Get a server's metadata
132     reboot  :  Reboot a server
133     rename  :  Update a server's name
134     setmeta :  Update server's metadata
135     shutdown:  Shutdown a server
136     start   :  Start a server
137     stats   :  Get server statistics
138     wait    :  Wait for server to finish
139
140 Showcase: Create a server
141 ^^^^^^^^^^^^^^^^^^^^^^^^^
142
143 .. code-block:: console
144     :emphasize-lines: 1,4,21,35,44,62
145
146     * Enter server context *
147     [kamaki]:server
148
149     * See server-create help *
150     [server]:create -h
151     usage: create <name> <flavor id> <image id>
152             [--personality PERSONALITY] [-h] [--config CONFIG]
153
154     Create a server
155
156     optional arguments:
157       -v, --verbose         More info at response
158       --personality PERSONALITY
159                             add a personality file
160       -d, --debug           Include debug output
161       -h, --help            Show help message
162       -i, --include         Include protocol headers in the output
163       --config CONFIG       Path to configuration file
164       -s, --silent          Do not output anything
165
166     * List all available images *
167     [server]:/image list
168     1395fdfb-51b4-419f-bb02-f7d632860611 Ubuntu Desktop LTS
169     1580deb4-edb3-4496-a27f-7a246c4c0528 Ubuntu Desktop
170     18a82962-43eb-4b32-8e28-8f8880af89d7 Kubuntu LTS
171     6aa6eafd-dccb-422d-a904-67fe2bdde87e Debian Desktop
172     6b5681e4-7502-46ae-b1e9-9fd837932095 maelstrom
173     78262ee7-949e-4d70-af3a-85360c3de57a Windows Server 2012
174     86bc2414-0fb3-4898-a637-240292243302 Fedora
175     926ab1c5-2d85-49d4-aebe-0fce712789b9 Windows Server 2008
176     b2dffe52-64a4-48c3-8a4c-8214cc3165cf Debian Base
177     baf2321c-57a0-4a69-825d-49f49cea163a CentOS
178     c1d27b46-d875-4f5c-b7f1-f39b5af62905 Kubuntu
179
180     * See details of flavor with id 1 *
181     [server]:/flavor info 1
182     SNF:disk_template:  drbd
183     cpu              :  1
184     disk             :  20
185     id               :  1
186     name             :  C1R1024D20
187     ram              :  1024
188
189     * Create a debian server named 'My Small Debian Server'
190     [server]:create 'My Small Debian Server' 1 b2dffe52-64a4-48c3-8a4c-8214cc3165cf
191     adminPass:  L8gu2wbZ94
192     created  :  2012-11-23T16:56:04.190813+00:00
193     flavorRef:  1
194     hostId   :  
195     id       :  11687
196     imageRef :  b2dffe52-64a4-48c3-8a4c-8214cc3165cf
197     metadata : 
198              values: 
199                    os   :  debian
200                    users:  root
201     name     :  My Small Debian Server
202     progress :  0
203     status   :  BUILD
204     suspended:  False
205     updated  :  2012-11-23T16:56:04.761962+00:00
206
207     * wait for server to build (optional) *
208     [server]:wait 11687
209     Server 11687 still in BUILD mode |||||||||||||||||    | 80%
210     Server 11687 is now in ACTIVE mode
211
212 .. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
213
214 network (Compute/Cyclades)
215 --------------------------
216
217 .. code-block:: text
218
219     connect   :  Connect a server to a network
220     create    :  Create a network
221     delete    :  Delete a network
222     disconnect:  Disconnect a nic of a server to a network
223     info      :  Get network details
224     list      :  List networks
225     rename    :  Update network name
226
227 Showcase: Connect a network to a VM
228 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
229
230 .. code-block:: console
231     :emphasize-lines: 1,4,9,24,27,44
232
233     * Enter network context *
234     [kamaki]:network
235
236     * List user-owned VMs *
237     [network]:/server list
238     11687 (My Small Debian Server)
239     11688 (An Ubuntu server)
240
241     * Try network-connect (to get help) *
242     [network]:connect 
243     Syntax error
244     usage: connect <server id> <network id> [-s] [-h] [-i] [--config CONFIG]
245
246     Connect a server to a network
247
248     Syntax: connect  <server id> <network id>
249       --config    :  Path to configuration file
250       -d,--debug  :  Include debug output
251       -h,--help   :  Show help message
252       -i,--include:  Include protocol headers in the output
253       -s,--silent :  Do not output anything
254       -v,--verbose:  More info at response
255
256     * Connect VM with id 11687 to network with id 1409
257     [network]: connect 11687 1409
258
259     * Get details on network with id 1409
260     [network]:info 1409
261       attachments: 
262                  nic-11687-1
263       cidr       :  192.168.1.0/24
264       cidr6      :  None
265       created    :  2012-11-23T17:17:20.560098+00:00
266       dhcp       :  True
267       gateway    :  None
268       gateway6   :  None
269       id         :  1409
270       name       :  my network
271       public     :  False
272       status     :  ACTIVE
273       type       :  PRIVATE_MAC_FILTERED
274       updated    :  2012-11-23T17:18:25.095225+00:00
275
276     * Get connectivity details on VM with id 11687 *
277     [network]:/server addr 11687
278     id:  nic-11687-1
279         ipv4       :  192.168.1.1
280         ipv6       :  None
281         mac_address:  aa:0f:c2:0b:0e:85
282         network_id :  1409
283         firewallProfile:  DISABLED
284     id:  nic-11687-0
285         ipv4           :  83.212.106.111
286         ipv6           :  2001:648:2ffc:1116:a80c:f2ff:fe12:a9e
287         mac_address    :  aa:0c:f2:12:0a:9e
288         network_id     :  1369
289
290 .. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
291
292 store (Storage/Pithos+)
293 -----------------------
294
295 .. code-block:: text
296
297     append        :  Append local file to remote
298     cat           :  Print a file to console
299     copy          :  Copy an object
300     create        :  Create a container
301     delete        :  Delete a container [or an object]
302     delgroup      :  Delete a user group
303     delmeta       :  Delete an existing metadatum for an account [, container [or object]]
304     delpermissions:  Delete all sharing permissions
305     download      :  Download a file
306     group         :  Get user groups details
307     hashmap       :  Get the hashmap of an object
308     info          :  Get information for account [, container [or object]]
309     list          :  List containers, object trees or objects in a directory
310     manifest      :  Create a remote file with uploaded parts by manifestation
311     meta          :  Get custom meta-content for account [, container [or object]]
312     mkdir         :  Create a directory
313     move          :  Copy an object
314     overwrite     :  Overwrite part (from start to end) of a remote file
315     permissions   :  Get object read/write permissions
316     publish       :  Publish an object
317     purge         :  Purge a container
318     quota         :  Get  quota for account [or container]
319     setgroup      :  Create/update a new user group
320     setmeta       :  Set a new metadatum for account [, container [or object]]
321     setpermissions:  Set sharing permissions
322     setquota      :  Set new quota (in KB) for account [or container]
323     setversioning :  Set new versioning (auto, none) for account [or container]
324     sharers       :  List the accounts that share objects with default account
325     touch         :  Create an empty object (file)
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)
408
409 .. warning:: The container:object/path syntax does not function if the container and / or the object path contain one or more : characters. To use containers and objects with : use the --container and --dst-container arguments, e.g. to copy test.py object from grnet:dev container to grnet:deploy ::
410
411         $ kamaki store copy --container=grnet:dev test.py --dst-container=grnet:deploy