Statistics
| Branch: | Tag: | Revision:

root / docs / cyclades-api-guide.rst @ 0e214bbe

History | View | Annotate | Download (30.4 kB)

1
.. _cyclades-api-guide:
2

    
3
API Guide
4
*********
5

    
6
`Cyclades <cyclades.html>`_ is the compute service developed by `GRNET <http://www.grnet.gr>`_ as part of the `synnefo <http://www.synnefo.org>`_ software, that implements an extension of the `OpenStack Compute API <http://docs.openstack.org/api/openstack-compute/2/content>`_.
7

    
8
This document's goals are:
9

    
10
* Define the Cyclades/Compute ReST API
11
* Clarify the differences between Cyclades and OOS Compute
12

    
13
Users and developers who wish to access a synnefo Cyclades service through its ReST API are adviced to use the `kamaki <http://docs.dev.grnet.gr/kamaki>`_ command-line client and associated python library, instead of making direct calls.
14

    
15
Overview
16
========
17

    
18
* It is not defined if requests for invalid URLs should return 404 or a Fault.
19
  We return a BadRequest Fault.
20
* It is not defined if requests with a wrong HTTP method should return 405 or a
21
  Fault. We return a BadRequest Fault.
22

    
23

    
24
General API Information
25
=======================
26

    
27
Authentication
28
--------------
29

    
30
* Authentication support is missing.
31

    
32

    
33
Request/Response Types
34
----------------------
35

    
36
* We only support JSON Requests and JSON/XML Responses. XML Requests are not
37
  supported for now.
38

    
39

    
40
Content Compression
41
-------------------
42

    
43
* Optional content compression support is missing.
44

    
45

    
46
Persistent Connections
47
----------------------
48

    
49
* Deployment note: "To prevent abuse, HTTP sessions have a timeout of 20
50
  seconds before being closed."
51

    
52

    
53
Links and References
54
--------------------
55

    
56
* Full URI references support is missing.
57
* Self and bookmark links support is missing.
58

    
59

    
60
Paginated Collections
61
---------------------
62

    
63
* Pagination support is missing.
64

    
65

    
66
Caching
67
-------
68

    
69
* We do not return cached responses.
70

    
71

    
72
Limits
73
------
74

    
75
 * Limits support is missing.
76

    
77

    
78
Efficient Polling with the Changes-Since Parameter
79
--------------------------------------------------
80

    
81
* We only support the changes-since parameter in **List Servers** and **List
82
  Images**.
83
* We assume that garbage collection of deleted servers will only affect servers
84
  deleted ``POLL_TIME`` seconds in the past or earlier. Else we lose the
85
  information of a server getting deleted.
86
* Images do not support a deleted state, so we can not track deletions.
87

    
88

    
89
Versions
90
--------
91

    
92
* Version MIME type support is missing.
93
* Versionless requests are not supported.
94
* We hardcode the ``updated`` field in versions list
95
* Deployment note: The Atom metadata needs to be fixed
96

    
97

    
98
Extensions
99
----------
100

    
101
* Extensions support is missing.
102

    
103

    
104
Faults
105
------
106

    
107

    
108
API Operations
109
==============
110

    
111
Servers
112
-------
113

    
114
* ``hostId`` is always empty.
115
* ``affinityId`` is not returned.
116
* ``progress`` is always returned.
117
* ``self`` and ``bookmark`` atom links are not returned.
118
* **Get Server Details** will also return servers with a DELETED state.
119
* **Create Server** does not support setting the password in the request.
120

    
121
List Servers
122
............
123

    
124
=================== ====== ======== ==========
125
URI                 Method Cyclades OS Compute
126
=================== ====== ======== ==========
127
``/servers``        GET    ✔        ✔
128
``/servers/detail``
129
=================== ====== ======== ==========
130

    
131
* Both requests return a list of servers. The first returns just ``id`` and ``name``, while the second returns the full set of server attributes.
132

    
133
================= =================================== ======== ==========
134
Request Parameter Value                               Cyclades OS Compute
135
================= =================================== ======== ==========
136
json              Respond in json                     default  **✘**
137
xml               Respond in xml                      ✔        **✘**
138
changes-since     Servers delete since that timestamp ✔        ✔
139
image             Image reference                     **✘**    ✔
140
flavor            VM flavor reference                 **✘**    ✔
141
server            Server flavor reference             **✘**    ✔
142
status            Server status                       **✘**    ✔
143
marker            Last list last ID                   **✘**    ✔
144
limit             Page size                           **✘**    ✔
145
================= =================================== ======== ==========
146

    
147
* **json** and **xml** parameters are mutually exclusive. If none supported, the response will be formated in json.
148

    
149
* **changes-since** must be an ISO8601 date string
150

    
151
|
152

    
153
==============  ========================= ======== ==========
154
Request Header  Value                     Cyclades OS Compute
155
==============  ========================= ======== ==========
156
X-Auth-Token    User authentication token required required
157
==============  ========================= ======== ==========
158

    
159
|
160

    
161
=========================== =====================
162
Return Code                 Description
163
=========================== =====================
164
200 (OK)                    Request succeeded
165
304 (No servers since date) Can be returned if ``changes-since`` is given
166
400 (Bad Request)           Invalid or malformed ``changes-since`` parameter
167
401 (Unauthorized)          Missing or expired user token
168
403 (Forbidden)             User is not allowed to perform this operation
169
500 (Internal Server Error) The request cannot be completed because of an internal error
170
503 (Service Unavailable)   The server is not currently available
171
=========================== =====================
172

    
173

    
174
The response data format is a list of servers under the ``servers`` label. A server may have the fields presented bellow:
175

    
176
================= ====================== ======== ==========
177
Server Attributes Description            Cyclades OS Compute
178
================= ====================== ======== ==========
179
id                The server id          ✔        ✔
180
name              The server name        ✔        ✔
181
hostId            Server playground      empty    ✔
182
created           Creation date          ✔        ✔
183
updated           Creation date          ✔        ✔
184
flavorRef         The flavor id          ✔        **✘**
185
flavor            The flavor id          **✘**    ✔
186
imageRef          The image id           ✔        **✘**
187
image             The image id           **✘**    ✔
188
progress          Build progress         ✔        ✔
189
status            Server status          ✔        ✔
190
attachments       Network interfaces     ✔        **✘**
191
addresses         Network interfaces     **✘**    ✔
192
metadata          Server custom metadata ✔        ✔
193
================= ====================== ======== ==========
194

    
195
* **hostId** is not used in Cyclades, but is returned as an empty string for compatibility
196

    
197

    
198
* **progress** is changing while the server is building up and has values between 0 and 100. When it reaches 100 the server is built.
199

    
200

    
201
* **status** refers to `the status <#status_ref>`_ of the server
202

    
203
* **metadata** are custom key:value pairs used to specify various attributes of the VM (e.g. OS, super user, etc.)
204

    
205

    
206
* **attachments** in Cyclades are lists of network interfaces (nics). Each server can handle various nics. Each nic connects the current server with a network. **Attachments** are different to OS Compute's **addresses** the former is a list of the server's network interfaces (network reference + mac address) while the later is a just list of networks. For example, a Cyclades server may be connected to the same network through more than one distinct network interfaces (e.g. server 43 is connected to network 101 with nic-43-1 and nic-43-2 in the example bellow).
207

    
208
* **Network Interfaces (NICs)** contain information about a server's connection to a network. Each nic is identified by an id of the form nic-<server-id>-<ordinal-number> and may contain a ``network_id``, a ``mac_address``, ``ipv4`` and ``ipv6`` addresses and the ``firewallProfile`` of the connection.
209

    
210
**Example List Servers: JSON**
211

    
212
.. code-block:: javascript
213

    
214
  {
215
      'servers':
216
          {'values': [
217
              {
218
                  'attachments': {'values': [
219
                          {
220
                              'id': 'nic-42-0',
221
                              'network_id': '101',
222
                              'mac_address': 'aa:00:00:49:2e:7e',
223
                              'firewallProfile': DISABLED,
224
                              'ipv4': '192.168.4.5',
225
                              'ipv6': '2001:648:2ffc:1222:a800:ff:fef5:3f5b'
226
                          }
227
                  ]},
228
                  'created': '2011-04-19T10:18:52.085737+00:00',
229
                  'flavorRef': 1,
230
                  'hostId': '',
231
                  'id': 42,
232
                  'imageRef': 3,
233
                  'metadata': {'values': {'foo': 'bar'}},
234
                  'name': 'My Server',
235
                  'status': 'ACTIVE',
236
                  'updated': u'2011-05-29T14:07:07.037602+00:00'
237
              },
238
              {
239
                  'attachments': {'values': [
240
                          {
241
                              'id': 'nic-43-0',
242
                              'mac': 'aa:00:00:91:2f:df',
243
                              'network_id': '1',
244
                              'ipv4': '192.168.32.2'
245
                          },
246
                          {
247
                              'id': 'nic-43-1',
248
                              'network_id': '101',
249
                              'mac_address': 'aa:00:00:49:2g:7f',
250
                              'firewallProfile': DISABLED,
251
                              'ipv4': '192.168.32.6',
252
                              'ipv6': '2001:648:2ffc:1222:a800:ff:fef5:3f5c'
253
                          },
254
                          {
255
                              'id': 'nic-43-2',
256
                              'network_id': '101',
257
                              'mac_address': 'aa:00:00:51:2h:7f',
258
                              'firewallProfile': DISABLED,
259
                              'ipv4': '192.168.32.7',
260
                              'ipv6': '2001:638:2eec:1222:a800:ff:fef5:3f5c'
261
                          }
262
                  ]},
263
                  'created': '2011-05-02T20:51:08.527759+00:00',
264
                  'flavorRef': 1,
265
                  'hostId': '',
266
                  'id': 43,
267
                  'imageRef': 3,
268
                  'name': 'Other Server',
269
                  'description': 'A sample server to showcase server requests',
270
                  'progress': 0,
271
                  'status': 'ACTIVE',
272
                  'updated': '2011-05-29T14:59:11.267087+00:00'
273
              }
274
          ]
275
      }
276
  }
277

    
278

    
279
Create Server
280
.............
281

    
282
=================== ====== ======== ==========
283
URI                 Method Cyclades OS Compute
284
=================== ====== ======== ==========
285
``/servers``        POST   ✔        ✔
286
=================== ====== ======== ==========
287

    
288
|
289

    
290
================= ===============
291
Request Parameter Value          
292
================= ===============
293
json              Respond in json
294
xml               Respond in xml 
295
================= ===============
296

    
297
|
298

    
299
==============  ========================= ======== ==========
300
Request Header  Value                     Cyclades OS Compute
301
==============  ========================= ======== ==========
302
X-Auth-Token    User authentication token required required
303
==============  ========================= ======== ==========
304

    
305
The request body is json formated. It consists of a ``server`` tag over the following attributes:
306

    
307
=========== ==================== ======== ==========
308
Name        Description          Cyclades OS Compute
309
=========== ==================== ======== ==========
310
name        The server name      ✔        ✔
311
imageRef    Image id             ✔        ✔
312
flavorRef   Resources flavor     ✔        ✔
313
personality Personality contents ✔        ✔
314
metadata    Custom metadata      ✔        ✔
315
=========== ==================== ======== ==========
316

    
317
* **name** can be any string
318

    
319
* **imageRed** and **flavorRed** should refer to existing images and hardware flavors accessible by the user
320

    
321
* **metadata** are key:value pairs of custom server-specific metadata. There are no semantic limitations.
322

    
323
* **personality** (optional) is a list of personality injections. A personality injection is a small set of changes to a virtual server. Each change modifies a file on the virtual server, by injecting some data in it. The injected data (``content``) should exceed 10240 *bytes* in size and must be base64 encoded. A personality injection contains the following attributes:
324

    
325
======== =================== ======== ==========
326
Name     Description         Cyclades OS Compute
327
======== =================== ======== ==========
328
path     File path on server ✔        ✔
329
contents Data to inject      ✔        ✔
330
group    User group          ✔        **✘**
331
mode     File access mode    ✔        **✘**
332
owner    File owner          ✔        **✘**
333
======== =================== ======== ==========
334

    
335
|
336

    
337
=========================== =====================
338
Return Code                 Description
339
=========================== =====================
340
200 (OK)                    Request succeeded
341
400 (Bad Request)           Malformed request data
342
401 (Unauthorized)          Missing or expired user token
343
403 (Forbidden)             User is not allowed to perform this operation
344
404 (Not Found)             Image or Flavor not found
345
413 (Over Limit)            Exceeded some resource limit (#VMs, personality size, etc.) 
346
415 (Bad Media Type)        
347
500 (Internal Server Error) The request cannot be completed because of an internal error
348
503 (Service Unavailable)   No available backends or service currently unavailable
349
=========================== =====================
350

    
351
|
352

    
353
In case of a 200 return code, the Response Data are json-formated and consist of a `list of attributes <#server-ref>`_ under the ``server`` tag:
354

    
355
For example::
356

    
357
  {"server": {
358
    "id": 28130
359
    "status": "BUILD",
360
    "updated": "2013-04-10T13:52:18.140686+00:00",
361
    "hostId": "",
362
    "name": "My Server Name: Example Name",
363
    "imageRef": "da7a211f-1db5-444a-938b-f901ce81a3e6",
364
    "created": "2013-04-10T13:52:17.085402+00:00",
365
    "flavorRef": 289,
366
    "adminPass": "fKCqlZe2at",
367
    "suspended": false,
368
    "progress": 0,
369
  }}
370

    
371
Get Server Stats
372
................
373

    
374
This operation returns URLs to graphs showing CPU and Network statistics. A
375
``refresh`` attribute is returned as well that is the recommended refresh rate
376
of the stats for the clients. This operation is no longer documented in OS Compute v2.
377

    
378
============================== ====== ======== ==========
379
URI                            Method Cyclades OS Compute
380
============================== ====== ======== ==========
381
``/servers/<server-id>/stats`` GET    ✔        **✘**
382
============================== ====== ======== ==========
383

    
384
* **server-id** is the identifier of the virtual server
385

    
386
|
387

    
388
==============  =========================
389
Request Header  Value                    
390
==============  =========================
391
X-Auth-Token    User authentication token
392
==============  =========================
393

    
394
|
395

    
396
================= ===============
397
Request Parameter Value          
398
================= ===============
399
json              Respond in json
400
xml               Respond in xml 
401
================= ===============
402

    
403
* **json** and **xml** parameters are mutually exclusive. If none supported, the response will be formated in json.
404

    
405
|
406

    
407
=========================== =====================
408
Return Code                 Description
409
=========================== =====================
410
200 (OK)                    Request succeeded
411
400 (Bad Request)           Invalid server ID or Server deleted
412
401 (Unauthorized)          Missing or expired user token
413
403 (Forbidden)             Administratively suspended server
414
404 (Not Found)             Server not found
415
500 (Internal Server Error) The request cannot be completed because of an internal error
416
503 (Service Unavailable)   The server is not currently available
417
=========================== =====================
418

    
419
|
420

    
421
================== ======================
422
Response Parameter Description           
423
================== ======================
424
serverRef          Server ID
425
refresh            Refresh frequency
426
cpuBar             Latest CPU load graph URL
427
cpuTimeSeries      CPU load / time graph URL
428
netBar             Latest Network load graph URL
429
netTimeSeries      Network load / time graph URL
430
================== ======================
431

    
432
**Example Get Server Stats Response: JSON**:
433

    
434
.. code-block:: javascript
435

    
436
  {
437
      "stats": {
438
          "serverRef": 1,
439
          "refresh": 60,
440
          "cpuBar": "http://stats.okeanos.grnet.gr/b9a1c3ca7e3b9fce75112c43565fb9960b16048c/cpu-bar.png",
441
          "cpuTimeSeries": "http://stats.okeanos.grnet.gr/b9a1c3ca7e3b9fce75112c43565fb9960b16048c/cpu-ts.png",
442
          "netBar": "http://stats.okeanos.grnet.gr/b9a1c3ca7e3b9fce75112c43565fb9960b16048c/net-bar.png",
443
          "netTimeSeries": "http://stats.okeanos.grnet.gr/b9a1c3ca7e3b9fce75112c43565fb9960b16048c/net-ts.png"
444
      }
445
  }
446

    
447
**Example Get Network Details Response: XML**:
448

    
449
.. code-block:: xml
450

    
451
  <?xml version="1.0" encoding="UTF-8"?>
452
  <stats xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom"
453
      serverRef="1"
454
      refresh="60"
455
      cpuBar="http://stats.okeanos.grnet.gr/b9a1c3ca7e3b9fce75112c43565fb9960b16048c/cpu-bar.png"
456
      cpuTimeSeries="http://stats.okeanos.grnet.gr/b9a1c3ca7e3b9fce75112c43565fb9960b16048c/cpu-ts.png"
457
      netBar="http://stats.okeanos.grnet.gr/b9a1c3ca7e3b9fce75112c43565fb9960b16048c/net-bar.png"
458
      netTimeSeries="http://stats.okeanos.grnet.gr/b9a1c3ca7e3b9fce75112c43565fb9960b16048c/net-ts.png">
459
  </stats>
460

    
461

    
462
Server Addresses
463
----------------
464

    
465
Server Actions
466
--------------
467

    
468
* **Change Password** is not supported.
469
* **Rebuild Server** is not supported.
470
* **Resize Server** is not supported.
471
* **Confirm Resized Server** is not supported.
472
* **Revert Resized Server** is not supported.
473

    
474
We have have extended the API with the following commands:
475

    
476

    
477
Start Server
478
............
479

    
480
**Normal Response Code**: 202
481

    
482
**Error Response Codes**: serviceUnavailable (503), itemNotFound (404)
483

    
484
The start function transitions a server from an ACTIVE to a STOPPED state.
485

    
486
**Example Action Start: JSON**:
487

    
488
.. code-block:: javascript
489

    
490
  {
491
      "start": {}
492
  }
493

    
494
This operation does not return a response body.
495

    
496

    
497
Shutdown Server
498
...............
499

    
500
**Normal Response Code**: 202
501

    
502
**Error Response Codes**: serviceUnavailable (503), itemNotFound (404)
503

    
504
The start function transitions a server from a STOPPED to an ACTIVE state.
505

    
506
**Example Action Shutdown: JSON**:
507

    
508
.. code-block:: javascript
509

    
510
  {
511
      "shutdown": {}
512
  }
513

    
514
This operation does not return a response body.
515

    
516

    
517
Get Server Console
518

    
519
**Normal Response Code**: 200
520

    
521
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503), unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404), buildInProgress (409), overLimit (413)
522

    
523
The console function arranges for an OOB console of the specified type. Only consoles of type "vnc" are supported for now.
524
    
525
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.
526

    
527
**Example Action Console: JSON**:
528

    
529
.. code-block:: javascript
530

    
531
  {
532
      "console": {
533
          "type": "vnc"
534
      }
535
  }
536

    
537
**Example Action Console Response: JSON**:
538

    
539
.. code-block:: javascript
540

    
541
  {
542
      "console": {
543
          "type": "vnc",
544
          "host": "vm42.ocean.grnet.gr",
545
          "port": 1234,
546
          "password": "IN9RNmaV"
547
      }
548
  }
549

    
550
**Example Action Console Response: XML**:
551

    
552
.. code-block:: xml
553

    
554
  <?xml version="1.0" encoding="UTF-8"?>
555
  <console xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom"
556
      type="vnc"
557
      host="vm42.ocean.grnet.gr"
558
      port="1234"
559
      password="IN9RNmaV">
560
  </console>
561

    
562

    
563
Set Firewall Profile
564
....................
565

    
566
**Normal Response Code**: 202
567

    
568
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
569
unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404),
570
buildInProgress (409), overLimit (413)
571

    
572
The firewallProfile function sets a firewall profile for the public interface
573
of a server.
574

    
575
The allowed profiles are: **ENABLED**, **DISABLED** and **PROTECTED**.
576

    
577
**Example Action firewallProfile: JSON**:
578

    
579
.. code-block:: javascript
580

    
581
  {
582
      "firewallProfile": {
583
          "profile": "ENABLED"
584
      }
585
  }
586

    
587
This operation does not return a response body.
588

    
589

    
590
Flavors
591
-------
592

    
593
* ``self`` and ``bookmark`` atom links are not returned.
594
* **List Flavors** returns just ``id`` and ``name`` if details is not requested.
595

    
596

    
597
Images
598
------
599

    
600
* ``progress`` is always returned.
601
* ``self`` and ``bookmark`` atom links are not returned.
602
* **List Images** returns just ``id`` and ``name`` if details are not requested.
603
* **List Images** can return 304 (even though not explicitly stated) when
604
  ``changes-since`` is given. 
605
* **List Images** does not return deleted images when ``changes-since`` is given.
606

    
607

    
608
Metadata
609
--------
610

    
611
* **Update Server Metadata** and **Update Image Metadata** will only return the
612
  metadata that were updated (some could have been skipped).
613

    
614

    
615
Networks
616
--------
617

    
618
This is an extension to the OpenStack API.
619

    
620
A Server can connect to one or more networks identified by a numeric id. Each
621
user has access only to networks created by himself. When a network is deleted,
622
all connections to it are deleted. Likewise, when a server is deleted, all
623
connections of that server are deleted.
624

    
625
There is a special **public** network with the id *public* that can be accessed
626
at */networks/public*. All servers are connected to **public** by default and
627
this network can not be deleted or modified in any way.
628

    
629

    
630
List Networks
631
.............
632

    
633
**GET** /networks
634

    
635
**GET** /networks/detail
636

    
637
**Normal Response Codes**: 200, 203
638

    
639
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
640
unauthorized (401), badRequest (400), overLimit (413)
641

    
642
This operation provides a list of private networks associated with your account.
643

    
644
This operation does not require a request body.
645

    
646
**Example Networks List Response: JSON (detail)**:
647

    
648
.. code-block:: javascript
649

    
650
  {
651
      "networks": {
652
          "values": [
653
              {
654
                  "id": "public",
655
                  "name": "public",
656
                  "created": "2011-04-20T15:31:08.199640+00:00",
657
                  "updated": "2011-05-06T12:47:05.582679+00:00",
658
                  "servers": {
659
                      "values": [1, 2, 3]
660
                  }
661
              },
662
              {
663
                  "id": 2,
664
                  "name": "private",
665
                  "created": "2011-04-20T14:32:08.199640+00:00",
666
                  "updated": "2011-05-06T11:40:05.582679+00:00",
667
                  "servers": {
668
                      "values": [1]
669
                  }
670
              }
671
          ]
672
      }
673
  }
674

    
675
**Example Networks List Response: XML (detail)**:
676

    
677
.. code-block:: xml
678

    
679
  <?xml version="1.0" encoding="UTF-8"?>
680
  <networks xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom">
681
    <network id="public" name="public" updated="2011-05-02T21:33:25.606672+00:00" created="2011-04-20T15:31:08.199640+00:00">
682
      <servers>
683
        <server id="1"></server>
684
        <server id="2"></server>
685
        <server id="3"></server>
686
      </servers>
687
    </network>
688
    <network id="2" name="private" updated="2011-05-06T12:47:05.582679+00:00" created="2011-04-20T15:31:33.911299+00:00">
689
      <servers>
690
        <server id="1"></server>
691
      </servers>
692
    </network>
693
  </networks>
694

    
695

    
696
Create Network
697
..............
698

    
699
**POST** /networks
700

    
701
**Normal Response Code**: 202
702

    
703
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
704
unauthorized (401), badMediaType(415), badRequest (400), overLimit (413)
705

    
706
This operation asynchronously provisions a new private network.
707

    
708
**Example Create Network Request: JSON**:
709

    
710
.. code-block:: javascript
711

    
712
  {
713
      "network": {
714
          "name": "private_net",
715
      }
716
  }
717

    
718
**Example Create Network Response: JSON**:
719

    
720
.. code-block:: javascript
721

    
722
  {
723
      "network": {
724
          "id": 3,
725
          "name": "private_net",
726
          "created": "2011-04-20T15:31:08.199640+00:00",
727
          "servers": {
728
              "values": []
729
          }
730
      }
731
  }
732

    
733
**Example Create Network Response: XML**:
734

    
735
.. code-block:: xml
736

    
737
  <?xml version="1.0" encoding="UTF-8"?>
738
  <network xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom"
739
   id="2" name="foob" created="2011-04-20T15:31:08.199640+00:00">
740
    <servers>
741
    </servers>
742
  </network>
743

    
744

    
745
Get Network Details
746
...................
747

    
748
**GET** /networks/*id*
749

    
750
**Normal Response Codes**: 200, 203
751

    
752
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
753
unauthorized (401), badRequest (400), itemNotFound (404), overLimit (413)
754

    
755
This operation returns the details of a specific network by its id.
756

    
757
This operation does not require a request body.
758

    
759
**Example Get Network Details Response: JSON**:
760

    
761
.. code-block:: javascript
762

    
763
  {
764
      "network": {
765
          "id": 3,
766
          "name": "private_net",
767
          "servers": {
768
              "values": [1, 7]
769
          }
770
      }
771
  }
772

    
773
**Example Get Network Details Response: XML**::
774

    
775
  <?xml version="1.0" encoding="UTF-8"?>
776
  <network xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom"
777
   id="2" name="foob" updated="2011-05-02T21:33:25.606672+00:00" created="2011-04-20T15:31:08.199640+00:00">
778
    <servers>
779
      <server id="1"></server>
780
      <server id="7"></server>
781
    </servers>
782
  </network>
783

    
784

    
785
Update Network Name
786
...................
787

    
788
**PUT** /networks/*id*
789

    
790
**Normal Response Code**: 204
791

    
792
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
793
unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404),
794
overLimit (413) 
795

    
796
This operation changes the name of the network in the Compute system.
797

    
798
**Example Update Network Name Request: JSON**:
799

    
800
.. code-block:: javascript
801

    
802
  {
803
      "network": {
804
          "name": "new_name"
805
      }
806
  }
807

    
808
This operation does not contain a response body.
809

    
810

    
811
Delete Network
812
..............
813

    
814
**DELETE** /networks/*id*
815

    
816
**Normal Response Code**: 204
817

    
818
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
819
unauthorized (401), itemNotFound (404), unauthorized (401), overLimit (413) 
820

    
821
This operation deletes a network from the system.
822

    
823
This operation does not require a request or a response body.
824

    
825

    
826
Network Actions
827
---------------
828

    
829
Add Server
830
..........
831

    
832
**POST** /networks/*id*/action
833

    
834
**Normal Response Code**: 202
835

    
836
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
837
unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404),
838
overLimit (413)
839

    
840
This operation adds a server to the specified network.
841

    
842
**Example Action Add: JSON**:
843

    
844
.. code-block:: javascript
845

    
846
  {
847
      "add" : {
848
          "serverRef" : 42
849
      }
850
  }
851

    
852
This operation does not contain a response body.
853

    
854

    
855
Remove Server
856
.............
857

    
858
**POST** /networks/*id*/action
859

    
860
**Normal Response Code**: 202
861

    
862
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503),
863
unauthorized (401), badRequest (400), badMediaType(415), itemNotFound (404),
864
overLimit (413)
865

    
866
This operation removes a server from the specified network.
867

    
868
**Example Action Remove: JSON**:
869

    
870
.. code-block:: javascript
871

    
872
  {
873
      "remove" : {
874
          "serverRef" : 42
875
      }
876
  }
877

    
878
This operation does not contain a response body.
879

    
880
Index of details
881
----------------
882

    
883
.. _server-ref:
884

    
885
Server Attributes
886
.................
887

    
888
================ ========================== ======== ==========
889
Server attribute Description                Cyclades OS Compute
890
================ ========================== ======== ==========
891
id               Server ID                  ✔        ✔
892
name             Server Name                ✔        ✔
893
status           Server Status              ✔        ✔
894
updated          Date of last modification  ✔        ✔
895
created          Date of creation           ✔        ✔
896
hostId           Physical host              empty    ✔
897
imageRef         Image ID                   ✔        **✘**
898
image            A full image descreption   **✘**    ✔
899
flavorRef        Flavor ID                  ✔        **✘**
900
flavor           A full flavor description  **✘**    ✔
901
adminPass        Superuser Password         ✔        ✔
902
suspended        If server is suspended     ✔        ✔
903
progress         Build progress             ✔        ✔
904
metadata         Custom server metadata     ✔        ✔
905
user_id          Server owner               **✘**    ✔
906
tenant_id        Server tenant              **✘**    ✔
907
accessIPv4       Server IPV4 net address    **✘**    ✔
908
accessIPv6       Server IPV4 net address    **✘**    ✔
909
addresses        Nets connected on server   **✘**    ✔
910
links            Server links               **✘**    ✔
911
================ ========================== ======== ==========
912

    
913
* **status** values are described `here <status-ref>`_
914

    
915
* **updated** and **created** are date-formated
916

    
917
* **hostId** is always empty in Cyclades and is returned for compatibility reasons
918

    
919
* **imageRef** and **flavorRef** always refer to existing Image and Flavor specifications. Cyclades improved the OpenStack approach by using references to Image and Flavor attributes, instead of listing their full properties
920

    
921
* **adminPass** in Cyclades it is generated automatically during creation. For safety, it is not stored anywhere in the system and it cannot be recovered with a query request
922

    
923
* **suspended** is True only of the server is suspended by the cloud administrations or policy
924

    
925
* **progress** is a number between 0 and 100 and reflects the server building status
926

    
927
* **metadata** are custom key:value pairs refering to the VM. In Cyclades, the ``OS`` and ``users`` metadata are automatically retrieved from the servers image during creation
928

    
929
.. _status-ref:
930

    
931
Server Status
932
.............
933

    
934
============= ==================== ======== ==========
935
Status        Description          Cyclades OS Compute
936
============= ==================== ======== ==========
937
BUILD         Building             ✔        ✔
938
ACTIVE        Up and running       ✔        ✔
939
STOPPED       Shut down            ✔        **✘**
940
REBOOT        Rebooting            ✔        ✔
941
DELETED       Removed              ✔        ✔
942
UNKNOWN       Unexpected error     ✔        ✔
943
ERROR         In error             ✔        ✔
944
HARD_REBOOT   Hard rebooting       **✘**    ✔
945
PASSWORD      Resetting password   **✘**    ✔
946
REBUILD       Rebuilding server    **✘**    ✔
947
RESCUE        In rescue mode       **✘**    ✔
948
RESIZE        Resizing             **✘**    ✔
949
REVERT_RESIZE Failed to resize     **✘**    ✔
950
SHUTOFF       Shut down by user    **✘**    ✔
951
SUSPENDED     Suspended            **✘**    ✔
952
VERIFY_RESIZE Waiting confirmation **✘**    ✔
953
============= ==================== ======== ==========