1 |
|
OpenStack API Implementation
|
2 |
|
****************************
|
|
1 |
API Guide
|
|
2 |
*********
|
|
3 |
|
|
4 |
.. todo:: Document the relation of the API to the OpenStack API v1.1.
|
|
5 |
|
|
6 |
This is the guide to the REST API of the synnefo Compute Service.
|
|
7 |
It is meant for users wishing to make calls to the REST API directly.
|
|
8 |
|
|
9 |
The :ref:`kamaki <http://docs.dev.grnet.gr/kamaki>` command-line client
|
|
10 |
and associated python library can be used instead of making direct calls to
|
|
11 |
:ref:`snf-compute <snf-compute>`.
|
3 |
12 |
|
4 |
13 |
Overview
|
5 |
14 |
========
|
6 |
15 |
|
7 |
|
* It is not defined if requests for invalid URLs should return 404 or a Fault. We return a BadRequest Fault.
|
8 |
|
* It is not defined if requests with a wrong HTTP method should return 405 or a Fault. We return a BadRequest Fault.
|
|
16 |
* It is not defined if requests for invalid URLs should return 404 or a Fault.
|
|
17 |
We return a BadRequest Fault.
|
|
18 |
* It is not defined if requests with a wrong HTTP method should return 405 or a
|
|
19 |
Fault. We return a BadRequest Fault.
|
9 |
20 |
|
10 |
21 |
|
11 |
22 |
General API Information
|
... | ... | |
20 |
31 |
Request/Response Types
|
21 |
32 |
----------------------
|
22 |
33 |
|
23 |
|
* We only support JSON Requests and JSON/XML Responses. XML Requests are not supported for now.
|
|
34 |
* We only support JSON Requests and JSON/XML Responses. XML Requests are not
|
|
35 |
supported for now.
|
24 |
36 |
|
25 |
37 |
|
26 |
38 |
Content Compression
|
... | ... | |
32 |
44 |
Persistent Connections
|
33 |
45 |
----------------------
|
34 |
46 |
|
35 |
|
* Deployment note: "To prevent abuse, HTTP sessions have a timeout of 20 seconds before being closed."
|
|
47 |
* Deployment note: "To prevent abuse, HTTP sessions have a timeout of 20
|
|
48 |
seconds before being closed."
|
36 |
49 |
|
37 |
50 |
|
38 |
51 |
Links and References
|
... | ... | |
63 |
76 |
Efficient Polling with the Changes-Since Parameter
|
64 |
77 |
--------------------------------------------------
|
65 |
78 |
|
66 |
|
* We only support the changes-since parameter in **List Servers** and **List Images**.
|
67 |
|
* We assume that garbage collection of deleted servers will only affect servers deleted **POLL_TIME** seconds in the past or earlier. Else we lose the information of a server getting deleted.
|
|
79 |
* We only support the changes-since parameter in **List Servers** and **List
|
|
80 |
Images**.
|
|
81 |
* We assume that garbage collection of deleted servers will only affect servers
|
|
82 |
deleted ``POLL_TIME`` seconds in the past or earlier. Else we lose the
|
|
83 |
information of a server getting deleted.
|
68 |
84 |
* Images do not support a deleted state, so we can not track deletions.
|
69 |
85 |
|
70 |
86 |
|
... | ... | |
73 |
89 |
|
74 |
90 |
* Version MIME type support is missing.
|
75 |
91 |
* Versionless requests are not supported.
|
76 |
|
* We hardcode the *updated* field in versions list
|
|
92 |
* We hardcode the ``updated`` field in versions list
|
77 |
93 |
* Deployment note: The Atom metadata need to be fixed
|
78 |
94 |
|
79 |
95 |
|
... | ... | |
93 |
109 |
Servers
|
94 |
110 |
-------
|
95 |
111 |
|
96 |
|
* *hostId* is always empty.
|
97 |
|
* *affinityId* is not returned.
|
98 |
|
* *progress* is always returned.
|
99 |
|
* *self* and *bookmark* atom links are not returned.
|
|
112 |
* ``hostId`` is always empty.
|
|
113 |
* ``affinityId`` is not returned.
|
|
114 |
* ``progress`` is always returned.
|
|
115 |
* ``self`` and ``bookmark`` atom links are not returned.
|
100 |
116 |
* **Get Server Details** will also return servers with a DELETED state.
|
101 |
|
* **Create Server** ignores *personality* of requests.
|
|
117 |
* **Create Server** ignores ``personality`` of requests.
|
102 |
118 |
* **Create Server** ignores the disk size of the flavor.
|
103 |
119 |
* **Create Server** hardcodes the OS.
|
104 |
120 |
* **Create Server** does not support setting the password in the request.
|
... | ... | |
106 |
122 |
List Servers
|
107 |
123 |
............
|
108 |
124 |
|
109 |
|
* **List Servers** returns just *id* and *name* if details is not requested.
|
110 |
|
* **List Servers** can return 304 (even though not explicitly stated) when *changes-since* is given.
|
|
125 |
* **List Servers** returns just ``id`` and ``name`` if details are not
|
|
126 |
requested.
|
|
127 |
* **List Servers** can return 304 (even though not explicitly stated) when
|
|
128 |
``changes-since`` is given.
|
111 |
129 |
|
112 |
|
**Example List Servers: JSON**::
|
|
130 |
**Example List Servers: JSON**
|
|
131 |
|
|
132 |
.. code-block:: javascript
|
113 |
133 |
|
114 |
134 |
{
|
115 |
135 |
'servers':
|
... | ... | |
169 |
189 |
|
170 |
190 |
**Normal Response Code**: 200
|
171 |
191 |
|
172 |
|
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503), unauthorized (401), badRequest (400), itemNotFound (404), overLimit (413)
|
|
192 |
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
|
|
193 |
unauthorized (401), badRequest (400), itemNotFound (404), overLimit (413)
|
173 |
194 |
|
174 |
|
This operation returns URLs to graphs showing CPU and Network statistics. A *refresh* attribute is returned as well that is the recommended refresh rate of the stats for the clients.
|
|
195 |
This operation returns URLs to graphs showing CPU and Network statistics. A
|
|
196 |
``refresh`` attribute is returned as well that is the recommended refresh rate
|
|
197 |
of the stats for the clients.
|
175 |
198 |
|
176 |
199 |
This operation does not require a request body.
|
177 |
200 |
|
178 |
|
**Example Get Server Stats Response: JSON**::
|
|
201 |
**Example Get Server Stats Response: JSON**:
|
|
202 |
|
|
203 |
.. code-block:: javascript
|
179 |
204 |
|
180 |
205 |
{
|
181 |
206 |
"stats": {
|
... | ... | |
188 |
213 |
}
|
189 |
214 |
}
|
190 |
215 |
|
191 |
|
**Example Get Network Details Response: XML**::
|
|
216 |
**Example Get Network Details Response: XML**:
|
|
217 |
|
|
218 |
.. code-block:: xml
|
192 |
219 |
|
193 |
220 |
<?xml version="1.0" encoding="UTF-8"?>
|
194 |
221 |
<stats xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom"
|
... | ... | |
225 |
252 |
|
226 |
253 |
The start function transitions a server from an ACTIVE to a STOPPED state.
|
227 |
254 |
|
228 |
|
**Example Action Start: JSON**::
|
|
255 |
**Example Action Start: JSON**:
|
|
256 |
|
|
257 |
.. code-block:: javascript
|
229 |
258 |
|
230 |
259 |
{
|
231 |
260 |
"start": {}
|
... | ... | |
243 |
272 |
|
244 |
273 |
The start function transitions a server from a STOPPED to an ACTIVE state.
|
245 |
274 |
|
246 |
|
**Example Action Shutdown: JSON**::
|
|
275 |
**Example Action Shutdown: JSON**:
|
|
276 |
|
|
277 |
.. code-block:: javascript
|
247 |
278 |
|
248 |
279 |
{
|
249 |
280 |
"shutdown": {}
|
... | ... | |
262 |
293 |
|
263 |
294 |
It uses a running instance of vncauthproxy to setup proper VNC forwarding with a random password, then returns the necessary VNC connection info to the caller.
|
264 |
295 |
|
265 |
|
**Example Action Console: JSON**::
|
|
296 |
**Example Action Console: JSON**:
|
|
297 |
|
|
298 |
.. code-block:: javascript
|
266 |
299 |
|
267 |
300 |
{
|
268 |
301 |
"console": {
|
... | ... | |
270 |
303 |
}
|
271 |
304 |
}
|
272 |
305 |
|
273 |
|
**Example Action Console Response: JSON**::
|
|
306 |
**Example Action Console Response: JSON**:
|
|
307 |
|
|
308 |
.. code-block:: javascript
|
274 |
309 |
|
275 |
310 |
{
|
276 |
311 |
"console": {
|
... | ... | |
281 |
316 |
}
|
282 |
317 |
}
|
283 |
318 |
|
284 |
|
**Example Action Console Response: XML**::
|
|
319 |
**Example Action Console Response: XML**:
|
|
320 |
|
|
321 |
.. code-block:: xml
|
285 |
322 |
|
286 |
323 |
<?xml version="1.0" encoding="UTF-8"?>
|
287 |
324 |
<console xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom"
|
... | ... | |
297 |
334 |
|
298 |
335 |
**Normal Response Code**: 202
|
299 |
336 |
|
300 |
|
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503), unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404), buildInProgress (409), overLimit (413)
|
|
337 |
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
|
|
338 |
unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404),
|
|
339 |
buildInProgress (409), overLimit (413)
|
301 |
340 |
|
302 |
|
The firewallProfile function sets a firewall profile for the public interface of a server.
|
|
341 |
The firewallProfile function sets a firewall profile for the public interface
|
|
342 |
of a server.
|
303 |
343 |
|
304 |
344 |
The allowed profiles are: **ENABLED**, **DISABLED** and **PROTECTED**.
|
305 |
345 |
|
306 |
|
**Example Action firewallProfile: JSON**::
|
|
346 |
**Example Action firewallProfile: JSON**:
|
|
347 |
|
|
348 |
.. code-block:: javascript
|
307 |
349 |
|
308 |
350 |
{
|
309 |
351 |
"firewallProfile": {
|
... | ... | |
317 |
359 |
Flavors
|
318 |
360 |
-------
|
319 |
361 |
|
320 |
|
* *self* and *bookmark* atom links are not returned.
|
321 |
|
* **List Flavors** returns just *id* and *name* if details is not requested.
|
|
362 |
* ``self`` and ``bookmark`` atom links are not returned.
|
|
363 |
* **List Flavors** returns just ``id`` and ``name`` if details is not requested.
|
322 |
364 |
|
323 |
365 |
|
324 |
366 |
Images
|
325 |
367 |
------
|
326 |
368 |
|
327 |
|
* *progress* is always returned.
|
328 |
|
* *self* and *bookmark* atom links are not returned.
|
329 |
|
* **List Images** returns just *id* and *name* if details is not requested.
|
330 |
|
* **List Images** can return 304 (even though not explicitly stated) when *changes-since* is given.
|
331 |
|
* **List Images** does not return deleted images when *changes-since* is given.
|
|
369 |
* ``progress`` is always returned.
|
|
370 |
* ``self`` and ``bookmark`` atom links are not returned.
|
|
371 |
* **List Images** returns just ``id`` and ``name`` if details are not requested.
|
|
372 |
* **List Images** can return 304 (even though not explicitly stated) when
|
|
373 |
``changes-since`` is given.
|
|
374 |
* **List Images** does not return deleted images when ``changes-since`` is given.
|
332 |
375 |
|
333 |
376 |
|
334 |
377 |
Metadata
|
335 |
378 |
--------
|
336 |
379 |
|
337 |
|
* **Update Server Metadata** and **Update Image Metadata** will only return the metadata that were updated (some could have been skipped).
|
|
380 |
* **Update Server Metadata** and **Update Image Metadata** will only return the
|
|
381 |
metadata that were updated (some could have been skipped).
|
338 |
382 |
|
339 |
383 |
|
340 |
384 |
Networks
|
... | ... | |
342 |
386 |
|
343 |
387 |
This is an extension to the OpenStack API.
|
344 |
388 |
|
345 |
|
A Server can connect to one or more networks identified by a numeric id. Each user has access only to networks created by himself. When a network is deleted, all connections to it are deleted. Likewise, when a server is deleted, all connections of that server are deleted.
|
|
389 |
A Server can connect to one or more networks identified by a numeric id. Each
|
|
390 |
user has access only to networks created by himself. When a network is deleted,
|
|
391 |
all connections to it are deleted. Likewise, when a server is deleted, all
|
|
392 |
connections of that server are deleted.
|
346 |
393 |
|
347 |
|
There is a special **public** network with the id *public* that can be accessed at */networks/public*. All servers are connected to **public** by default and this network can not be deleted or modified in any way.
|
|
394 |
There is a special **public** network with the id *public* that can be accessed
|
|
395 |
at */networks/public*. All servers are connected to **public** by default and
|
|
396 |
this network can not be deleted or modified in any way.
|
348 |
397 |
|
349 |
398 |
|
350 |
399 |
List Networks
|
... | ... | |
356 |
405 |
|
357 |
406 |
**Normal Response Codes**: 200, 203
|
358 |
407 |
|
359 |
|
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503), unauthorized (401), badRequest (400), overLimit (413)
|
|
408 |
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
|
|
409 |
unauthorized (401), badRequest (400), overLimit (413)
|
360 |
410 |
|
361 |
411 |
This operation provides a list of private networks associated with your account.
|
362 |
412 |
|
363 |
413 |
This operation does not require a request body.
|
364 |
414 |
|
365 |
|
**Example Networks List Response: JSON (detail)**::
|
|
415 |
**Example Networks List Response: JSON (detail)**:
|
|
416 |
|
|
417 |
.. code-block:: javascript
|
366 |
418 |
|
367 |
419 |
{
|
368 |
420 |
"networks": {
|
... | ... | |
389 |
441 |
}
|
390 |
442 |
}
|
391 |
443 |
|
392 |
|
**Example Networks List Response: XML (detail)**::
|
|
444 |
**Example Networks List Response: XML (detail)**:
|
|
445 |
|
|
446 |
.. code-block:: xml
|
393 |
447 |
|
394 |
448 |
<?xml version="1.0" encoding="UTF-8"?>
|
395 |
449 |
<networks xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom">
|
... | ... | |
415 |
469 |
|
416 |
470 |
**Normal Response Code**: 202
|
417 |
471 |
|
418 |
|
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503), unauthorized (401), badMediaType(415), badRequest (400), overLimit (413)
|
|
472 |
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
|
|
473 |
unauthorized (401), badMediaType(415), badRequest (400), overLimit (413)
|
419 |
474 |
|
420 |
475 |
This operation asynchronously provisions a new private network.
|
421 |
476 |
|
422 |
|
**Example Create Network Request: JSON**::
|
|
477 |
**Example Create Network Request: JSON**:
|
|
478 |
|
|
479 |
.. code-block:: javascript
|
423 |
480 |
|
424 |
481 |
{
|
425 |
482 |
"network": {
|
... | ... | |
427 |
484 |
}
|
428 |
485 |
}
|
429 |
486 |
|
430 |
|
**Example Create Network Response: JSON**::
|
|
487 |
**Example Create Network Response: JSON**:
|
|
488 |
|
|
489 |
.. code-block:: javascript
|
431 |
490 |
|
432 |
491 |
{
|
433 |
492 |
"network": {
|
... | ... | |
440 |
499 |
}
|
441 |
500 |
}
|
442 |
501 |
|
443 |
|
**Example Create Network Response: XML**::
|
|
502 |
**Example Create Network Response: XML**:
|
|
503 |
|
|
504 |
.. code-block:: xml
|
444 |
505 |
|
445 |
506 |
<?xml version="1.0" encoding="UTF-8"?>
|
446 |
507 |
<network xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom"
|
... | ... | |
457 |
518 |
|
458 |
519 |
**Normal Response Codes**: 200, 203
|
459 |
520 |
|
460 |
|
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503), unauthorized (401), badRequest (400), itemNotFound (404), overLimit (413)
|
|
521 |
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
|
|
522 |
unauthorized (401), badRequest (400), itemNotFound (404), overLimit (413)
|
461 |
523 |
|
462 |
524 |
This operation returns the details of a specific network by its id.
|
463 |
525 |
|
464 |
526 |
This operation does not require a request body.
|
465 |
527 |
|
466 |
|
**Example Get Network Details Response: JSON**::
|
|
528 |
**Example Get Network Details Response: JSON**:
|
|
529 |
|
|
530 |
.. code-block:: javascript
|
467 |
531 |
|
468 |
532 |
{
|
469 |
533 |
"network": {
|
... | ... | |
494 |
558 |
|
495 |
559 |
**Normal Response Code**: 204
|
496 |
560 |
|
497 |
|
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503), unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404), overLimit (413)
|
|
561 |
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
|
|
562 |
unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404),
|
|
563 |
overLimit (413)
|
498 |
564 |
|
499 |
565 |
This operation changes the name of the network in the Compute system.
|
500 |
566 |
|
501 |
567 |
**Example Update Network Name Request: JSON**::
|
502 |
568 |
|
|
569 |
.. code-block:: javascript
|
|
570 |
|
503 |
571 |
{
|
504 |
572 |
"network": {
|
505 |
573 |
"name": "new_name"
|
... | ... | |
516 |
584 |
|
517 |
585 |
**Normal Response Code**: 204
|
518 |
586 |
|
519 |
|
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503), unauthorized (401), itemNotFound (404), unauthorized (401), overLimit (413)
|
|
587 |
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
|
|
588 |
unauthorized (401), itemNotFound (404), unauthorized (401), overLimit (413)
|
520 |
589 |
|
521 |
590 |
This operation deletes a network from the system.
|
522 |
591 |
|
... | ... | |
533 |
602 |
|
534 |
603 |
**Normal Response Code**: 202
|
535 |
604 |
|
536 |
|
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503), unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404), overLimit (413)
|
|
605 |
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
|
|
606 |
unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404),
|
|
607 |
overLimit (413)
|
537 |
608 |
|
538 |
609 |
This operation adds a server to the specified network.
|
539 |
610 |
|
540 |
|
**Example Action Add: JSON**::
|
|
611 |
**Example Action Add: JSON**:
|
|
612 |
|
|
613 |
.. code-block:: javascript
|
541 |
614 |
|
542 |
615 |
{
|
543 |
616 |
"add" : {
|
... | ... | |
555 |
628 |
|
556 |
629 |
**Normal Response Code**: 202
|
557 |
630 |
|
558 |
|
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503), unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404), overLimit (413)
|
|
631 |
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
|
|
632 |
unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404),
|
|
633 |
overLimit (413)
|
559 |
634 |
|
560 |
635 |
This operation removes a server from the specified network.
|
561 |
636 |
|
562 |
|
**Example Action Remove: JSON**::
|
|
637 |
**Example Action Remove: JSON**:
|
|
638 |
|
|
639 |
.. code-block:: javascript
|
563 |
640 |
|
564 |
641 |
{
|
565 |
642 |
"remove" : {
|