Revision f5362960

b/docs/collection_of_examples/configuration.rst
1
Configuration
2
=============
3

  
4
Since kamaki 0.9, the format of the configuration file has changed. In this
5
scenario, we have an old configuration file at ${HOME}/.kamakirc that we need
6
to convert. We also create a new one from scratch. In both cases, we have to
7
set up one or more clouds in a single configuration and we also examine a case
8
of multiple configurations.
9

  
10
Convert old configuration file
11
------------------------------
12

  
13
First, back up the old file
14

  
15
.. code-block:: console
16

  
17
    $ cp ~/.kamakirc ~/backups/.kamakirc
18

  
19
Now, let kamaki do the conversion
20

  
21
.. code-block:: console
22

  
23
    $ kamaki user authenticate
24
    . Config file format version >= 9.0 is required
25
    . Configuration file: /home/someuser/.kamakirc
26
    . Attempting to fix this:
27
    . Calculating changes while preserving information
28
    . ... rescue global.token => cloud.default.token
29
    . ... rescue user.cli => global.user_cli
30
    . ... rescue network.cli => global.network_cli
31
    . ... rescue file.cli => global.file_cli
32
    . ... rescue flavor.cli => global.flavor_cli
33
    . ... rescue config.cli => global.config_cli
34
    . ... rescue image.cli => global.image_cli
35
    . ... rescue server.cli => global.server_cli
36
    . ... rescue history.file => global.history_file
37
    . ... rescue history.cli => global.history_cli
38
    . ... DONE
39
    . The following information will NOT be preserved:
40
    .     global.account = AccountName
41
    .     user.url = https://accounts.example.com
42
    .     user.account = UserAccountName
43
    .     compute.url = https://cyclades.example.com/api/v1.1
44
    .     file.url = https://pithos.example.com/v1
45
    .     image.url = https://cyclades.example.com/plankton
46
    .     store.account = OldForgotenAccountName
47
    . Kamaki is ready to convert the config file
48
    . Create (overwrite) file .kamakirc.okeanos ? [y/N]
49
    .
50
    <y is pressed>
51
    .
52
    . No cloud "default" is configured
53
    . |  To configure a new cloud "default", find and set the
54
    . |  single authentication URL and token:
55
    . |    kamaki config set cloud.default.url <URL>
56
    . |    kamaki config set cloud.default.token <t0k3n>
57
    $
58

  
59
.. warning:: A new cloud configuration with the name "default" is created. The
60
    global token that was set in the old configuration file, is preserved as
61
    the token of the "default" cloud. Still, kamaki needs a url for the cloud
62
    and it encourages you to reset the token as well.
63

  
64
.. note:: Some options are discarded. Among them, are the service urls, like
65
    user.url, compute.url, image.url and file.url . These settings are obsolete
66
    since Synnefo 0.14 and kamaki 0.9 so you do not need to recover them. The
67
    same is true for user accounts (retrieved automatically)
68

  
69
.. note:: You can safely remove the global.XXX_cli options from kamaki
70
    configuration file. Kamaki can automatically resolve the default values for
71
    these internal options. These options are usefull when overloading the
72
    default command behaviors, but are not needed otherwise.
73

  
74
Attempt to create a new configuration
75
-------------------------------------
76

  
77
Ask kamaki to load from a non-existing configuration file
78

  
79
.. code-block:: console
80

  
81
    $ kamaki -c nonexisting.cnf user authenticate
82
    . No cloud is configured
83
    . |  To configure a new cloud "<cloud name>", find and set the
84
    . |  single authentication URL and token:
85
    . |    kamaki config set cloud.<cloud name>.url <URL>
86
    . |    kamaki config set cloud.<cloud name>.token <t0k3n>
87
    $ ls -l nonexisting.cnf
88
    . ls: cannot access nonexisting.cnf: No such file or directory
89
    $
90

  
91
.. note:: configuration file is not created, but it will be when we set the
92
    first configuration value in it, as shown in the following subsection.
93

  
94
Configure a cloud and create a new configuration
95
------------------------------------------------
96

  
97
Set the URL for new cloud "mytest"
98

  
99
.. code-block:: console
100

  
101
    $ kamaki -c nonexisting.cnf config set cloud.mytest.url https://accounts.example.com/identity/v2.0/
102

  
103
Try to connect
104

  
105
.. code-block:: console
106

  
107
    $ kamaki -c nonexisting.cnf user authenticate
108
    . No authentication token provided for cloud "mytest"
109
    . |  Set a token for cloud mytest:
110
    . |    kamaki config set cloud.mytest.token <token>
111

  
112
Set token to cloud "mytest"
113

  
114
.. code-block:: console
115

  
116
    $ kamaki -c nonexisting.cnf config set cloud.mytest.token myt35t70k3n==
117

  
118
Check that the file is created, everything is set up correctly and working
119

  
120
.. code-block:: console
121

  
122
    $ ls -l nonexisting.cnf
123
    . -rw======- 1 someuser someuser 491 Jun 17 13:39 nonexisting.cnf
124
    $ kamaki -c nonexisting.cnf config get cloud
125
    . cloud.mytest.url = https://accounts.example.com/identity/v2.0/
126
    . cloud.mytest.token = myt35t70k3n==
127
    $ kamaki -c nonexisting.cnf user autenticate
128
    . ...
129
    . user:          
130
    .     id:          s0me-3x4mp13-u53r-1d
131
    .     name:        Some User
132
    .     roles:      
133
    .          id:   1
134
    .          name: default
135
    .     roles_links:
136
    $
137

  
138
Failed or incomplete cloud configurations
139
-----------------------------------------
140

  
141
Now let kamaki use the default configuration ( ${HOME}/.kamakirc ). Let the old
142
token be `my0ld70k3n==` and let it be invalid.
143

  
144
Check for clouds and attempt to authenticate
145

  
146
.. code-block:: console
147

  
148
    $ kamaki config get cloud
149
    . cloud.default.token = my0ld70k3n==
150
    $ kamaki user authenticate
151
    . No authentication URL provided for cloud "mytest"
152
    . |  Set a URL for cloud mytest:
153
    . |    kamaki config set cloud.mytest.url <URL>
154
    $
155

  
156
Set a non-existing URL for cloud.default and attempt authentication
157

  
158
.. code-block:: console
159

  
160
    $ kamaki config set cloud.default.url https://nonexisting.example.com
161
    $ kamaki user authenticate
162
    . Failed while http-connecting to https://nonexisting.example.com
163
    $
164

  
165
Set the URL from the previous example and attempt authentication
166

  
167
.. code-block:: console
168

  
169
    $ kamaki config set cloud.default.url https://accounts.example.com/identity/v2.0/
170
    $ kamaki user authenticate
171
    . (401) Authorization failed for token gZH99orgkfYHmGksZKvHJw==
172
    . |  UNAUTHORIZED unauthorized (Invalid token)
173
    $
174

  
175
After some searching at the deployments UI, you found out that the URL/token
176
pair you need is::
177

  
178
    URL: https://accounts.deploymentexample.com/identity/v2.0
179
    TOKEN: myd3pl0ym3nt70k3n==
180

  
181
Set up the correct values and attempt authentication
182

  
183
.. code-block:: console
184

  
185
    $ kamaki config set cloud.default.url https://accounts.deploymentexample.com/identity/v2.0
186
    $ kamaki config set cloud.default.token myd3pl0ym3nt70k3n==
187
    $ kamaki user authenticate
188
    . ...
189
    . user:
190
    .     id: my-d3pl0ym3nt-u53r-1d
191
    .     name: Example Username
192
    $
193

  
194
Multiple clouds in a single configuration
195
-----------------------------------------
196

  
197
We now have two configurations::
198

  
199
    Configuration file: ${HOME}/.kamakirc    (default)
200
      Clouds:
201
        ALIAS: default
202
        URL: https://accounts.deploymentexample.com/identity/v2.0
203
        TOKEN: myd3pl0ym3nt70k3n==
204

  
205
    Copnfiguration file: nonexisting.cnf
206
      Clouds:
207
        ALIAS: mytest
208
        URL: https://accounts.example.com/identity/v2.0/
209
        TOKEN: myt35t70k3n==
210

  
211
As we can see, the default configuration handles only one cloud, aliased as
212
"default". We will add the second cloud as well.
213

  
214
.. code-block:: console
215

  
216
    $ kamaki config set cloud.mytest.url https://accounts.example.com/identity/v2.0/
217
    $ kamaki config set cloud.mytest.token myt35t70k3n==
218
    $
219

  
220
Check all clouds
221

  
222
.. code-block:: console
223

  
224
    $ kamaki config get cloud
225
    . cloud.default.url = https://accounts.deploymentexample.com/identity/v2.0/
226
    . cloud.default.token = myd3pl0ym3nt70k3n==
227
    . cloud.mytest.url = https://accounts.example.com/identity/v2.0/
228
    . cloud.mytest.token = myt35t70k3n==
229
    $
230

  
231
Check if kamaki knows one of the clouds to be the default
232

  
233
.. code-block:: console
234

  
235
    $ kamaki config get default_cloud
236
    . default
237
    $
238

  
239
Authenticate against different clouds
240

  
241
.. code-block:: console
242

  
243
    $ kamaki user authenticate
244
    . ...
245
    . <response from deploymentexample.com>
246
    . ...
247
    $ kamaki ==cloud=mytest user authenticate
248
    . ...
249
    . <response from example.com>
250
    . ...
251
    $ kamaki ==cloud=default user authenticate
252
    . ...
253
    . <response from deploymentexample.com, same as default behavior>
254
    . ...
255
    $ kamaki ==cloud=nonexistingcloud user authenticate
256
    . No cloud "nonexistingcloud" is configured
257
    . |  To configure a new cloud "nonexistingcloud", find and set the
258
    . |  single authentication URL and token:
259
    . |    kamaki config set cloud.nonexistingcloud.url <URL>
260
    . |    kamaki config set cloud.nonexistingcloud.token <t0k3n>
261
    $
262

  
263
Confuse kamaki by removing the default_cloud option, set mytest as default
264

  
265
.. code-block:: console
266

  
267
    $ kamaki config delete default_cloud
268
    $ kamaki user authenticate
269
    . Found 2 clouds but none of them is set as default
270
    . |  Please, choose one of the following cloud names:
271
    . |  default, mytest
272
    . |  To set a default cloud:
273
    . |    kamaki config set default_cloud <cloud name>
274
    $ kamaki config set default_cloud mytest
275
    $ kamaki user authenticate
276
    . ...
277
    . <response from example.com>
278
    . ...
279
    $
280

  
281
`Question`: What will happen if the "default" cloud alias **and** the
282
default_cloud option are removed?
283

  
284
.. code-block:: console
285

  
286
    $ kamaki config delete cloud.default
287
    $ kamaki config delete default_cloud
288
    $ kamaki user authenticate
289
    . ...
290
    . <response from example.com>
291
    . ...
292
    $
293

  
294
`Answer`: kamaki doesn't have a default_cloud option, but there is only one
295
cloud configuration (`mytest`), therefore there is no ambiguity in resolving
296
the default cloud.
297

  
298
Multiple configurations
299
-----------------------
300

  
301
In the following example, a user wants to experiment with upload and download
302
for different number of threads. The plan is to contuct a set of tests with 3
303
threads at most and another one with 5. All experiments will be run against the
304
same Synnefo cloud (the "mytest" cloud from the previous example).
305

  
306
Let's create the 3-threaded configuration first
307

  
308
.. code-block:: console
309

  
310
    $ kamaki -c 3thread config set cloud.test.url https://accounts.example.com/identity/v2.0/
311
    $ kamaki -c 3thread config set cloud.test.token myt35t70k3n==
312
    $
313

  
314
Let's set the max_thread option to 3 as well as a seperate file for logs.
315

  
316
.. code-block:: console
317

  
318
    $ kamaki -c 3thread config set max_thread 3
319
    $ kamaki -c 3thread config log_file ./logs/kamaki.3threads.log
320
    $
321

  
322
Now, let's create the 5-threaded configuration by modifying a copy of 3thread
323

  
324
.. code-block:: console
325

  
326
    $ cp 3thread 5thread
327
    $ kamaki -c 5thread config set max_thread 5
328
    $ kamaki -c 5thread config log_file ./logs/kamaki.5threads.log
329
    $
330

  
331
Use kamaki to upload with 3 threads and 5 threads respectively
332

  
333
.. code-block:: console
334

  
335
    $ kamaki -c 3thread file upload testfiles/test1 testcontainer
336
    $ kamaki -c 5thread file upload testfiles/test1 testcontainer
337
    $
b/docs/collection_of_examples/examples.rst
1
Examples
2
========
3

  
4
This section contains a collection of the most common operations with kamaki.
5

  
6
.. note:: all examples bellow use `bash` in a linux enviroment, but they can be
7
    replicated in a reasonable command line shell in any popular platform.
8

  
9
Configuration
10
-------------
11

  
12
Since kamaki 0.9, the format of the configuration file has changed. In this
13
scenario, we have an old configuration file at ${HOME}/.kamakirc that we need
14
to convert. We also create a new one from scratch. In both cases, we have to
15
set up one or more clouds in a single configuration and we also examine a case
16
of multiple configurations.
17

  
18
Convert old configuration file
19
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20

  
21
First, back up the old file
22

  
23
.. code-block:: console
24

  
25
    $ cp ~/.kamakirc ~/backups/.kamakirc
26

  
27
Now, let kamaki do the conversion
28

  
29
.. code-block:: console
30

  
31
    $ kamaki user authenticate
32
    . Config file format version >= 9.0 is required
33
    . Configuration file: /home/someuser/.kamakirc
34
    . Attempting to fix this:
35
    . Calculating changes while preserving information
36
    . ... rescue global.token => cloud.default.token
37
    . ... rescue user.cli => global.user_cli
38
    . ... rescue network.cli => global.network_cli
39
    . ... rescue file.cli => global.file_cli
40
    . ... rescue flavor.cli => global.flavor_cli
41
    . ... rescue config.cli => global.config_cli
42
    . ... rescue image.cli => global.image_cli
43
    . ... rescue server.cli => global.server_cli
44
    . ... rescue history.file => global.history_file
45
    . ... rescue history.cli => global.history_cli
46
    . ... DONE
47
    . The following information will NOT be preserved:
48
    .     global.account = AccountName
49
    .     user.url = https://accounts.example.com
50
    .     user.account = UserAccountName
51
    .     compute.url = https://cyclades.example.com/api/v1.1
52
    .     file.url = https://pithos.example.com/v1
53
    .     image.url = https://cyclades.example.com/plankton
54
    .     store.account = OldForgotenAccountName
55
    . Kamaki is ready to convert the config file
56
    . Create (overwrite) file .kamakirc.okeanos ? [y/N]
57
    .
58
    <y is pressed>
59
    .
60
    . No cloud "default" is configured
61
    . |  To configure a new cloud "default", find and set the
62
    . |  single authentication URL and token:
63
    . |    kamaki config set cloud.default.url <URL>
64
    . |    kamaki config set cloud.default.token <t0k3n>
65
    $
66

  
67
.. warning:: A new cloud configuration with the name "default" is created. The
68
    global token that was set in the old configuration file, is preserved as
69
    the token of the "default" cloud. Still, kamaki needs a url for the cloud
70
    and it encourages you to reset the token as well.
71

  
72
.. note:: Some options are discarded. Among them, are the service urls, like
73
    user.url, compute.url, image.url and file.url . These settings are obsolete
74
    since Synnefo 0.14 and kamaki 0.9 so you do not need to recover them. The
75
    same is true for user accounts (retrieved automatically)
76

  
77
.. note:: You can safely remove the global.XXX_cli options from kamaki
78
    configuration file. Kamaki can automatically resolve the default values for
79
    these internal options. These options are usefull when overloading the
80
    default command behaviors, but are not needed otherwise.
81

  
82
Attempt to create a new configuration
83
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84

  
85
Ask kamaki to load from a non-existing configuration file
86

  
87
.. code-block:: console
88

  
89
    $ kamaki -c nonexisting.cnf user authenticate
90
    . No cloud is configured
91
    . |  To configure a new cloud "<cloud name>", find and set the
92
    . |  single authentication URL and token:
93
    . |    kamaki config set cloud.<cloud name>.url <URL>
94
    . |    kamaki config set cloud.<cloud name>.token <t0k3n>
95
    $ ls -l nonexisting.cnf
96
    . ls: cannot access nonexisting.cnf: No such file or directory
97
    $
98

  
99
.. note:: configuration file is not created, but it will be when we set the
100
    first configuration value in it, as shown in the following subsection.
101

  
102
Configure a cloud and create a new configuration
103
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104

  
105
Set the URL for new cloud "mytest"
106

  
107
.. code-block:: console
108

  
109
    $ kamaki -c nonexisting.cnf config set cloud.mytest.url https://accounts.example.com/identity/v2.0/
110

  
111
Try to connect
112

  
113
.. code-block:: console
114

  
115
    $ kamaki -c nonexisting.cnf user authenticate
116
    . No authentication token provided for cloud "mytest"
117
    . |  Set a token for cloud mytest:
118
    . |    kamaki config set cloud.mytest.token <token>
119

  
120
Set token to cloud "mytest"
121

  
122
.. code-block:: console
123

  
124
    $ kamaki -c nonexisting.cnf config set cloud.mytest.token myt35t70k3n==
125

  
126
Check that the file is created, everything is set up correctly and working
127

  
128
.. code-block:: console
129

  
130
    $ ls -l nonexisting.cnf
131
    . -rw------- 1 someuser someuser 491 Jun 17 13:39 nonexisting.cnf
132
    $ kamaki -c nonexisting.cnf config get cloud
133
    . cloud.mytest.url = https://accounts.example.com/identity/v2.0/
134
    . cloud.mytest.token = myt35t70k3n==
135
    $ kamaki -c nonexisting.cnf user autenticate
136
    . ...
137
    . user:          
138
    .     id:          s0me-3x4mp13-u53r-1d
139
    .     name:        Some User
140
    .     roles:      
141
    .          id:   1
142
    .          name: default
143
    .     roles_links:
144
    $
145

  
146
Failed or incomplete cloud configurations
147
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
148

  
149
Now let kamaki use the default configuration ( ${HOME}/.kamakirc ). Let the old
150
token be `my0ld70k3n==` and let it be invalid.
151

  
152
Check for clouds and attempt to authenticate
153

  
154
.. code-block:: console
155

  
156
    $ kamaki config get cloud
157
    . cloud.default.token = my0ld70k3n==
158
    $ kamaki user authenticate
159
    . No authentication URL provided for cloud "mytest"
160
    . |  Set a URL for cloud mytest:
161
    . |    kamaki config set cloud.mytest.url <URL>
162
    $
163

  
164
Set a non-existing URL for cloud.default and attempt authentication
165

  
166
.. code-block:: console
167

  
168
    $ kamaki config set cloud.default.url https://nonexisting.example.com
169
    $ kamaki user authenticate
170
    . Failed while http-connecting to https://nonexisting.example.com
171
    $
172

  
173
Set the URL from the previous example and attempt authentication
174

  
175
.. code-block:: console
176

  
177
    $ kamaki config set cloud.default.url https://accounts.example.com/identity/v2.0/
178
    $ kamaki user authenticate
179
    . (401) Authorization failed for token gZH99orgkfYHmGksZKvHJw==
180
    . |  UNAUTHORIZED unauthorized (Invalid token)
181
    $
182

  
183
After some searching at the deployments UI, you found out that the URL/token
184
pair you need is::
185

  
186
    URL: https://accounts.deploymentexample.com/identity/v2.0
187
    TOKEN: myd3pl0ym3nt70k3n==
188

  
189
Set up the correct values and attempt authentication
190

  
191
.. code-block:: console
192

  
193
    $ kamaki config set cloud.default.url https://accounts.deploymentexample.com/identity/v2.0
194
    $ kamaki config set cloud.default.token myd3pl0ym3nt70k3n==
195
    $ kamaki user authenticate
196
    . ...
197
    . user:
198
    .     id: my-d3pl0ym3nt-u53r-1d
199
    .     name: Example Username
200
    $
201

  
202
Multiple clouds in a single configuration
203
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
204

  
205
We now have two configurations::
206

  
207
    Configuration file: ${HOME}/.kamakirc    (default)
208
      Clouds:
209
        ALIAS: default
210
        URL: https://accounts.deploymentexample.com/identity/v2.0
211
        TOKEN: myd3pl0ym3nt70k3n==
212

  
213
    Copnfiguration file: nonexisting.cnf
214
      Clouds:
215
        ALIAS: mytest
216
        URL: https://accounts.example.com/identity/v2.0/
217
        TOKEN: myt35t70k3n==
218

  
219
As we can see, the default configuration handles only one cloud, aliased as
220
"default". We will add the second cloud as well.
221

  
222
.. code-block:: console
223

  
224
    $ kamaki config set cloud.mytest.url https://accounts.example.com/identity/v2.0/
225
    $ kamaki config set cloud.mytest.token myt35t70k3n==
226
    $
227

  
228
Check all clouds
229

  
230
.. code-block:: console
231

  
232
    $ kamaki config get cloud
233
    . cloud.default.url = https://accounts.deploymentexample.com/identity/v2.0/
234
    . cloud.default.token = myd3pl0ym3nt70k3n==
235
    . cloud.mytest.url = https://accounts.example.com/identity/v2.0/
236
    . cloud.mytest.token = myt35t70k3n==
237
    $
238

  
239
Check if kamaki knows one of the clouds to be the default
240

  
241
.. code-block:: console
242

  
243
    $ kamaki config get default_cloud
244
    . default
245
    $
246

  
247
Authenticate against different clouds
248

  
249
.. code-block:: console
250

  
251
    $ kamaki user authenticate
252
    . ...
253
    . <response from deploymentexample.com>
254
    . ...
255
    $ kamaki --cloud=mytest user authenticate
256
    . ...
257
    . <response from example.com>
258
    . ...
259
    $ kamaki --cloud=default user authenticate
260
    . ...
261
    . <response from deploymentexample.com, same as default behavior>
262
    . ...
263
    $ kamaki --cloud=nonexistingcloud user authenticate
264
    . No cloud "nonexistingcloud" is configured
265
    . |  To configure a new cloud "nonexistingcloud", find and set the
266
    . |  single authentication URL and token:
267
    . |    kamaki config set cloud.nonexistingcloud.url <URL>
268
    . |    kamaki config set cloud.nonexistingcloud.token <t0k3n>
269
    $
270

  
271
Confuse kamaki by removing the default_cloud option, set mytest as default
272

  
273
.. code-block:: console
274

  
275
    $ kamaki config delete default_cloud
276
    $ kamaki user authenticate
277
    . Found 2 clouds but none of them is set as default
278
    . |  Please, choose one of the following cloud names:
279
    . |  default, mytest
280
    . |  To set a default cloud:
281
    . |    kamaki config set default_cloud <cloud name>
282
    $ kamaki config set default_cloud mytest
283
    $ kamaki user authenticate
284
    . ...
285
    . <response from example.com>
286
    . ...
287
    $
288

  
289
`Question`: What will happen if the "default" cloud alias **and** the
290
default_cloud option are removed?
291

  
292
.. code-block:: console
293

  
294
    $ kamaki config delete cloud.default
295
    $ kamaki config delete default_cloud
296
    $ kamaki user authenticate
297
    . ...
298
    . <response from example.com>
299
    . ...
300
    $
301

  
302
`Answer`: kamaki doesn't have a default_cloud option, but there is only one
303
cloud configuration (`mytest`), therefore there is no ambiguity in resolving
304
the default cloud.
305

  
306
Multiple configurations
307
^^^^^^^^^^^^^^^^^^^^^^^
308

  
309
In the following example, a user wants to experiment with upload and download
310
for different number of threads. The plan is to contuct a set of tests with 3
311
threads at most and another one with 5. All experiments will be run against the
312
same Synnefo cloud (the "mytest" cloud from the previous example).
313

  
314
Let's create the 3-threaded configuration first
315

  
316
.. code-block:: console
317

  
318
    $ kamaki -c 3thread config set cloud.test.url https://accounts.example.com/identity/v2.0/
319
    $ kamaki -c 3thread config set cloud.test.token myt35t70k3n==
320
    $
321

  
322
Let's set the max_thread option to 3 as well as a seperate file for logs.
323

  
324
.. code-block:: console
325

  
326
    $ kamaki -c 3thread config set max_thread 3
327
    $ kamaki -c 3thread config log_file ./logs/kamaki.3threads.log
328
    $
329

  
330
Now, let's create the 5-threaded configuration by modifying a copy of 3thread
331

  
332
.. code-block:: console
333

  
334
    $ cp 3thread 5thread
335
    $ kamaki -c 5thread config set max_thread 5
336
    $ kamaki -c 5thread config log_file ./logs/kamaki.5threads.log
337
    $
338

  
339
Use kamaki to upload with 3 threads and 5 threads respectively
340

  
341
.. code-block:: console
342

  
343
    $ kamaki -c 3thread file upload testfiles/test1 testcontainer
344
    $ kamaki -c 5thread file upload testfiles/test1 testcontainer
345
    $
346

  
347
List
348
----
349

  
350
Simple listing
351
^^^^^^^^^^^^^^
352

  
353
Detailed listing
354
^^^^^^^^^^^^^^^^
355

  
356
Filtered listing
357
^^^^^^^^^^^^^^^^
358

  
359
Upload and download
360
-------------------
361

  
362
Upload a file, download an object
363
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
364

  
365
Recursive upload (directory)
366
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
367

  
368
Recursive download (path prefix)
369
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
370

  
371
Publish and share
372
-----------------
373

  
374
Check permissions
375
^^^^^^^^^^^^^^^^^
376

  
377
Publish
378
^^^^^^^
379

  
380
Share with users and groups
381
^^^^^^^^^^^^^^^^^^^^^^^^^^^
382

  
383
Share with all
384
^^^^^^^^^^^^^^
385

  
386
Shared with me
387
--------------
388

  
389
Users who share objects with me
390
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
391

  
392
List shared objects
393
^^^^^^^^^^^^^^^^^^^
394

  
395
Copy shared objects
396
^^^^^^^^^^^^^^^^^^^
397

  
398
Image register
399
--------------
400

  
401
Upload and register image
402
^^^^^^^^^^^^^^^^^^^^^^^^^
403

  
404
Register with metadata template
405
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
406

  
407
Upload and register multiple images
408
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
409

  
410
virtual machines
411
----------------
412

  
413
Create a server
414
^^^^^^^^^^^^^^^
415

  
416
Inject ssh keys
417
^^^^^^^^^^^^^^^
418

  
419
Inject user profiles
420
^^^^^^^^^^^^^^^^^^^^
421

  
422
Connect and disconnect to a network
423
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
424

  
425
Networks
426
--------
427

  
428
Create a private network
429
^^^^^^^^^^^^^^^^^^^^^^^^
430

  
431
Connect VMs on it
432
^^^^^^^^^^^^^^^^^
433

  
434
Destroy a private network
435
^^^^^^^^^^^^^^^^^^^^^^^^^
b/docs/collection_of_examples/listing.rst
1
Listing
2
=======
3

  
4
In this section we present the ways of kamaki for listing, an operation that is
5
common to most command groups.
6

  
7
The examples of this section run in a kamaki interactive shell.
8

  
9
.. code-block:: console
10

  
11
    $ kamaki
12
    kamaki v0.9 - Interactive Shell
13
    .
14
    /exit       terminate kamaki
15
    exit or ^D  exit context
16
    ? or help   available commands
17
    ?command    help on command
18
    !<command>  execute OS shell command
19
    .
20
    [kamaki]:
21

  
22
Simple listing
23
--------------
24

  
25
List configuration options, whether in the file or in memory
26

  
27
.. code-block:: console
28

  
29
    [kamaki]: config list
30
    cloud.default.url = https://astakos.example.com/identity/v2.0/
31
    cloud.default.token = my70k3n==
32
    global.default_cloud = default
33
    global.colors = on
34
    global.config_cli = config
35
    global.file_cli = pithos
36
    global.flavor_cli = cyclades
37
    global.history_cli = history
38
    global.history_file = /home/saxtouri/.kamaki.history
39
    global.image_cli = image
40
    global.log_file = /home/saxtouri/.kamaki.log
41
    global.log_token = one
42
    global.max_threads = 5
43
    global.network_cli = cyclades
44
    global.server_cli = cyclades
45
    global.user_cli = astakos
46
    [kamaki]:
47

  
48
List stored containers and then objects in container "pithos"
49

  
50
.. code-block:: console
51

  
52
    [kamaki]: file list
53
    pithos (36MB, 4 objects)
54
    trash (0B, 0 objects)
55
    [kamaki]: file list pithos
56
    . 2KB  info.txt
57
    . D    video/
58
    . 11MB video/tk1.mpg
59
    . 12MB video/tk2.mpg
60
    . 13MB video/tk3.mpg
61
    [kamaki]:
62

  
63
List virtual machines (servers)
64

  
65
.. code-block:: console
66

  
67
    [kamaki]: server list
68
    4201 example server 1
69
    4202 example server 2
70

  
71
List networks
72

  
73
.. code-block:: console
74

  
75
    [kamaki]: network list
76
    1 public_network
77
    42 my_private)network
78
    [kamaki]:
79

  
80
List flavors
81

  
82
.. code-block:: console
83

  
84
    [kamaki]: flavor list
85
    1 C1R1024D20drbd
86
    2 C1R1024D30drbd
87
    [kamaki]:
88

  
89
List images from Image API and from Compute APIs
90

  
91
.. code-block:: console
92

  
93
    [kamaki]: image list
94
    cde9858c-0656-4da1-8cbd-33481b29a8bd Debian Base
95
    .container_format: bare
96
    .disk_format:      diskdump
97
    .size:             474066944
98
    .status:           available
99
    a5ca5997-c580-4d62-b012-05c5329f8e2d Debian Base
100
    .container_format: bare
101
    .disk_format:      diskdump
102
    .size:             474066944
103
    .status:           available
104
    [kamaki]: image compute list
105
    a5ca5997-c580-4d62-b012-05c5329f8e2d Debian Base
106
    cde9858c-0656-4da1-8cbd-33481b29a8bd Debian Base
107
    [kamaki]:
108

  
109
Detailed pithos listing
110
-----------------------
111

  
112
List pithos containers with details
113

  
114
.. code-block:: console
115

  
116
    [kamaki]: file
117
    [file]: list -l
118
    pithos
119
    bytes:    0 (0B)
120
    count:    3
121
    modified: 2013-06-17T12:35:11.613124+00:00
122
    policy:  
123
    .       quota:      0
124
    .       versioning: auto
125
    trash
126
    bytes:    0 (0B)
127
    count:    0
128
    modified: 2013-06-06T14:24:23.675891+00:00
129
    policy:  
130
    .       quota:      0
131
    .       versioning: auto
132
    [file]:
133

  
134
Create some more pithos container to experiment with
135

  
136
.. code-block:: console
137

  
138
    [file]: create cont1
139
    [file]: create cont2
140
    [file]: create cont3
141
    [file]: create cont4
142
    [file]: list
143
    cont1 (0B, 0 objects)
144
    cont2 (0B, 0 objects)
145
    cont3 (0B, 0 objects)
146
    cont4 (0B, 0 objects)
147
    pithos (36B, 5 objects)
148
    trash (0B, 0 objects)
149
    [file]:
150

  
151
List only 3, then list three by three
152

  
153
.. code-block:: console
154

  
155
    [file]: list -n 3
156
    cont1 (0B, 0 objects)
157
    cont2 (0B, 0 objects)
158
    cont3 (0B, 0 objects)
159
    [file]: list -n 3 --more
160
    cont1 (0B, 0 objects)
161
    cont2 (0B, 0 objects)
162
    cont3 (0B, 0 objects)
163
    (3 listed - 3 more - "enter" to continue)
164
    <enter is pressed>
165
    cont4 (0B, 0 objects)
166
    pithos (36B, 4 objects)
167
    trash (0B, 0 objects)
168
    [file]: 
169

  
170
List contents of container `pithos`
171

  
172
.. code-block:: console
173

  
174
    [file]: list -l pithos
175
    info.txt
176
    by:        s0m3-u53r-1d
177
    bytes:     2000 (2ΚB)
178
    hash:      427ae41e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92
179
    modified:  2013-06-17T13:09:44.529579+00:00
180
    timestamp: 1371474584.5295789
181
    type:      plan-text/unicode
182
    uuid:      0493f1d9-9410-4f4b-a81f-fe42f9cefa70
183
    version:   1085
184
    .
185
    video
186
    by:        s0m3-u53r-1d
187
    bytes:     0
188
    hash:      e3b0c44298fc1c149afbf44ca495991b7852b855c8996fb92427ae41e4649b93
189
    modified:  2013-06-17T13:11:39.050090+00:00
190
    timestamp: 1371474699.0500901
191
    type:      application/directory
192
    uuid:      80e719f5-9d68-4333-9846-9943972ef1fd
193
    version:   1086
194
    .
195
    video/tk1.mpg
196
    by:        s0m3-u53r-1d
197
    bytes:     11000000 (11ΜΒB)
198
    hash:      fbf4c8996fb92427ae41e464e3b0c44298fc1c5991b7852b855149a9b934ca49
199
    modified:  2013-06-17T13:09:15.866515+00:00
200
    timestamp: 1371474555.8665149
201
    type:      video/mpeg
202
    uuid:      b0b46b39-c59a-4adc-a386-6a169cb9f8a5
203
    version:   1079
204
    .
205
    video/tk2.mpg
206
    by:        s0m3-u53r-1d
207
    bytes:     12000000 (12MB)
208
    hash:      44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b78e3b0c52b855
209
    modified:  2013-06-17T13:09:23.898652+00:00
210
    timestamp: 1371474563.8986521
211
    type:      video/mpeg
212
    uuid:      12a81309-db3c-4e30-ae9a-4ac2b8289def
213
    version:   1081
214
    .
215
    video/tk3.mpg
216
    by:        s0m3-u53r-1d
217
    bytes:     13000000 (13MB)
218
    hash:      1e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92427ae4
219
    modified:  2013-06-17T13:09:28.222536+00:00
220
    timestamp: 1371474568.2225361
221
    type:      video/mpeg
222
    uuid:      4195e8c3-9b9a-4e97-8c20-fdfef34892fe
223
    version:   1083
224
    [kamaki]:
225

  
226
List only videos and exit "file" context
227

  
228
.. code-block:: console
229

  
230
    [file]: list -l pithos:video/
231
    video/tk1.mpg
232
    by:        s0m3-u53r-1d
233
    bytes:     11000000 (11ΜΒB)
234
    hash:      fbf4c8996fb92427ae41e464e3b0c44298fc1c5991b7852b855149a9b934ca49
235
    modified:  2013-06-17T13:09:15.866515+00:00
236
    timestamp: 1371474555.8665149
237
    type:      video/mpeg
238
    uuid:      b0b46b39-c59a-4adc-a386-6a169cb9f8a5
239
    version:   1079
240
    .
241
    video/tk2.mpg
242
    by:        s0m3-u53r-1d
243
    bytes:     12000000 (12MB)
244
    hash:      44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b78e3b0c52b855
245
    modified:  2013-06-17T13:09:23.898652+00:00
246
    timestamp: 1371474563.8986521
247
    type:      video/mpeg
248
    uuid:      12a81309-db3c-4e30-ae9a-4ac2b8289def
249
    version:   1081
250
    .
251
    video/tk3.mpg
252
    by:        s0m3-u53r-1d
253
    bytes:     13000000 (13MB)
254
    hash:      1e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92427ae4
255
    modified:  2013-06-17T13:09:28.222536+00:00
256
    timestamp: 1371474568.2225361
257
    type:      video/mpeg
258
    uuid:      4195e8c3-9b9a-4e97-8c20-fdfef34892fe
259
    version:   1083
260
    [kamaki]:
b/docs/examples.rst
1
Examples
2
========
3

  
4
.. toctree::
5
    :numbered:
6
    :glob:
7

  
8
    collection_of_examples/configuration
9
    collection_of_examples/listing
b/docs/index.rst
30 30
   setup
31 31
   usage
32 32
   commands
33
   scenarios
33
   examples
34 34
   devguide
35 35

  
36 36

  
/dev/null
1
Scenarios
2
=========
3

  
4
Configuration
5
-------------
6

  
7
Create a new configuration file
8
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9

  
10
Convert an old configuration file
11
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12

  
13
Configure a cloud
14
^^^^^^^^^^^^^^^^^
15

  
16
Multiple clouds in single configuration
17
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18

  
19
Multiple configurations
20
^^^^^^^^^^^^^^^^^^^^^^^
21

  
22
List
23
----
24

  
25
Simple listing
26
^^^^^^^^^^^^^^
27

  
28
Detailed listing
29
^^^^^^^^^^^^^^^^
30

  
31
Filtered listing
32
^^^^^^^^^^^^^^^^
33

  
34
Upload and download
35
-------------------
36

  
37
Upload a file, download an object
38
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39

  
40
Recursive upload (directory)
41
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42

  
43
Recursive download (path prefix)
44
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45

  
46
Publish and share
47
-----------------
48

  
49
Check permissions
50
^^^^^^^^^^^^^^^^^
51

  
52
Publish
53
^^^^^^^
54

  
55
Share with users and groups
56
^^^^^^^^^^^^^^^^^^^^^^^^^^^
57

  
58
Share with all
59
^^^^^^^^^^^^^^
60

  
61
Shared with me
62
--------------
63

  
64
Users who share objects with me
65
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

  
67
List shared objects
68
^^^^^^^^^^^^^^^^^^^
69

  
70
Copy shared objects
71
^^^^^^^^^^^^^^^^^^^
72

  
73
Image register
74
--------------
75

  
76
Upload and register image
77
^^^^^^^^^^^^^^^^^^^^^^^^^
78

  
79
Register with metadata template
80
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
81

  
82
Upload and register multiple images
83
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84

  
85
Servers (virtual machines)
86
--------------------------
87

  
88
Create a server
89
^^^^^^^^^^^^^^^
90

  
91
Inject ssh keys
92
^^^^^^^^^^^^^^^
93

  
94
Inject user profiles
95
^^^^^^^^^^^^^^^^^^^^
96

  
97
Connect and disconnect to a network
98
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
99

  
100
Networks
101
--------
102

  
103
Create a private network
104
^^^^^^^^^^^^^^^^^^^^^^^^
105

  
106
Connect VMs on it
107
^^^^^^^^^^^^^^^^^
b/kamaki/cli/__init__.py
285 285
            auth_args[term] = ''
286 286
        if not auth_args[term]:
287 287
            raise CLIError(
288
                'No authentication %s provided for cloud "%s"' % (term, cloud),
288
                'No authentication %s provided for cloud "%s"' % (
289
                    term.upper(), cloud),
289 290
                importance=3, details=[
290
                    'Set a %s for cloud %s:' % (term, cloud),
291
                    'Set a %s for cloud %s:' % (term.upper(), cloud),
291 292
                    '  kamaki config set cloud.%s.%s <%s>' % (
292
                        cloud, term, term)])
293
                        cloud, term, term.upper())])
293 294

  
294 295
    from kamaki.clients.astakos import AstakosClient as AuthCachedClient
295 296
    try:

Also available in: Unified diff