Revision 1c366ac9
b/docs/developers/clients-api.rst | ||
---|---|---|
11 | 11 |
Since Synnefo services are build as OpenStack extensions, an inheritance |
12 | 12 |
approach has been chosen for implementing clients for both. In specific, |
13 | 13 |
the *compute*, *storage* and *image* modules are client implementations for the |
14 |
OpenStack compute and OpenStack object-store APIs, respectively. The rest of the
|
|
15 |
modules implement the Synnefo extensions (i.e., *cyclades* and
|
|
14 |
OpenStack compute, OpenStack object-store and Image APIs respectively. The rest
|
|
15 |
of the modules implement the Synnefo extensions (i.e., *cyclades* and
|
|
16 | 16 |
*cyclades_rest_api* extents *compute*, *pithos* and *pithos_rest_api* extent |
17 |
*storage*) or novel Synnefo services (*image* for *plankton*).
|
|
17 |
*storage*). |
|
18 | 18 |
|
19 | 19 |
Setup a client instance |
20 | 20 |
----------------------- |
... | ... | |
45 | 45 |
----------------------------------- |
46 | 46 |
|
47 | 47 |
In OpenStack, each service (e.g., `compute`, `object-store`, etc.) has a number |
48 |
of `endpoints`. These `endpoints` are actually URIs that are used by kamaki as
|
|
48 |
of `endpoints`. These `endpoints` are URIs that are used by kamaki as |
|
49 | 49 |
prefixes to form the corresponding API calls. Client applications need just |
50 | 50 |
one of these these `endpoints`, namely the `publicURL`, which is also referred |
51 | 51 |
to as `base_url` in kamaki client libraries. |
... | ... | |
56 | 56 |
(Example 1.2) |
57 | 57 |
2. Use them to instantiate an AstakosClient |
58 | 58 |
(Example 1.2) |
59 |
3. Use AstakosClient instance to get the endpoints of the service of interest
|
|
59 |
3. Use AstakosClient instance to get endpoints for the service of interest
|
|
60 | 60 |
(Example 1.3) |
61 | 61 |
4. The 'publicURL' endpoint is the base_url we are looking for |
62 | 62 |
(Example 1.3) |
... | ... | |
99 | 99 |
The ``get_service_endpoints`` method is called with the service name as an |
100 | 100 |
argument. Here are the service names for the kamaki clients:: |
101 | 101 |
|
102 |
storage.StorageClient, pithos.PithosClient --> object-store |
|
103 |
compute.ComputeClient, cyclades.CycladesClient --> compute |
|
104 |
image.ImageClient --> image |
|
105 |
astakos.AstakosClient --> identity, account |
|
102 |
storage.StorageClient, pithos.PithosClient --> object-store |
|
103 |
compute.ComputeClient, cyclades.CycladesClient --> compute |
|
104 |
network.NetworkClient, cyclades.CycladesNetworkClient --> network |
|
105 |
image.ImageClient --> image |
|
106 |
astakos.AstakosClient --> identity, account |
|
106 | 107 |
|
107 | 108 |
Use client methods |
108 | 109 |
------------------ |
b/docs/developers/code.rst | ||
---|---|---|
6 | 6 |
Command Specifications |
7 | 7 |
---------------------- |
8 | 8 |
|
9 |
user |
|
10 |
^^^^ |
|
9 |
astakos |
|
10 |
^^^^^^^ |
|
11 |
Features: user, project, quota, resource, commission, endpoint, service |
|
11 | 12 |
|
12 | 13 |
.. automodule:: kamaki.cli.commands.astakos |
13 | 14 |
:members: |
14 | 15 |
:undoc-members: |
15 | 16 |
|
16 |
cyclades (server, flavor, network) |
|
17 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
17 |
cyclades |
|
18 |
^^^^^^^^ |
|
19 |
|
|
20 |
Features server, flavor |
|
18 | 21 |
|
19 | 22 |
.. automodule:: kamaki.cli.commands.cyclades |
20 | 23 |
:members: |
21 | 24 |
:undoc-members: |
22 | 25 |
|
23 |
pithos (file) |
|
24 |
^^^^^^^^^^^^^ |
|
26 |
pithos |
|
27 |
^^^^^^ |
|
28 |
|
|
29 |
Features file, container, sharer, group |
|
25 | 30 |
|
26 | 31 |
.. automodule:: kamaki.cli.commands.pithos |
27 | 32 |
:members: |
... | ... | |
30 | 35 |
image |
31 | 36 |
^^^^^ |
32 | 37 |
|
33 |
.. automodule:: kamaki.cli.commands.image |
|
34 |
:members: |
|
35 |
:undoc-members: |
|
36 |
|
|
37 |
Kamaki commands |
|
38 |
^^^^^^^^^^^^^^^ |
|
39 |
|
|
40 |
config |
|
41 |
"""""" |
|
42 |
|
|
43 |
.. automodule:: kamaki.cli.commands.config |
|
44 |
:members: |
|
45 |
:undoc-members: |
|
46 |
|
|
47 |
history |
|
48 |
""""""" |
|
38 |
Features (image, imagecompute) |
|
49 | 39 |
|
50 |
.. automodule:: kamaki.cli.commands.history |
|
51 |
:members: |
|
52 |
:undoc-members: |
|
53 |
|
|
54 |
Command Line Interfaces |
|
55 |
----------------------- |
|
56 |
|
|
57 |
argument |
|
58 |
^^^^^^^^ |
|
59 |
|
|
60 |
.. automodule:: kamaki.cli.argument |
|
40 |
.. automodule:: kamaki.cli.commands.image |
|
61 | 41 |
:members: |
62 |
:show-inheritance: |
|
63 | 42 |
:undoc-members: |
64 | 43 |
|
65 | 44 |
|
66 |
command_shell |
|
67 |
^^^^^^^^^^^^^ |
|
68 |
|
|
69 |
.. automodule:: kamaki.cli.command_shell |
|
70 |
:members: |
|
71 |
:show-inheritance: |
|
72 |
:undoc-members: |
|
73 |
|
|
45 |
network |
|
46 |
^^^^^^^ |
|
74 | 47 |
|
75 |
command_tree |
|
76 |
^^^^^^^^^^^^ |
|
48 |
Features network, port, subnet, ip |
|
77 | 49 |
|
78 |
.. automodule:: kamaki.cli.command_tree
|
|
50 |
.. automodule:: kamaki.cli.commands.network
|
|
79 | 51 |
:members: |
80 |
:show-inheritance: |
|
81 | 52 |
:undoc-members: |
82 | 53 |
|
54 |
Kamaki commands |
|
55 |
^^^^^^^^^^^^^^^ |
|
83 | 56 |
|
84 | 57 |
config |
85 |
^^^^^^
|
|
58 |
""""""
|
|
86 | 59 |
|
87 |
.. automodule:: kamaki.cli.config |
|
60 |
.. automodule:: kamaki.cli.commands.config
|
|
88 | 61 |
:members: |
89 |
:show-inheritance: |
|
90 | 62 |
:undoc-members: |
91 | 63 |
|
64 |
|
|
92 | 65 |
errors |
93 | 66 |
^^^^^^ |
94 | 67 |
|
95 |
.. automodule:: kamaki.cli.errors |
|
96 |
:members: |
|
97 |
:show-inheritance: |
|
98 |
:undoc-members: |
|
99 |
|
|
100 |
|
|
101 |
history |
|
102 |
^^^^^^^ |
|
103 |
|
|
104 |
.. automodule:: kamaki.cli.history |
|
105 |
:members: |
|
106 |
:show-inheritance: |
|
107 |
:undoc-members: |
|
108 |
|
|
109 |
|
|
110 |
utils |
|
111 |
^^^^^ |
|
112 |
|
|
113 |
.. automodule:: kamaki.cli.utils |
|
68 |
.. automodule:: kamaki.cli.commands.errors |
|
114 | 69 |
:members: |
115 | 70 |
:show-inheritance: |
116 | 71 |
:undoc-members: |
117 | 72 |
|
118 |
|
|
119 | 73 |
.. _the-client-api-ref: |
120 | 74 |
|
121 | 75 |
The clients API |
122 | 76 |
--------------- |
123 | 77 |
|
124 |
Modules list |
|
125 |
^^^^^^^^^^^^ |
|
126 |
|
|
127 |
compute REST API |
|
128 |
^^^^^^^^^^^^^^^^ |
|
78 |
compute |
|
79 |
^^^^^^^ |
|
129 | 80 |
|
130 | 81 |
.. automodule:: kamaki.clients.compute.rest_api |
131 | 82 |
:members: |
132 | 83 |
:show-inheritance: |
133 | 84 |
:undoc-members: |
134 | 85 |
|
135 |
|
|
136 |
compute |
|
137 |
^^^^^^^ |
|
138 |
|
|
139 | 86 |
.. automodule:: kamaki.clients.compute |
140 | 87 |
:members: |
141 | 88 |
:show-inheritance: |
142 | 89 |
:undoc-members: |
143 | 90 |
|
144 | 91 |
|
145 |
cyclades REST API
|
|
146 |
^^^^^^^^^^^^^^^^^
|
|
92 |
cyclades |
|
93 |
^^^^^^^^ |
|
147 | 94 |
|
148 | 95 |
.. automodule:: kamaki.clients.cyclades.rest_api |
149 | 96 |
:members: |
150 | 97 |
:show-inheritance: |
151 | 98 |
:undoc-members: |
152 | 99 |
|
153 |
cyclades |
|
154 |
^^^^^^^^ |
|
155 |
|
|
156 | 100 |
.. automodule:: kamaki.clients.cyclades |
157 | 101 |
:members: |
158 | 102 |
:show-inheritance: |
... | ... | |
167 | 111 |
:show-inheritance: |
168 | 112 |
:undoc-members: |
169 | 113 |
|
170 |
pithos_rest_api
|
|
171 |
^^^^^^^^^^^^^^^
|
|
114 |
pithos |
|
115 |
^^^^^^ |
|
172 | 116 |
|
173 | 117 |
.. automodule:: kamaki.clients.pithos.rest_api |
174 | 118 |
:members: |
175 | 119 |
:show-inheritance: |
176 | 120 |
:undoc-members: |
177 | 121 |
|
178 |
pithos |
|
179 |
^^^^^^ |
|
180 |
|
|
181 | 122 |
.. automodule:: kamaki.clients.pithos |
182 | 123 |
:members: |
183 | 124 |
:show-inheritance: |
... | ... | |
191 | 132 |
:show-inheritance: |
192 | 133 |
:undoc-members: |
193 | 134 |
|
194 |
|
|
195 |
astakos |
|
135 |
network |
|
196 | 136 |
^^^^^^^ |
197 | 137 |
|
198 |
.. automodule:: kamaki.clients.astakos |
|
138 |
.. warning:: For synnefo, the suggested network implementation is in |
|
139 |
kamaki.clients.cyclades.CycladesNetworkClient extension |
|
140 |
|
|
141 |
.. automodule:: kamaki.clients.network |
|
199 | 142 |
:members: |
200 | 143 |
:show-inheritance: |
201 | 144 |
:undoc-members: |
202 | 145 |
|
146 |
astakos |
|
147 |
^^^^^^^ |
|
203 | 148 |
|
204 |
utils |
|
205 |
^^^^^ |
|
206 |
|
|
207 |
.. automodule:: kamaki.clients.utils |
|
149 |
.. automodule:: kamaki.clients.astakos |
|
208 | 150 |
:members: |
209 | 151 |
:show-inheritance: |
210 | 152 |
:undoc-members: |
b/docs/developers/config.rst | ||
---|---|---|
27 | 27 |
Kamaki preset global options, as they appear in the configuration file:: |
28 | 28 |
|
29 | 29 |
[global] |
30 |
default_cloud= |
|
31 |
colors=off |
|
32 |
log_file=${HOME}/.kamaki.log |
|
33 |
log_token=off |
|
34 |
log_data=off |
|
35 |
log_pid=off |
|
36 |
max_threads=7 |
|
37 |
history_file=${HOME}/.kamaki.history |
|
38 |
user_cli=astakos |
|
39 |
file_cli=pithos |
|
40 |
server_cli=cyclades |
|
41 |
flavor_cli=cyclades |
|
42 |
network_cli=cyclades |
|
43 |
ip_cli=cyclades |
|
44 |
image_cli=image |
|
45 |
config_cli=config |
|
46 |
history_cli=history |
|
30 |
project_cli = astakos |
|
31 |
default_cloud = my_cloud |
|
32 |
quota_cli = astakos |
|
33 |
file_cli = pithos |
|
34 |
subnet_cli = network |
|
35 |
history_cli = history |
|
36 |
group_cli = pithos |
|
37 |
server_cli = cyclades |
|
38 |
container_cli = pithos |
|
39 |
imagecompute_cli = image |
|
40 |
user_cli = astakos |
|
41 |
network_cli = network |
|
42 |
resource_cli = astakos |
|
43 |
config_cli = config |
|
44 |
flavor_cli = cyclades |
|
45 |
sharer_cli = pithos |
|
46 |
image_cli = image |
|
47 |
port_cli = network |
|
48 |
ip_cli = network |
|
49 |
history_file = /home/someuser/.kamaki.history |
|
50 |
colors = off |
|
51 |
log_pid = off |
|
52 |
log_token = off |
|
53 |
log_data = off |
|
54 |
log_file = /home/someuser/.kamaki.log |
|
47 | 55 |
|
48 | 56 |
A cloud configuration is required to make kamaki run. The |
49 | 57 |
`setup guide <../setup.html>`_ can help when setting one or more cloud |
b/docs/examplesdir/listing.rst | ||
---|---|---|
1 | 1 |
Listing |
2 | 2 |
======= |
3 | 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.10 - 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 |
Session user is Tyler Durden <uuid: th3y-4r3-7h3-54m3-p3r50n> |
|
21 |
[kamaki]: |
|
4 |
The listing of various synnefo objects (e.g, server, file, network) is |
|
5 |
showcased in this section. |
|
22 | 6 |
|
23 | 7 |
Simple listing |
24 | 8 |
-------------- |
... | ... | |
27 | 11 |
|
28 | 12 |
.. code-block:: console |
29 | 13 |
|
30 |
[kamaki]: config list |
|
31 |
cloud.default.url = https://astakos.example.com/identity/v2.0/ |
|
32 |
cloud.default.token = my70k3n== |
|
33 |
global.default_cloud = default |
|
34 |
global.colors = on |
|
14 |
$ kamaki config list |
|
15 |
global.default_cloud = mycloud |
|
16 |
global.colors = off |
|
35 | 17 |
global.config_cli = config |
18 |
global.container_cli = pithos |
|
36 | 19 |
global.file_cli = pithos |
37 | 20 |
global.flavor_cli = cyclades |
21 |
global.group_cli = pithos |
|
38 | 22 |
global.history_cli = history |
39 |
global.history_file = /home/saxtouri/.kamaki.history
|
|
23 |
global.history_file = /home/someuser/.kamaki.history
|
|
40 | 24 |
global.image_cli = image |
41 |
global.log_file = /home/saxtouri/.kamaki.log |
|
42 |
global.log_token = one |
|
43 |
global.max_threads = 5 |
|
44 |
global.network_cli = cyclades |
|
25 |
global.imagecompute_cli = image |
|
26 |
global.ip_cli = network |
|
27 |
global.log_data = off |
|
28 |
global.log_file = /home/someuser/.kamaki.log |
|
29 |
global.log_pid = off |
|
30 |
global.log_token = off |
|
31 |
global.network_cli = network |
|
32 |
global.port_cli = network |
|
33 |
global.project_cli = astakos |
|
34 |
global.quota_cli = astakos |
|
35 |
global.resource_cli = astakos |
|
45 | 36 |
global.server_cli = cyclades |
37 |
global.sharer_cli = pithos |
|
38 |
global.subnet_cli = network |
|
46 | 39 |
global.user_cli = astakos |
47 |
[kamaki]: |
|
48 | 40 |
|
49 |
List stored containers and then objects in container "pithos"
|
|
41 |
List stored containers and file or directory objects in container "pithos"
|
|
50 | 42 |
|
51 | 43 |
.. code-block:: console |
52 | 44 |
|
53 |
[kamaki]: file list
|
|
45 |
$ kamaki container list
|
|
54 | 46 |
pithos (36MB, 4 objects) |
55 | 47 |
trash (0B, 0 objects) |
56 |
[kamaki]: file list pithos |
|
57 |
. 2KB info.txt |
|
58 |
. D video/ |
|
59 |
. 11MB video/tk1.mpg |
|
60 |
. 12MB video/tk2.mpg |
|
61 |
. 13MB video/tk3.mpg |
|
62 |
[kamaki]: |
|
48 |
$ kamaki file list /pithos |
|
49 |
2KB info.txt |
|
50 |
D video/ |
|
51 |
11MB video/tk1.mpg |
|
52 |
12MB video/tk2.mpg |
|
53 |
13MB video/tk3.mpg |
|
54 |
$ kamaki file list /pithos/video |
|
55 |
11MB video/tk1.mpg |
|
56 |
12MB video/tk2.mpg |
|
57 |
13MB video/tk3.mpg |
|
58 |
|
|
59 |
.. note:: In file list, the default container is "pithos" |
|
60 |
|
|
61 |
.. code-block:: console |
|
62 |
|
|
63 |
$ kamaki file list |
|
64 |
2KB info.txt |
|
65 |
D video/ |
|
66 |
11MB video/tk1.mpg |
|
67 |
12MB video/tk2.mpg |
|
68 |
13MB video/tk3.mpg |
|
69 |
$ kamaki file list video |
|
70 |
11MB video/tk1.mpg |
|
71 |
12MB video/tk2.mpg |
|
63 | 72 |
|
64 | 73 |
List virtual machines (servers) |
65 | 74 |
|
66 | 75 |
.. code-block:: console |
67 | 76 |
|
68 |
[kamaki]: server list
|
|
77 |
$ kamaki server list
|
|
69 | 78 |
4201 example server 1 |
70 | 79 |
4202 example server 2 |
71 | 80 |
4203 example server 3 |
... | ... | |
77 | 86 |
|
78 | 87 |
.. code-block:: console |
79 | 88 |
|
80 |
[kamaki]: network list
|
|
89 |
$ kamaki network list
|
|
81 | 90 |
1 public_network |
82 | 91 |
42 my_private_network |
83 |
[kamaki]: |
|
84 | 92 |
|
85 | 93 |
List flavors |
86 | 94 |
|
87 | 95 |
.. code-block:: console |
88 | 96 |
|
89 |
[kamaki]: flavor list
|
|
97 |
$ kamaki flavor list
|
|
90 | 98 |
1 C1R1024D20drbd |
91 | 99 |
2 C1R1024D30drbd |
92 |
[kamaki]: |
|
93 | 100 |
|
94 | 101 |
List images from Image API and from Compute APIs |
95 | 102 |
|
96 | 103 |
.. code-block:: console |
97 | 104 |
|
98 |
[kamaki]: image list
|
|
105 |
$ kamaki image list
|
|
99 | 106 |
f1r57-1m4g3-1d Debian Base Alpha |
100 | 107 |
container_format: bare |
101 | 108 |
disk_format: diskdump |
... | ... | |
106 | 113 |
disk_format: diskdump |
107 | 114 |
size: 474066944 |
108 | 115 |
status: available |
109 |
[kamaki]: image compute list
|
|
116 |
$ kamaki imagecompute list
|
|
110 | 117 |
f1r57-1m4g3-1d Debian Base Alpha |
111 | 118 |
53c0nd-1m4g3-1d Beta Debian Base |
112 |
[kamaki]: |
|
113 | 119 |
|
114 | 120 |
Detailed pithos listing |
115 | 121 |
----------------------- |
116 | 122 |
|
117 |
Enter contect |
|
118 |
|
|
119 |
.. code-block:: console |
|
120 |
|
|
121 |
[kamaki]: file |
|
122 |
[file]: |
|
123 |
|
|
124 | 123 |
List pithos containers with details |
125 | 124 |
|
126 | 125 |
.. code-block:: console |
127 | 126 |
|
128 |
[file]: list -l
|
|
127 |
$ kamaki container list -l
|
|
129 | 128 |
pithos |
130 | 129 |
bytes: 0 (0B) |
131 | 130 |
count: 3 |
... | ... | |
140 | 139 |
policy: |
141 | 140 |
quota: 0 |
142 | 141 |
versioning: auto |
143 |
[file]: |
|
144 | 142 |
|
145 |
Create some more pithos container to experiment with
|
|
143 |
Create some more containers to experiment with
|
|
146 | 144 |
|
147 | 145 |
.. code-block:: console |
148 | 146 |
|
149 |
[file]: create cont1
|
|
150 |
[file]: create cont2
|
|
151 |
[file]: create cont3
|
|
152 |
[file]: create cont4
|
|
153 |
[file]: list
|
|
147 |
$ kamaki container create cont1
|
|
148 |
$ kamaki container create cont2
|
|
149 |
$ kamaki container create cont3
|
|
150 |
$ kamaki container create cont4
|
|
151 |
$ kamaki container list
|
|
154 | 152 |
cont1 (0B, 0 objects) |
155 | 153 |
cont2 (0B, 0 objects) |
156 | 154 |
cont3 (0B, 0 objects) |
157 | 155 |
cont4 (0B, 0 objects) |
158 | 156 |
pithos (36B, 5 objects) |
159 | 157 |
trash (0B, 0 objects) |
160 |
[file]: |
|
161 |
|
|
162 |
List only 3, then list three by three |
|
163 |
|
|
164 |
.. code-block:: console |
|
165 |
|
|
166 |
[file]: list -n 3 |
|
167 |
cont1 (0B, 0 objects) |
|
168 |
cont2 (0B, 0 objects) |
|
169 |
cont3 (0B, 0 objects) |
|
170 |
[file]: list -n 3 --more |
|
171 |
cont1 (0B, 0 objects) |
|
172 |
cont2 (0B, 0 objects) |
|
173 |
cont3 (0B, 0 objects) |
|
174 |
(3 listed - 3 more - "enter" to continue) |
|
175 |
<enter is pressed> |
|
176 |
cont4 (0B, 0 objects) |
|
177 |
pithos (36B, 4 objects) |
|
178 |
trash (0B, 0 objects) |
|
179 |
[file]: |
|
180 | 158 |
|
181 | 159 |
List contents of container `pithos` |
182 | 160 |
|
183 | 161 |
.. code-block:: console |
184 | 162 |
|
185 |
[file]: list -l pithos
|
|
163 |
$ kamaki file list -l /pithos
|
|
186 | 164 |
info.txt |
187 | 165 |
by: s0m3-u53r-1d |
188 | 166 |
bytes: 2000 (2ฮB) |
... | ... | |
232 | 210 |
type: video/mpeg |
233 | 211 |
uuid: 4195e8c3-9b9a-4e97-8c20-fdfef34892fe |
234 | 212 |
version: 1083 |
235 |
[kamaki]:
|
|
213 |
$ kamaki
|
|
236 | 214 |
|
237 |
List only objects starting with "video" and exit "file" context |
|
215 |
List only objects starting with "video" and exit "file" context. Remember that |
|
216 |
"pithos" is the default container, so there is no need to refer to it. |
|
238 | 217 |
|
239 | 218 |
.. code-block:: console |
240 | 219 |
|
241 |
[file]: list -l pithos:video/
|
|
220 |
$ kamaki file list -l video/
|
|
242 | 221 |
video/tk1.mpg |
243 | 222 |
by: s0m3-u53r-1d |
244 | 223 |
bytes: 11000000 (11ฮฮB) |
... | ... | |
269 | 248 |
uuid: 4195e8c3-9b9a-4e97-8c20-fdfef34892fe |
270 | 249 |
version: 1083 |
271 | 250 |
|
272 |
|
|
273 |
Exit context |
|
274 |
|
|
275 |
.. code-block:: console |
|
276 |
|
|
277 |
[file]: exit |
|
278 |
[kamaki]: |
|
279 |
|
|
280 | 251 |
Detailed Server Listing |
281 | 252 |
----------------------- |
282 | 253 |
|
283 |
Enter context |
|
284 |
|
|
285 |
.. code-block:: console |
|
286 |
|
|
287 |
[kamaki]: server |
|
288 |
[server]: |
|
289 |
|
|
290 | 254 |
List only 3, then list three by three, all with enumeration |
291 | 255 |
|
292 | 256 |
.. code-block:: console |
293 | 257 |
|
294 |
[server]: list -n 3 --enumerate
|
|
258 |
$ kamaki server list --enumerate
|
|
295 | 259 |
1. 4201 example server 1 |
296 | 260 |
2. 4202 example server 2 |
297 | 261 |
3. 4203 example server 3 |
298 | 262 |
4. 4204 example server 4 |
299 | 263 |
5. 4205 example server 5 |
300 | 264 |
6. 4206 example server 6 |
301 |
[server]: list -n 3 --more --enumerate
|
|
265 |
$ kamaki server list -n 3 --more
|
|
302 | 266 |
1. 4201 example server 1 |
303 | 267 |
2. 4202 example server 2 |
304 | 268 |
3. 4203 example server 3 |
... | ... | |
307 | 271 |
4. 4204 example server 4 |
308 | 272 |
5. 4205 example server 5 |
309 | 273 |
6. 4206 example server 6 |
310 |
[server]: |
|
311 | 274 |
|
312 |
Get json output returned by the compute API server (only first two VMs)
|
|
275 |
List in json output
|
|
313 | 276 |
|
314 | 277 |
.. code-block:: console |
315 | 278 |
|
316 |
[server]: list -j -n 2
|
|
279 |
$ kamaki server list -output-format=json
|
|
317 | 280 |
[ |
318 | 281 |
{ |
319 | 282 |
"name": "example server 1", |
... | ... | |
343 | 306 |
], |
344 | 307 |
"id": 4202 |
345 | 308 |
} |
309 |
... |
|
346 | 310 |
] |
347 |
[server]: |
|
348 | 311 |
|
349 |
Server details (first two only)
|
|
312 |
Server details |
|
350 | 313 |
|
351 | 314 |
.. code-block:: console |
352 | 315 |
|
353 |
[server]: list -l -n 2
|
|
316 |
$ kamaki server list -l
|
|
354 | 317 |
4201 my example server 1 |
355 | 318 |
accessIPv4: |
356 | 319 |
accessIPv6: |
... | ... | |
483 | 446 |
tenant_id: s0m3-u53r-1d |
484 | 447 |
updated: 2013-06-17T07:57:50.054550+00:00 |
485 | 448 |
user_id: s0m3-u53r-1d |
486 |
[server]: |
|
487 |
|
|
488 |
Exit context |
|
489 |
|
|
490 |
.. code-block:: console |
|
491 |
|
|
492 |
[server]: exit |
|
493 |
[kamaki]: |
|
494 |
|
|
495 |
.. note:: `network` and `flavor list` behave in the same way as `server list` |
|
449 |
... |
|
496 | 450 |
|
497 | 451 |
Detailed image listing |
498 | 452 |
---------------------- |
499 | 453 |
|
500 |
Enter context |
|
501 |
|
|
502 |
.. code-block:: console |
|
503 |
|
|
504 |
[kamaki]: image |
|
505 |
[image]: |
|
506 |
|
|
507 | 454 |
Detailed listing |
508 | 455 |
|
509 | 456 |
.. code-block:: console |
510 | 457 |
|
511 |
[image]: list -l
|
|
458 |
$ kamaki image list -l
|
|
512 | 459 |
f1r57-1m4g3-1d Debian Base Alpha |
513 | 460 |
checksum: 9344d77620cde1dd77da...7b70badda34b26d782 |
514 | 461 |
container_format: bare |
... | ... | |
551 | 498 |
size: 474066944 |
552 | 499 |
status: available |
553 | 500 |
updated_at: 2013-06-03 16:44:16 |
554 |
[image]: compute list
|
|
501 |
$ kamaki imagecompute list
|
|
555 | 502 |
f1r57-1m4g3-1d Debian Base Alpha |
556 | 503 |
created: 2013-06-03T16:21:53+00:00 |
557 | 504 |
links: |
... | ... | |
602 | 549 |
tenant_id: s0m3-5up3r-u53r-1d |
603 | 550 |
updated: 2013-06-03T16:21:53+00:00 |
604 | 551 |
user_id: s0m3-5up3r-u53r-1d |
605 |
[image]: |
|
606 | 552 |
|
607 | 553 |
Filter listing by prefix, suffix or words in image names |
608 | 554 |
|
609 | 555 |
.. code-block:: console |
610 | 556 |
|
611 |
[image]: list --name-prefix=Debian
|
|
557 |
$ kamaki image list --name-prefix=Debian
|
|
612 | 558 |
f1r57-1m4g3-1d Debian Base Alpha |
613 |
[image]: list --name-suffix=Base
|
|
559 |
$ kamaki image list --name-suffix=Base
|
|
614 | 560 |
53c0nd-1m4g3-1d Beta Debian Base |
615 |
[image]: list --name-like=Alpha
|
|
561 |
$ kamaki image list --name-like=Alpha
|
|
616 | 562 |
f1r57-1m4g3-1d Debian Base Alpha |
617 |
[image]: list --name-like=Beta
|
|
563 |
$ kamaki image list --name-like=Beta
|
|
618 | 564 |
53c0nd-1m4g3-1d Beta Debian Base |
619 |
[image]: list --name-like="Debian Base"
|
|
565 |
$ kamaki image list --name-like="Debian Base"
|
|
620 | 566 |
f1r57-1m4g3-1d Debian Base Alpha |
621 | 567 |
53c0nd-1m4g3-1d Beta Debian Base |
622 |
[image]: |
|
623 | 568 |
|
624 | 569 |
Filter by owner and container format |
625 | 570 |
|
626 | 571 |
.. code-block:: console |
627 | 572 |
|
628 |
[image]: list --owner=s0m3-u53r-1d
|
|
573 |
$ kamaki image list --owner=s0m3-u53r-1d
|
|
629 | 574 |
f1r57-1m4g3-1d Debian Base Alpha |
630 | 575 |
53c0nd-1m4g3-1d Beta Debian Base |
631 |
[image]: list --container-format=bare
|
|
576 |
$ kamaki image list --container-format=bare
|
|
632 | 577 |
f1r57-1m4g3-1d Debian Base Alpha |
633 | 578 |
53c0nd-1m4g3-1d Beta Debian Base |
634 |
[image]: |
|
635 |
|
|
636 |
Exit context: |
|
637 |
|
|
638 |
.. code-block:: console |
|
639 |
|
|
640 |
[image]: exit |
|
641 |
[kamaki]: |
b/docs/examplesdir/network.rst | ||
---|---|---|
1 | 1 |
Networks |
2 | 2 |
======== |
3 | 3 |
|
4 |
Users can create private networks between Virtual Machines. |
|
4 |
Users can create private networks to connect Virtual Machines, and can also |
|
5 |
manage network-related objects and properties e.i., connection to public |
|
6 |
networks, IPs and subnets. |
|
5 | 7 |
|
6 | 8 |
In the following we assume that there are two active virtual servers (ids 141 |
7 | 9 |
and 142) connected to one public network with id 1 (default set up). |
8 | 10 |
|
9 | 11 |
.. code-block:: console |
10 | 12 |
|
11 |
$ kamaki server addr 141
|
|
12 |
nic-141-0
|
|
13 |
$ kamaki server info 141 --nics
|
|
14 |
10
|
|
13 | 15 |
firewallProfile: DISABLED |
14 | 16 |
ipv4: 10.0.0.1 |
15 | 17 |
ipv6: None |
16 | 18 |
mac_address: aa:00:00:23:0d:59 |
17 | 19 |
network_id: 1 |
18 |
$ kamaki server addr 142
|
|
19 |
nic-142-0
|
|
20 |
$ kamaki server info 142 --nics
|
|
21 |
20
|
|
20 | 22 |
firewallProfile: DISABLED |
21 | 23 |
ipv4: 10.0.0.3 |
22 | 24 |
ipv6: None |
23 | 25 |
mac_address: aa:00:00:70:21:65 |
24 | 26 |
network_id: 1 |
25 |
$ |
|
26 |
|
|
27 |
.. note:: In Synnefo, each virtual server connects to a network through a nic. |
|
28 |
The id of a nic is *nic-<server id>-<increment>* by convention. |
|
29 | 27 |
|
30 | 28 |
Let's load kamaki for networks and have a look at the current network state. We |
31 | 29 |
expect to find at least one public network (id: 1) |
32 | 30 |
|
33 | 31 |
.. code-block:: console |
34 | 32 |
|
35 |
$ kamaki |
|
36 |
kamaki v0.9 - Interactive Shell |
|
37 |
|
|
38 |
/exit terminate kamaki |
|
39 |
exit or ^D exit context |
|
40 |
? or help available commands |
|
41 |
?command help on command |
|
42 |
!<command> execute OS shell command |
|
43 |
|
|
44 |
[kamaki]: network |
|
45 |
[network]: list |
|
33 |
$ kamaki network list |
|
46 | 34 |
1 public_network |
47 |
[network]: |
|
48 | 35 |
|
49 | 36 |
Create a private network |
50 | 37 |
------------------------ |
... | ... | |
53 | 40 |
|
54 | 41 |
.. code-block:: console |
55 | 42 |
|
56 |
[network]: create 'My Private Net'
|
|
43 |
$ kamaki network create --name='My Private Net'
|
|
57 | 44 |
attachments: |
58 | 45 |
cidr: 192.168.1.0/24 |
59 | 46 |
cidr6: None |
... | ... | |
69 | 56 |
type: MAC_FILTERED |
70 | 57 |
updated: 2013-06-19T13:52:02.388779+00:00 |
71 | 58 |
user_id: s0m3-u53r-1d |
72 |
[network]: |
|
73 | 59 |
|
74 | 60 |
Let's create two more networks, one for virtual server 141 and one for virtual |
75 | 61 |
server 142 |
76 | 62 |
|
77 | 63 |
.. code-block:: console |
78 | 64 |
|
79 |
[network]: create 'For virtual server 141'
|
|
65 |
$ kamaki network create --name='For virtual server 141'
|
|
80 | 66 |
... |
81 | 67 |
id: 4 |
82 | 68 |
... |
83 |
[network]: create 'For virtual server 142'
|
|
69 |
$ kamaki network create --name='For virtual server 142'
|
|
84 | 70 |
... |
85 | 71 |
id: 5 |
86 | 72 |
... |
87 |
[network]: |
|
88 | 73 |
|
89 | 74 |
Connect and disconnect |
90 | 75 |
---------------------- |
91 | 76 |
|
92 |
To make a point, the networks should be connected to their respecting virtual |
|
93 |
servers |
|
77 |
Lets connect the networks to some virtual servers: |
|
94 | 78 |
|
95 | 79 |
.. code-block:: console |
96 | 80 |
|
97 |
[network]: connect 141 4 |
|
98 |
[network]: connect 142 5 |
|
99 |
[network]: |
|
81 |
$ kamaki network connect 4 141 |
|
82 |
$ kamaki network connect 5 142 |
|
83 |
|
|
84 |
.. note:: **network connect** is a shortcut for **port create**: |
|
85 |
|
|
86 |
.. code-block:: console |
|
87 |
|
|
88 |
$ kamaki port create --network-id=4 --device-id=141 |
|
89 |
$ kamaki port create --network-id=5 --device-id=142 |
|
100 | 90 |
|
101 | 91 |
Now, let's check the current network state. We expect to see the servers |
102 | 92 |
connected to networks with ids 4 and 5, but not 3. |
103 | 93 |
|
104 | 94 |
.. code-block:: console |
105 | 95 |
|
106 |
[network]: list -l
|
|
96 |
$ kamaki network list -l
|
|
107 | 97 |
1 public_network |
108 | 98 |
attachments: |
109 |
nic-141-0
|
|
99 |
10
|
|
110 | 100 |
. . . . . . . |
111 |
nic-142-0
|
|
101 |
20
|
|
112 | 102 |
cidr: 10.0.0.0/24 |
113 | 103 |
cidr6: None |
114 | 104 |
created: 2013-05-29T17:30:03.040929+00:00 |
... | ... | |
137 | 127 |
user_id: s0m3-u53r-1d |
138 | 128 |
4 For virtual server 141 |
139 | 129 |
attachments: |
140 |
nic-141-1
|
|
130 |
11
|
|
141 | 131 |
cidr: 192.168.2.0/24 |
142 | 132 |
cidr6: None |
143 | 133 |
created: 2013-06-19T13:53:02.268886+00:00 |
... | ... | |
152 | 142 |
user_id: s0m3-u53r-1d |
153 | 143 |
5 For virtual server 142 |
154 | 144 |
attachments: |
155 |
nic-141-2
|
|
145 |
12
|
|
156 | 146 |
cidr: 192.168.3.0/24 |
157 | 147 |
cidr6: None |
158 | 148 |
created: 2013-06-19T13:54:02.268886+00:00 |
... | ... | |
165 | 155 |
type: MAC_FILTERED |
166 | 156 |
updated: 2013-06-19T13:54:57.672744+00:00 |
167 | 157 |
user_id: s0m3-u53r-1d |
168 |
[network]:
|
|
158 |
$ kamaki network
|
|
169 | 159 |
|
170 | 160 |
It is time to make a meaningful connection: connect two servers to a private |
171 | 161 |
network |
172 | 162 |
|
173 | 163 |
.. code-block:: console |
174 | 164 |
|
175 |
[network]: connect 141 3 |
|
176 |
[network]: connect 142 3 |
|
177 |
[network]: |
|
165 |
$ kamaki network connect 141 3 |
|
166 |
$ kamaki network connect 142 3 |
|
178 | 167 |
|
179 | 168 |
Now the servers can communicate with each other through their shared private |
180 | 169 |
network. Let's see the network details to confirm that |
181 | 170 |
|
182 | 171 |
.. code-block:: console |
183 | 172 |
|
184 |
[network]: info 3
|
|
173 |
$ kamaki network info 3
|
|
185 | 174 |
attachments: |
186 |
nic-141-2
|
|
175 |
12
|
|
187 | 176 |
. . . . . . . |
188 |
nic-142-2
|
|
177 |
22
|
|
189 | 178 |
cidr: 192.168.1.0/24 |
190 | 179 |
cidr6: None |
191 | 180 |
created: 2013-06-19T13:52:02.268886+00:00 |
... | ... | |
199 | 188 |
type: MAC_FILTERED |
200 | 189 |
updated: 2013-06-19T13:54:57.672744+00:00 |
201 | 190 |
user_id: s0m3-u53r-1d |
202 |
[network]: |
|
203 | 191 |
|
204 | 192 |
Destroy a private network |
205 | 193 |
------------------------- |
... | ... | |
208 | 196 |
|
209 | 197 |
.. code-block:: console |
210 | 198 |
|
211 |
[network]: delete 1
|
|
199 |
$ kamaki network delete 1
|
|
212 | 200 |
(403) Network with id 1 is in use |
213 | 201 |
| FORBIDDEN forbidden (Can not delete the public network.) |
214 |
[kamaki]: |
|
215 | 202 |
|
216 |
.. warning:: Public networks cannot be destroyed in Synnefo
|
|
203 |
.. warning:: Public networks cannot be destroyed |
|
217 | 204 |
|
218 |
Attempt to destroy the useless `For virtual server 141` network
|
|
205 |
Attempt to destroy the `For virtual server 141` network |
|
219 | 206 |
|
220 | 207 |
.. code-block:: console |
221 | 208 |
|
222 |
[network]: delete 4
|
|
209 |
$ kamaki network delete 4
|
|
223 | 210 |
(403) Network with id 4 is in use |
224 |
[network]: |
|
225 | 211 |
|
226 | 212 |
The attached virtual servers should be disconnected first (recall that the |
227 |
nic-141-1 connects network with id 4 to virtual server with id 141) |
|
228 |
|
|
229 |
.. code-block:: console |
|
230 |
|
|
231 |
[network]: disconnect nic-141-1 |
|
232 |
[network]: delete 4 |
|
233 |
[network]: |
|
234 |
|
|
235 |
Attempt to delete the common network. Now we know that we should disconnect the |
|
236 |
respective nics (nic-141-2, nic-142-2) first |
|
213 |
11 connects network with id 4 to virtual server with id 141) |
|
237 | 214 |
|
238 | 215 |
.. code-block:: console |
239 | 216 |
|
240 |
[network]: disconnect nic-142-2 |
|
241 |
[network]: disconnect nic-141-2 |
|
242 |
(404) No nic nic-141-2 on server(virtual server) with id 141 |
|
243 |
| * check server(virtual server) with id 142: /server info 141 |
|
244 |
| * list nics for server(virtual server) with id 141: |
|
245 |
| /server addr 141 |
|
246 |
| Network Interface nic-141-2 not found on server 141 |
|
247 |
[network]: |
|
217 |
$ kamaki network disconnect 4 141 |
|
218 |
$ kamaki network delete 4 |
|
248 | 219 |
|
249 |
Strangely, kamaki did not find any nic-141-2 nics. Why?
|
|
220 |
.. note:: **network disconnect** is a shortcut for **port delete**
|
|
250 | 221 |
|
251 |
Answer: Get the addresses of server 141 to find out that the nic which connects |
|
252 |
the server to network 3 is automatically renamed (nic-141-2 --> nic-141-1) |
|
222 |
.. code-block:: console |
|
253 | 223 |
|
254 |
.. code-block:: console |
|
255 |
|
|
256 |
[network]: /server addr 141 |
|
257 |
nic-142-0 |
|
258 |
firewallProfile: DISABLED |
|
259 |
ipv4: 10.0.0.1 |
|
260 |
ipv6: None |
|
261 |
mac_address: aa:00:00:23:0d:59 |
|
262 |
network_id: 1 |
|
263 |
nic-142-1 |
|
264 |
firewallProfile: DISABLED |
|
265 |
ipv4: 192.168.1.0/24 |
|
266 |
ipv6: None |
|
267 |
mac_address: aa:00:00:23:0d:60 |
|
268 |
network_id: 1 |
|
269 |
[network]: |
|
270 |
|
|
271 |
.. warning:: Synnefo network server may rename the nics of a virtual server if |
|
272 |
another nic on the same server is deleted |
|
273 |
|
|
274 |
Let's remove the correct nic, then, and check if any other nics are related to |
|
275 |
the network with id 3. |
|
276 |
|
|
277 |
.. code-block:: console |
|
278 |
|
|
279 |
[network]: delete nic-141-1 |
|
280 |
[network]: info 3 |
|
281 |
attachments: |
|
282 |
cidr: 192.168.1.0/24 |
|
283 |
cidr6: None |
|
284 |
... |
|
285 |
[network]: |
|
224 |
$ kamaki port delete 11 |
|
225 |
$ kamaki network delete 4 |
|
286 | 226 |
|
287 |
So, we are ready to destroy the network |
|
227 |
Attempt to delete the common network, after disconnecting the respective ports |
|
228 |
(12, 22): |
|
288 | 229 |
|
289 | 230 |
.. code-block:: console |
290 | 231 |
|
291 |
[network]: delete 3 |
|
292 |
[network]: |
|
232 |
$ kamaki port delete 22 |
|
233 |
$ kamaki port delete 12 |
|
234 |
$ kamaki network delete 3 |
b/docs/examplesdir/server.rst | ||
---|---|---|
2 | 2 |
=================================== |
3 | 3 |
|
4 | 4 |
A `server` (also known as `virtual machine`), is created based on a registered |
5 |
`image` and a preconfigured hardware setup (also known as `flavor`).
|
|
5 |
`image` and a hardware setup (also known as `flavor`). |
|
6 | 6 |
|
7 | 7 |
Create a virtual server |
8 | 8 |
----------------------- |
... | ... | |
11 | 11 |
|
12 | 12 |
.. code-block:: console |
13 | 13 |
|
14 |
[kamaki]: flavor list -l
|
|
14 |
$ kamaki flavor list -l
|
|
15 | 15 |
1 C1R128D1drbd |
16 | 16 |
SNF:disk_template: drbd |
17 | 17 |
disk: 1 |
... | ... | |
38 | 38 |
name: C1R128D1plain |
39 | 39 |
ram: 128 |
40 | 40 |
vcpus: 1 |
41 |
[kamaki]: |
|
42 | 41 |
|
43 | 42 |
List available images |
44 | 43 |
|
45 | 44 |
.. code-block:: console |
46 | 45 |
|
47 |
[kamaki]: image compute list
|
|
46 |
$ kamaki image list
|
|
48 | 47 |
f1r57-1m4g3-1d Debian Base Alpha |
49 | 48 |
53c0nd-1m4g3-1d Beta Debian Base |
50 |
[kamaki]: |
|
51 | 49 |
|
52 | 50 |
Let's pick the `C1R128D1drbd` (id: 1) flavor and the `Debian Base Alpha` (id: |
53 | 51 |
f1r57-1m4g3-1d) image to create a new virtual server called 'My First Server' |
54 | 52 |
|
55 | 53 |
.. code-block:: console |
56 | 54 |
|
57 |
[kamaki]: server create 'My First Server' 1 f1r57-1m4g3-1d
|
|
55 |
$ kamaki server create --name='My First Server' --flavor-id=1 --image-id=f1r57-1m4g3-1d
|
|
58 | 56 |
accessIPv4: |
59 | 57 |
accessIPv6: |
60 | 58 |
addresses: |
... | ... | |
82 | 80 |
tenant_id: s0m3-u53r-1d |
83 | 81 |
updated: 2013-06-19T12:34:48.512867+00:00 |
84 | 82 |
user_id: s0m3-u53r-1d |
85 |
[kamaki]: |
|
86 | 83 |
|
87 | 84 |
.. note:: The adminPass field is not stored anywhere, therefore users would |
88 |
rather write it down and change it the first time they use the virtual server |
|
85 |
rather write it down and change it the first time they use the virtual |
|
86 |
server |
|
89 | 87 |
|
90 | 88 |
Wait for the virtual server with id 141 to build (optional) |
91 | 89 |
|
92 | 90 |
.. code-block:: console |
93 | 91 |
|
94 |
[kamaki]: server wait 141
|
|
92 |
$ kamaki server wait 141
|
|
95 | 93 |
<bar showing build progress, until 100%> |
96 | 94 |
Server 141 is now in ACTIVE mode |
97 |
[kamaki]: |
|
98 | 95 |
|
99 | 96 |
Destroy the virtual server (wait is still optional) |
100 | 97 |
|
101 | 98 |
.. code-block:: console |
102 | 99 |
|
103 |
[kamaki]: server delete 141 |
|
104 |
[kamaki]: server wait 141 ACTIVE |
|
100 |
$ kamaki server delete 141 --wait |
|
105 | 101 |
<bar showing destruction progress, until 100%> |
106 | 102 |
Server 141 is now in DELETED mode |
107 |
[kamaki]: |
|
108 | 103 |
|
109 | 104 |
Inject ssh keys to a debian server |
110 | 105 |
---------------------------------- |
... | ... | |
115 | 110 |
and contains the public key of the current user. |
116 | 111 |
|
117 | 112 |
Assume that the public key file of the current user is located at |
118 |
`/home/someuser/.ssh/id_rsa.pub` . We need a method of injecting this file as
|
|
113 |
`/home/someuser/.ssh/id_rsa.pub` . We need to inject this file as
|
|
119 | 114 |
`/root/.ssh/authorized_keys` while creating the virtual server. |
120 | 115 |
|
121 | 116 |
Luckily, Synnefo fully supports the OpenStack suggestion for file injections on |
122 |
virtual servers and kamaki allows it by using the **-p** argument (p stands for
|
|
123 |
`PERSONALITY` and is the term used in the |
|
117 |
virtual servers and kamaki features the **-p** argument (p stands for
|
|
118 |
`PERSONALITY` and is the term used in the respective
|
|
124 | 119 |
`respective OpenStack <http://docs.openstack.org/api/openstack-compute/2/content/CreateServers.html>`_ description). |
125 | 120 |
|
126 |
The syntax of the -p argument is something called "the personlity string":: |
|
121 |
The syntax of the -p argument is something called "the personality string"::
|
|
127 | 122 |
|
128 | 123 |
-p <local file path>[,<remote path>[,<remote owner>[,<remote group>[,<mode>]]]] |
129 | 124 |
|
... | ... | |
139 | 134 |
|
140 | 135 |
.. code-block:: console |
141 | 136 |
|
142 |
[kamaki]: server |
|
143 |
[server]: create 'NoPassword Server' 1 f1r57-1m4g3-1d -p /home/someuser/.ssh/id_rsa.pub,/root/.ssh/authorized_keys |
|
137 |
$ kamaki server create --name='NoPassword Server' --flavor-id=1 --image-id=f1r57-1m4g3-1d -p /home/someuser/.ssh/id_rsa.pub,/root/.ssh/authorized_keys |
|
144 | 138 |
accessIPv4: |
145 | 139 |
accessIPv6: |
146 | 140 |
addresses: |
... | ... | |
149 | 143 |
config_drive: |
150 | 144 |
created: 2013-06-19T12:34:47.362078+00:00 |
151 | 145 |
diagnostics: |
152 |
flavor: |
|
153 |
id: 1 |
|
146 |
flavor-id: 1 |
|
154 | 147 |
hostId: |
155 | 148 |
id: 142 |
156 |
image: |
|
157 |
id: f1r57-1m4g3-1d |
|
149 |
image-id: f1r57-1m4g3-1d |
|
158 | 150 |
key_name: None |
159 | 151 |
metadata: |
160 | 152 |
os: debian |
161 | 153 |
users: root |
162 | 154 |
name: No Password Server |
163 | 155 |
progress: 0 |
164 |
security_groups: |
|
165 |
name: default |
|
166 | 156 |
status: BUILD |
167 | 157 |
suspended: False |
168 | 158 |
tenant_id: s0m3-u53r-1d |
169 | 159 |
updated: 2013-06-19T12:34:48.512867+00:00 |
170 | 160 |
user_id: s0m3-u53r-1d |
171 |
[server]: |
|
172 | 161 |
|
173 |
When the virtual server is ready, get the virtual servers external IP from the web UI. Let's assume the
|
|
174 |
IP is 123.456.78.90 . |
|
162 |
When the virtual server is ready, get the virtual servers external IP from the |
|
163 |
web UI. Let's assume the IP is 123.456.78.90 .
|
|
175 | 164 |
|
176 | 165 |
.. code-block:: console |
177 | 166 |
|
178 |
[server]: /exit |
|
179 |
$ ssh 123.456.78.90 |
|
167 |
$ ssh root@123.456.78.90 |
|
180 | 168 |
Linux remote-virtual server-4241 2.6.32-5-amd64 #1 SMP XXXX x86_64 |
181 | 169 |
|
182 | 170 |
The programs included with the Debian GNU/Linux system are free software; |
... | ... | |
200 | 188 |
Clusters of virtual servers |
201 | 189 |
--------------------------- |
202 | 190 |
|
203 |
A cluster of virtual servers can be created and deleted using special |
|
204 |
arguments. |
|
205 |
|
|
206 |
A convention is necessary: all servers belonging to the same cluster will have |
|
207 |
names with a common prefix e.g., *cluster1*, *cluster2*, etc. This prefix |
|
208 |
acts as the cluster name or the cluster key. Still, users must be careful not to |
|
209 |
confuse cluster servers with other servers that coincidentally have the same |
|
210 |
prefix (e.g., *cluster_of_stars*). |
|
191 |
A virtual cluster is a number of virtual servers which have names starting with |
|
192 |
the same prefix e.g., *cluster1*, *cluster2*, etc. This prefix acts as the |
|
193 |
cluster name. Still, users must be careful not to confuse cluster servers with |
|
194 |
other servers that coincidentally have the same prefix (e.g., |
|
195 |
*cluster_of_stars*). |
|
211 | 196 |
|
212 | 197 |
First, let's create a cluster of 4 servers. Each server will run the image with |
213 | 198 |
id *f1r57-1m4g3-1d* on the hardware specified by the flavor with id *1*. The |
... | ... | |
216 | 201 |
.. code-block:: console |
217 | 202 |
|
218 | 203 |
$ kamaki |
219 |
[kamaki]: server
|
|
220 |
[server]: create "my cluster " 1 f1r57-1m4g3-1d --cluster-size=4 --wait
|
|
204 |
$ kamaki server
|
|
205 |
$ kamaki server create --name="my cluster " --flavor-id=1 --image=if1r57-1m4g3-1d --cluster-size=4 --wait
|
|
221 | 206 |
... <omitted for clarity> |
222 | 207 |
adminPass: S0mePassw0rd0n3 |
223 |
created: 2013-06-19T12:34:49.362078+00:00 |
|
224 |
flavor: |
|
225 |
id: 1 |
|
226 |
id: 322 |
|
227 |
image: |
|
228 |
id: f1r57-1m4g3-1d |
|
229 |
name: my cluster 1 |
|
208 |
flavor-id: 1 |
|
209 |
id: 322 |
|
210 |
image-id: f1r57-1m4g3-1d |
|
211 |
name: my cluster 1 |
|
230 | 212 |
[progress bar waiting server to build] |
231 | 213 |
Server 321: status is now ACTIVE |
232 | 214 |
|
233 | 215 |
... <omitted for clarity> |
234 |
adminPass: S0mePassw0rdTwo |
|
235 |
created: 2013-06-19T12:34:47.362078+00:00 |
|
236 |
flavor: |
|
237 |
id: 1 |
|
238 |
id: 321 |
|
239 |
image: |
|
240 |
id: f1r57-1m4g3-1d |
|
241 |
name: my cluster 2 |
|
216 |
adminPass: S0mePassw0rdTwo |
|
217 |
flavor-id: 1 |
|
218 |
id: 321 |
|
219 |
image-id: f1r57-1m4g3-1d |
|
220 |
name: my cluster 2 |
|
242 | 221 |
[progress bar waiting server to build] |
243 | 222 |
Server 322: status is now ACTIVE |
244 | 223 |
|
245 | 224 |
... <omitted for clarity> |
246 |
adminPass: S0mePassw0rdThree |
|
247 |
created: 2013-06-19T12:34:55.362078+00:00 |
|
248 |
flavor: |
|
249 |
id: 1 |
|
250 |
id: 323 |
|
251 |
image: |
|
252 |
id: f1r57-1m4g3-1d |
|
253 |
name: my cluster 3 |
|
225 |
adminPass: S0mePassw0rdThree |
|
226 |
created: 2013-06-19T12:34:55.362078+00:00 |
|
227 |
flavor0id: 1 |
|
228 |
id: 323 |
|
229 |
image-id: f1r57-1m4g3-1d |
|
230 |
name: my cluster 3 |
|
254 | 231 |
[progress bar waiting server to build] |
255 | 232 |
Server 323: status is now ACTIVE |
256 | 233 |
|
257 | 234 |
... <omitted for clarity> |
258 |
adminPass: S0mePassw0rdFour |
|
259 |
created: 2013-06-19T12:34:59.362078+00:00 |
|
260 |
flavor: |
|
261 |
id: 1 |
|
262 |
id: 324 |
|
263 |
image: |
|
264 |
id: f1r57-1m4g3-1d |
|
265 |
name: my cluster 4 |
|
235 |
adminPass: S0mePassw0rdFour |
|
236 |
created: 2013-06-19T12:34:59.362078+00:00 |
|
237 |
flavor-id: 1 |
|
238 |
id: 324 |
|
239 |
image-id: f1r57-1m4g3-1d |
|
240 |
name: my cluster 4 |
|
266 | 241 |
[progress bar waiting server to build] |
267 | 242 |
Server 324: status is now ACTIVE |
268 | 243 |
|
269 |
.. note:: The creation dates are similar but not ordered. This is because the
|
|
270 |
servers are created asynchronously. To deactivate asynchronous operations
|
|
271 |
in kamaki, set max_theads to 1
|
|
244 |
.. note:: The virtual servers can be created asynchronously. To activate
|
|
245 |
asynchronous operations, set max_theads to some value greater than 1.
|
|
246 |
Default is 1, though.
|
|
272 | 247 |
|
273 | 248 |
.. code-block:: console |
274 | 249 |
|
275 |
# Deactivate multithreading
|
|
250 |
# Create a cluster using multithreading (4 threads)
|
|
276 | 251 |
|
277 |
[server]: /config set max_theads 1
|
|
252 |
$ kamaki server create --name="my cluster " --flavor-id=1 --image=if1r57-1m4g3-1d --cluster-size=4 --wait --threads=4
|
|
278 | 253 |
|
279 | 254 |
.. note:: the *- - wait* argument is optional, but if not used, the *create* |
280 | 255 |
call will terminate as long as the servers are spawned, even if they are |
... | ... | |
288 | 263 |
|
289 | 264 |
.. code-block:: console |
290 | 265 |
|
291 |
[server]: list --name-prefix "my cluster "
|
|
266 |
$ kamaki server list --name-prefix 'my cluster '
|
|
292 | 267 |
321 my cluster 2 |
293 | 268 |
322 my cluster 1 |
294 | 269 |
323 my cluster 3 |
... | ... | |
296 | 271 |
|
297 | 272 |
For demonstration purposes, let's suppose that the maximum resource limit is |
298 | 273 |
reached if we create 2 more servers. We will attempt to expand "my cluster" by |
299 |
4 servers, expecting kamaki to raise a quota-related error.
|
|
274 |
4 servers, expecting kamaki to raise a quota error. |
|
300 | 275 |
|
301 | 276 |
.. code-block:: console |
302 | 277 |
|
303 |
$ kamaki |
|
304 |
[kamaki]: server |
|
305 |
[server]: create "my cluster " 1 f1r57-1m4g3-1d --cluster-size=4 --wait |
|
278 |
$ kamaki server create --name="my cluster " --flavor-id=1 --image-id=f1r57-1m4g3-1d --cluster-size=4 --wait |
|
306 | 279 |
Failed to build 4 servers |
307 | 280 |
Found 2 matching servers: |
308 | 281 |
325 my cluster 1 |
... | ... | |
315 | 288 |
Available: 0, Requested: 1 |
316 | 289 |
|
317 | 290 |
The cluster expansion has failed, but 2 of the attempted 4 servers are being |
318 |
created right now. It's up to the users judgment to destroy them or keep them.
|
|
291 |
created right now. It's up to the users judgment to destroy or keep them. |
|
319 | 292 |
|
320 | 293 |
First, we need to list all servers: |
321 | 294 |
|
322 | 295 |
.. code-block:: console |
323 | 296 |
|
324 |
[server] list --name-prefix="my cluster "
|
|
297 |
$ kamaki server list --name-prefix="my cluster "
|
|
325 | 298 |
321 my cluster 2 |
326 | 299 |
322 my cluster 1 |
327 | 300 |
323 my cluster 3 |
... | ... | |
336 | 309 |
|
337 | 310 |
.. code-block:: console |
338 | 311 |
|
339 |
[server]: delete --cluster "my cluster " --wait
|
|
312 |
$ kamaki server delete --cluster "my cluster " --wait
|
|
340 | 313 |
[progress bar waiting server to be deleted] |
341 | 314 |
Server 321: status is now DELETED |
342 | 315 |
|
... | ... | |
355 | 328 |
[progress bar waiting server to be deleted] |
356 | 329 |
Server 326: status is now DELETED |
357 | 330 |
|
358 |
.. note:: *delete* performs a single deletion if feeded with a server id, but
|
|
359 |
it performs a mass deletion, based on the name, if called with --cluster
|
|
331 |
.. note:: *delete* performs a single deletion if fed with a server id, but it
|
|
332 |
performs a mass deletion based on the name, if called with --cluster
|
|
360 | 333 |
|
361 |
While creating the first cluster, we had to note down all passwords
|
|
334 |
While creating the first cluster, we had to write down all passwords
|
|
362 | 335 |
|
363 | 336 |
The passwords for each server are printed on the console while creating them. |
364 | 337 |
It would be far more convenient, though, if we could massively inject an ssh |
... | ... | |
366 | 339 |
|
367 | 340 |
.. code-block:: console |
368 | 341 |
|
369 |
[server]: create "my new cluster " 1 f1r57-1m4g3-1d --cluster-size=4 --wait --personality /home/someuser/.ssh/id_rsa.pub,/root/.ssh/authorized_keys,root,root,0777
|
|
342 |
$ kamaki server create --name="my new cluster " --flavor-id=1 --image-id=f1r57-1m4g3-1d --cluster-size=4 --wait --personality=/home/someuser/.ssh/id_rsa.pub,/root/.ssh/authorized_keys,root,root,0777
|
|
370 | 343 |
|
371 | 344 |
... <output omitted for clarity> |
372 | 345 |
|
... | ... | |
374 | 347 |
|
375 | 348 |
.. code-block:: console |
376 | 349 |
|
377 |
[server]: list --name-prefix="my new cluster "
|
|
350 |
$ kamaki server list --name-prefix="my new cluster "
|
|
378 | 351 |
321 my new cluster 1 |
379 | 352 |
322 my new cluster 2 |
380 | 353 |
323 my new cluster 3 |
... | ... | |
382 | 355 |
|
383 | 356 |
We now have a cluster of 4 virtual servers and we can ssh in all of them |
384 | 357 |
without a password. |
385 |
|
|
386 |
Here is a bash script for creating clusters: |
|
387 |
|
|
388 |
.. code-block:: bash |
|
389 |
|
|
390 |
#!/bin/bash |
|
391 |
|
|
392 |
CL_PREFIX="cluster" |
|
393 |
CL_SIZE=4 |
|
394 |
|
|
395 |
PUB_KEYS="${HOME}/.ssh/id_rsa.pub" |
|
396 |
OUT="cl_servers.txt" |
|
397 |
|
|
398 |
CLOUD=`kamaki config get default_cloud` |
|
399 |
FLAVOR_ID=1 |
|
400 |
IMAGE_ID="f1r57-1m4g3-1d" |
|
401 |
|
|
402 |
echo "Clean up cluster \"${CL_PREFIX}\"" |
|
403 |
kamaki --cloud=${CLOUD} server delete --cluster ${CL_PREFIX} --wait |
|
404 |
echo "Cluster \"${CL_PREFIX}\"" > ${OUT} |
|
405 |
|
|
406 |
echo "Create cluster \"${CL_PREFIX}\" of size ${CL_SIZE}" |
|
407 |
kamaki --cloud=${CLOUD} server create ${CL_PREFIX} ${FLAVOR_ID} ${IMAGE_ID} |
|
408 |
--cluster-size=${CL_SIZE} --wait |
|
409 |
--personality ${PUB_KEYS},/root/.ssh/authorized_keys,root,root >>${OUT} |
|
410 |
|
|
411 |
echo "A list of created servers can be found at ${OUT}" |
b/docs/examplesdir/sharing.rst | ||
---|---|---|
4 | 4 |
In Pithos, an object can be published, shared with all or restricted to be |
5 | 5 |
accessible by only some users or groups. |
6 | 6 |
|
7 |
Enter context |
|
8 |
|
|
9 |
.. code-block:: console |
|
10 |
|
|
11 |
[kamaki]: file |
|
12 |
[file]: |
|
13 |
|
|
14 | 7 |
Publish and unpublish |
15 | 8 |
--------------------- |
16 | 9 |
|
... | ... | |
18 | 11 |
|
19 | 12 |
.. code-block:: console |
20 | 13 |
|
21 |
[file]: info pithos:info.txt
|
|
14 |
$ kamaki file info info.txt
|
|
22 | 15 |
cache-control: no-cache, no-store, must-revalidate, max-age=0 |
23 | 16 |
content-language: en-us |
24 | 17 |
content-type: plan-text/unicode |
... | ... | |
34 | 27 |
x-object-uuid: 0493f1d9-9410-4f4b-a81f-fe42f9cefa70 |
35 | 28 |
x-object-version: 1085 |
36 | 29 |
x-object-version-timestamp: Mon, 17 Jun 2013 13:09:44 GMT |
37 |
[file]: info file2upload.txt
|
|
30 |
$ kamaki file info file2upload.txt
|
|
38 | 31 |
cache-control: no-cache, no-store, must-revalidate, max-age=0 |
39 | 32 |
content-language: en-us |
40 | 33 |
content-type: plan-text/unicode |
... | ... | |
49 | 42 |
x-object-uuid: 0493f1d9-9410-4f4b-a81f-fe42f9cefa70 |
50 | 43 |
x-object-version: 1085 |
51 | 44 |
x-object-version-timestamp: Mon, 17 Jun 2013 13:09:44 GMT |
52 |
[file]: |
|
53 | 45 |
|
54 | 46 |
.. note:: The first object contains an "x-object-public" field, therefore is |
55 |
published |
|
47 |
published. Alternatively, use the "--sharing" argument |
|
48 |
|
|
49 |
.. code-block:: console |
|
50 |
|
|
51 |
$ kamaki file info info.txt --sharing |
|
52 |
public url: https://example.com/pithos/public/14lhJnAhVU7 |
|
56 | 53 |
|
57 | 54 |
Unpublish info.txt, publish file2upload.txt |
58 | 55 |
|
59 | 56 |
.. code-block:: console |
60 | 57 |
|
61 |
[file]: unpublish pithos:info.txt |
|
62 |
[file]: publish pithos:file2upload.txt |
|
58 |
$ kamaki file modify /pithos/info.txt --unpublish |
|
59 |
$ kamaki file modify /pithos/file2upload.txt --publish |
Also available in: Unified diff