compute-api-guide.rst 90.4 KB
Newer Older
1
.. _compute-api-guide:
2

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

6
`Cyclades <cyclades.html>`_ is the Compute Service of `Synnefo
7 8 9
<http://www.synnefo.org>`_. The Cyclades/Compute API complies with
`OpenStack Compute <http://docs.openstack.org/api/openstack-compute/2/content>`_
with custom extensions when needed.
10

11
This document's goals are:
12

13 14
* Define the Cyclades/Compute REST API
* Clarify the differences between Cyclades and OpenStack/Compute
15

16
Users and developers who wish to access Cyclades through its REST API are
17 18
advised to use the
`kamaki <http://www.synnefo.org/docs/kamaki/latest/index.html>`_ command-line
19
client and associated python library, instead of making direct calls.
20 21 22 23

Overview
========

24 25 26 27
* OpenStack does not define if requests for invalid URLs should return 404 or a
* Fault. We return a BadRequest Fault.
* OpenStack does not define if requests with a wrong HTTP method should return
* 405 or a Fault. We return a BadRequest Fault.
28 29 30 31 32 33 34

General API Information
=======================

Authentication
--------------

35 36 37
All requests use the same authentication method: an ``X-Auth-Token`` header is
passed to the servive, which is used to authenticate the user and retrieve user
related information. No other user details are passed through HTTP.
38 39 40 41

Efficient Polling with the Changes-Since Parameter
--------------------------------------------------

42
* Effectively limit support of the changes-since parameter in **List Servers**
43 44
  and **List Images**.

45
* Assume that garbage collection of deleted servers will only affect servers
46 47 48
  deleted ``POLL_TIME`` seconds (default: 3600) in the past or earlier. Else
  loose the information of a server getting deleted.

49
* Images do not support a deleted state, so deletions cannot be tracked.
50

51 52
Limitations
-----------
53

54
* Version MIME type and vesionless requests are not currently supported.
55

56 57
* Cyclades only supports JSON Requests and JSON/XML Responses. XML Requests are
  currently not supported.
58

59
* Optional content compression support is currently not supported.
60

61 62
* To prevent abuse, HTTP sessions have a timeout of 20 seconds before being
  closed.
63

64
* Full URI references and ``self`` and ``bookmark`` links are not supported.
65

66
* Pagination is currently not supported.
67

68 69 70 71 72
* Cached responses are currently not supported.

* Limits are currently not supported.

* Extensions are currently not supported.
73 74 75 76 77


API Operations
==============

78 79 80 81 82 83 84 85 86 87 88 89 90
.. rubric:: Servers

================================================== ========================================= ====== ======== ==========
Description                                        URI                                       Method Cyclades OS/Compute
================================================== ========================================= ====== ======== ==========
`List <#list-servers>`_                            ``/servers``                              GET    ✔        ✔
\                                                  ``/servers/detail``                       GET    ✔        ✔
`Create <#create-server>`_                         ``/servers``                              POST   ✔        ✔
`Get Stats <#get-server-stats>`_                   ``/servers/<server-id>/stats``            GET    ✔        **✘**
`Get Diagnostics <#get-server-diagnostics>`_       ``/servers/<server-id>/diagnostics``      GET    ✔        **✘**
`Get Details <#get-server-details>`_               ``/servers/<server id>``                  GET    ✔        ✔
`Rename <#rename-server>`_                         ``/servers/<server id>``                  PUT    ✔        ✔
`Delete <#delete-server>`_                         ``/servers/<server id>``                  DELETE ✔        ✔
91 92
`List Connections <#list-server-connections>`_     ``/servers/<server id>/ips``              GET    ✔        ✔
`Get Connection <#connection-with-network>`_       ``/servers/<server id>/ips/<network id>`` GET    ✔        ✔
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
`List Metadata <#list-server-metadata>`_           ``/servers/<server-id>/metadata``         GET    ✔        ✔
`Update Metadata <#set-update-server-metadata>`_   ``/servers/<server-id>/metadata``         PUT    **✘**    ✔
\                                                  ``/servers/<server-id>/metadata``         POST   ✔        ✔
`Get Meta Item <#get-server-metadata-item>`_       ``/servers/<server-id>/metadata/<key>``   GET    ✔        ✔
`Update Meta Item <#update-server-metadata-item>`_ ``/servers/<server-id>/metadata/<key>``   PUT    ✔        ✔
`Delete Meta Item <#delete-server-metadata>`_      ``/servers/<server-id>/metadata/<key>``   DELETE ✔        ✔
`Actions <#server-actions>`_                       ``servers/<server id>/action``            POST   ✔        ✔
================================================== ========================================= ====== ======== ==========

.. rubric:: Flavors

==================================== ======================== ====== ======== ==========
Description                          URI                      Method Cyclades OS/Compute
==================================== ======================== ====== ======== ==========
`List <#list-flavors>`_              ``/flavors``             GET    ✔        ✔
\                                    ``/flavors/detail``      GET    ✔        **✘**
`Get details <#get-flavor-details>`_ ``/flavors/<flavor-id>`` GET    ✔        ✔
==================================== ======================== ====== ======== ==========

.. rubric:: Images

=========================================== ===================================== ====== ======== ==========
Description                                 URI                                   Method Cyclades OS/Compute
=========================================== ===================================== ====== ======== ==========
`List <#list-images>`_                      ``/images``                           GET    ✔        ✔
\                                           ``/images/detail``                    GET    ✔        ✔
`Get details <#get-image-details>`_         ``/images/<image-id>``                GET    ✔        ✔
`Delete <#delete-image>`_                   ``/images/<image id>``                DELETE ✔        ✔
`List Metadata <#list-image-metadata>`_     ``/images/<image-id>/metadata``       GET    ✔        ✔
`Update Metadata <#update-image-metadata>`_ ``/images/<image-id>/metadata``       POST   ✔        ✔
\                                           ``/images/<image-id>/metadata``       PUT    **✘**    ✔
`Get Meta Item <#get-image-metadata>`_      ``/image/<image-id>/metadata/<key>``  GET    ✔        ✔
`Update Metadata <#update-image-metadata>`_ ``/images/<image-id>/metadata/<key>`` PUT    ✔        ✔
`Delete Metadata <#delete-image-metadata>`_ ``/images/<image-id>/metadata/<key>`` DELETE ✔        ✔
=========================================== ===================================== ====== ======== ==========
128

129
List Servers
130
------------
131

132 133 134 135
List all virtual servers owned by the user.

.. rubric:: Request

136
=================== ====== ======== ==========
137
URI                 Method Cyclades OS/Compute
138 139
=================== ====== ======== ==========
``/servers``        GET    ✔        ✔
Stavros Sachtouris's avatar
Stavros Sachtouris committed
140
``/servers/detail`` GET    ✔        ✔
141 142
=================== ====== ======== ==========

143 144 145
* Both requests return a list of servers. The first returns just ``id``,
  ``name`` and ``links``, while the second returns the full collections of
  server attributes.
146

147 148
|
==============  ========================= ======== ==========
149
Request Header  Value                     Cyclades OS/Compute
150 151 152 153 154
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========

|
155
================= =================================== ======== ==========
156
Request Parameter Value                               Cyclades OS/Compute
157
================= =================================== ======== ==========
158 159
json              Respond in json                     default  **✘**
xml               Respond in xml                      ✔        **✘**
160 161 162 163 164 165 166 167 168
changes-since     Servers delete since that timestamp ✔        ✔
image             Image reference                     **✘**    ✔
flavor            VM flavor reference                 **✘**    ✔
server            Server flavor reference             **✘**    ✔
status            Server status                       **✘**    ✔
marker            Last list last ID                   **✘**    ✔
limit             Page size                           **✘**    ✔
================= =================================== ======== ==========

169 170
* **json** and **xml** parameters are mutually exclusive. If none supported,
the response will be formated in json.
171

172 173
* **status** refers to the `server status <#status-ref>`_

174 175
* **changes-since** must be an ISO8601 date string

176
.. rubric:: Response
177 178 179 180 181 182 183 184

=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
304 (No servers since date) Can be returned if ``changes-since`` is given
400 (Bad Request)           Invalid or malformed ``changes-since`` parameter
401 (Unauthorized)          Missing or expired user token
185
403 (Forbidden)             User is not allowed to perform this operation
186
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
187
\                           internal error
188 189 190
503 (Service Unavailable)   The server is not currently available
=========================== =====================

191 192 193
|

Response body contents::
194

195 196 197 198 199 200
  servers: [
    {
      <server attribute>: <value>,
      ...
    }, ...
  ]
201

202
The server attributes are listed `here <#server-ref>`_
203 204

*Example List Servers: JSON (regular)*
205 206

.. code-block:: javascript
207

208 209
  GET https://example.org/compute/v2.0/servers

210

211 212
  {
    "servers": [
213 214
      {
        "links": [
215 216 217 218 219 220 221
          {
            "href": "https://example.org/compute/v2.0/servers/42", 
            "rel": "self"
          }, {
            "href": "https://example.org/compute/v2.0/servers/42", 
            "rel": "bookmark"
          }
222 223 224 225 226
        ],
        "id": "42",
        "name": "My Server",
      }, {
        "links": [
227 228 229 230 231 232 233
          {
            "href": "https://example.org/compute/v2.0/servers/43", 
            "rel": "self"
          }, {
            "href": "https://example.org/compute/v2.0/servers/43", 
            "rel": "bookmark"
          }
234
        ],
235
        "id": "84",
236 237 238
        "name": "My Server",
      }
    ]
239
  }
240 241 242

*Example List Servers: JSON (detail)*

243 244 245
  GET https://example.org/compute/v2.0/servers/detail


246 247
.. code-block:: javascript

248 249
  {
    "servers": [
250
      {
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
        "addresses": [
          "2718": [
            {
              "version": 6,
              "addr": "2001:443:2dfc:1232:a810:3cf:fe9b:21ab",
              "OS-EXT-IPS:type": "fixed"
            }
          ],
          "2719": [
            {
              "version": 4,
              "addr": "192.168.1.2",
              "OS-EXT-IPS:type": "floating"
            }
          ]
        ],
267 268
        "attachments": [
            {
269 270 271
              "id": "18",
              "network_id": "2718",
              "mac_address": "aa:01:02:6c:34:ab",
272
              "firewallProfile": "DISABLED",
273 274 275 276 277 278 279 280 281 282 283
              "ipv4": "",
              "ipv6": "2001:443:2dfc:1232:a810:3cf:fe9b:21ab"
              "OS-EXT-IPS:type": "fixed"
            }, {
              "id": "19",
              "network_id": "2719",
              "mac_address": "aa:00:0c:6d:34:bb",
              "firewallProfile": "PROTECTED",
              "ipv4": "192.168.1.2",
              "ipv6": ""
              "OS-EXT-IPS:type": "floating"
284 285
            }
        ],
286
        "links": [
287 288 289 290 291 292 293 294 295 296 297
          {
            "href": "https://example.org/compute/v2.0/servers/42", 
            "rel": "self"
          }, {
            "href": "https://example.org/compute/v2.0/servers/42", 
            "rel": "bookmark"
          }
        ],
        "image": {
          "id": "im4g3-1d",
          "links": [
298
            {
299 300 301 302 303 304 305 306
              "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
              "rel": "self"
            }, {
              "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
              "rel": "bookmark"
            }, {
              "href": "https://example.org/image/v1.0/images/im4g3-1d", 
              "rel": "alternate"
307
            }
308 309 310
          ]
        },
        "suspended": false,
311
        "created': '2011-04-19T10:18:52.085737+00:00',
312
        "flavor": {
313 314 315 316 317 318 319 320 321 322
          "id": 1",
          "links": [
            {
              "href": "https://example.org/compute/v2.0/flavors/1", 
              "rel": "self"
            }, {
              "href": "https://example.org/compute/v2.0/flavors/1", 
              "rel": "bookmark"
            }
          ]
323
        },
324
        "id": "42",
325 326 327 328 329 330
        "security_groups": [{"name": "default"}],
        "user_id": "s0m5-u5e7-1d",
        "accessIPv4": "",
        "accessIPv6": "",
        "progress": 100,
        "config_drive": "",
331
        "status": "ACTIVE",
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
        "updated": "2011-05-29T14:07:07.037602+00:00",
        "hostId": "",
        "SNF:fqdn": "snf-42.vm.example.org",
        "key_name": null,
        "name": "My Server",
        "created": "2014-02-12T08:31:37.834542+00:00",
        "tenant_id": "s0m5-u5e7-1d",
        "SNF:port_forwarding": {},
        "SNF:task_state": "",
        "diagnostics": [
            {
                "level": "DEBUG",
                "created": "2014-02-12T08:31:37.834542+00:00",
                "source": "image-info",
                "source_date": "2014-02-12T08:32:35.929507+00:00",
                "message": "Image customization finished successfully.",
                "details": null
            }
        ],
        "metadata": {
            "os": "debian",
            "users": "root"
        }
355
      }, {
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
      {
        "addresses": [
          "2718": [
            {
              "version": 6,
              "addr": "2001:443:2dfc:1232:a810:3cf:fe9b:21cd",
              "OS-EXT-IPS:type": "fixed"
            }
          ],
          "4178": [
            {
              "version": 4,
              "addr": "192.168.1.3",
              "OS-EXT-IPS:type": "floating"
            }
          ]
        ],
373 374
        "attachments": [
            {
375 376 377
              "id": "36",
              "network_id": "2718",
              "mac_address": "aa:01:02:6c:34:cd",
378
              "firewallProfile": "DISABLED",
379 380 381
              "ipv4": "",
              "ipv6": "2001:443:2dfc:1232:a810:3cf:fe9b:21cd"
              "OS-EXT-IPS:type": "fixed"
382
            }, {
383 384 385 386 387 388 389
              "id": "38",
              "network_id": "4178",
              "mac_address": "aa:00:0c:6d:34:cc",
              "firewallProfile": "PROTECTED",
              "ipv4": "192.168.1.3",
              "ipv6": ""
              "OS-EXT-IPS:type": "floating"
390 391
            }
        ],
392
        "links": [
393 394 395 396 397 398 399 400 401 402 403
          {
            "href": "https://example.org/compute/v2.0/servers/84", 
            "rel": "self"
          }, {
            "href": "https://example.org/compute/v2.0/servers/84", 
            "rel": "bookmark"
          }
        ],
        "image": {
          "id": "im4g3-1d",
          "links": [
404
            {
405 406 407 408 409 410 411 412
              "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
              "rel": "self"
            }, {
              "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
              "rel": "bookmark"
            }, {
              "href": "https://example.org/image/v1.0/images/im4g3-1d", 
              "rel": "alternate"
413
            }
414
          ]
415
        },
416 417 418 419 420 421 422 423 424 425 426 427 428
        "suspended": false,
        "created': '2011-04-21T10:18:52.085737+00:00',
        "flavor": {
          "id": 3",
          "links": [
            {
              "href": "https://example.org/compute/v2.0/flavors/3", 
              "rel": "self"
            }, {
              "href": "https://example.org/compute/v2.0/flavors/3", 
              "rel": "bookmark"
            }
          ]
429
        },
430 431 432 433 434 435 436
        "id": "84",
        "security_groups": [{"name": "default"}],
        "user_id": "s0m5-u5e7-1d",
        "accessIPv4": "",
        "accessIPv6": "",
        "progress": 100,
        "config_drive": "",
437
        "status": "ACTIVE",
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
        "updated": "2011-05-30T14:07:07.037602+00:00",
        "hostId": "",
        "SNF:fqdn": "snf-84.vm.example.org",
        "key_name": null,
        "name": "My Other Server",
        "created": "2014-02-21T08:31:37.834542+00:00",
        "tenant_id": "s0m5-u5e7-1d",
        "SNF:port_forwarding": {},
        "SNF:task_state": "",
        "diagnostics": [
          {
            "level": "DEBUG",
            "created": "2014-02-21T08:31:37.834542+00:00",
            "source": "image-info",
            "source_date": "2014-02-21T08:32:35.929507+00:00",
            "message": "Image customization finished successfully.",
            "details": null
          }
        ],
        "metadata": {
          "os": "debian",
          "users": "root"
        }
461 462
      }
    ]
463
  }
464 465


466
Create Server
467
-------------
468

469 470 471 472
Create a new virtual server

.. rubric:: Request

473
============ ====== ======== ==========
474
URI          Method Cyclades OS/Compute
475 476 477
============ ====== ======== ==========
``/servers`` POST   ✔        ✔
============ ====== ======== ==========
478 479

|
480 481 482 483
==============  ========================= ======== ==========
Request Header  Value                     Cyclades OS/Compute
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
484 485
Content-Type    Type or request body      required required
Content-Length  Length of request body    required required
486 487 488
==============  ========================= ======== ==========

|
489
================= ===============
490
Request Parameter Value
491 492
================= ===============
json              Respond in json
493
xml               Respond in xml
494 495
================= ===============

496
Request body contents::
497

498 499 500 501 502 503
  server: {
      <server attribute>: <value>,
      ...
      personality: [
        ...
      ],
504 505 506
      networks: [
        ...
      ]
507 508
      ...
  }
509 510

=========== ==================== ======== ==========
511
Attributes  Description          Cyclades OS/Compute
512 513 514 515 516 517
=========== ==================== ======== ==========
name        The server name      ✔        ✔
imageRef    Image id             ✔        ✔
flavorRef   Resources flavor     ✔        ✔
personality Personality contents ✔        ✔
metadata    Custom metadata      ✔        ✔
518
project     Project assignment   ✔        **✘**
519 520 521 522
=========== ==================== ======== ==========

* **name** can be any string

523
* **imageRed** and **flavorRed** should refer to existing images and hardware
524
  flavors accessible by the user
525

526
* **metadata** are ``key``:``value`` pairs of custom server-specific metadata.
527 528
  There are no semantic limitations, although the ``OS`` and ``USERS`` values
  should rather be defined
529

530
* **project** (optional) is the project where the VM is to be assigned. If not
531
  given, user's system project is assumed (identified with the same uuid as the
532 533
  user).

534
* **personality** (optional) is a list of personality injections. A personality
535 536 537 538 539
  injection is a way to add a file into a virtual server while creating it.
  Each change modifies/creates a file on the virtual server. The injected data
  (``contents``) should not exceed 10240 *bytes* in size and must be base64
  encoded. The file mode should be a number, not a string. A personality
  injection contains the following attributes:
540

541 542 543 544 545 546 547 548 549
====================== =================== ======== ==========
Personality Attributes Description         Cyclades OS/Compute
====================== =================== ======== ==========
path                   File path on server ✔        ✔
contents               Data to inject      ✔        ✔
group                  User group          ✔        **✘**
mode                   File access mode    ✔        **✘**
owner                  File owner          ✔        **✘**
====================== =================== ======== ==========
550

551 552
*Example Create Server Request: JSON*

553 554
* **personality** (optional) is a list of
  `personality injections <#personality-ref>`_
555

556 557
* **networks** (optional) is a list of
  `network connections <#network-on-vm-ref>`_.
558

559 560
.. rubric:: Response

561 562 563 564 565 566 567 568
=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
400 (Bad Request)           Malformed request data
401 (Unauthorized)          Missing or expired user token
403 (Forbidden)             User is not allowed to perform this operation
404 (Not Found)             Image or Flavor not found
569
413 (Over Limit)            Exceeded some resource limit
570
415 (Bad Media Type)        
571
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
572
\                           internal error
573
503 (Service Unavailable)   No available backends or service currently
Stavros Sachtouris's avatar
Stavros Sachtouris committed
574
\                           unavailable
575 576 577 578
=========================== =====================

|

579 580 581 582 583 584 585 586
Response body contents::

  server: {
    <server attribute>: <value>,
    ...
  }

Server attributes are `listed here <#server-ref>`_.
587

588 589 590
.. note:: The ``adminPass`` attribute is generated in the response. This is the
    only case where this attribute appears in a response.

591
*Example Create Server Response: JSON*
592 593

.. code-block:: javascript
594

595 596 597
  POST https://example.org/compute/v2.0/servers


598 599
  {
    "server": {
600 601
      "name": "My Example Server",
      "id": 5678,
602 603
      "status": "BUILD",
      "created": "2013-04-10T13:52:17.085402+00:00",
604
      "updated": "2013-04-10T13:52:17.085402+00:00",
605
      "adminPass": "fKCqlZe2at",
606
      "progress": 0
607
      "metadata": {
608 609 610 611
        "OS": "debian",
        "USERS": "root"
      },
      ...
612 613
    }
  }
614

615
.. _personality-ref:
616

617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714
Personality: injecting files while creating a virtual server
............................................................

The term "personality" refers to a mechanism for injecting data as files into
the file system of a virtual server while the server is being created. This
mechanism has many application e.g., the injection of ``ssh keys`` for secure
password-less access, automation in user profile configuration, etc.

A personality injection contains the following attributes:

====================== =================== ======== ==========
Personality Attributes Description         Cyclades OS/Compute
====================== =================== ======== ==========
path                   File path on server ✔        ✔
contents               Data to inject      ✔        ✔
group                  User group          ✔        **✘**
mode                   File access mode    ✔        **✘**
owner                  File owner          ✔        **✘**
====================== =================== ======== ==========

* **path** is the path (including name) for the file on the remote server. If
  the file does not exist, it will be created
* **contents** is the data to be injected, must not exceed 10240 *bytes* and
  must be base64-encoded
* **mode** is the access mode of the created remote file and must be a number
  (usually octal or decimal)

*Example Create Server Request: JSON*

.. code-block:: javascript

  POST https://example.org/compute/v2.0/servers
  {
    "server": {
      "name": "My Password-less Server",
      "personality": [
        {
          "path": "/home/someuser/.ssh/authorized_keys",
          "contents": "Some users public key",
          "group": "users",
          "mode": 0600,
          "owner": "someuser"
        }, {
          "path": "/home/someuser/.bashrc",
          "contents": "bash configuration",
          "group": "users",
          "mode": 0777,
          "owner": "someuser"
        }
      ],
      ...
    }
  }

.. _network-on-vm-ref:

Network connections on virtual server creation
..............................................

A network connection is established by creating a port that connects a virtual
device with a network. There are five cases:

* The ``network`` attribute is not provided. In that case, the service will
  apply its default policy (e.g., automatic public network and IP assignment)
* The ``network`` attribute is an empty list. In that case, the virtual server
  will not have any network connections
* Provide an existing network ID. In that case, the virtual server will be
  connected to that network.
* Provide an existing network ID and an IP (which is already associated to that
  network). In that case, the virtual server will be connected to that network
  with this specific IP attached.
* Provide an existing port ID to establish a connection through it.

========================================= ======== ==========
Network attributes on server construction Cyclades OS/Compute
========================================= ======== ==========
uuid                                      ✔        ✔
fixed_ip                                  ✔        ✔
port                                      ✔        ✔
========================================= ======== ==========

E.g., the following example connects a public network with an IP (2719) and a
private network (9876) on the virtual server under construction:

* Example Connect server on various networks*

.. code-block:: python

  POST https://example.org/compute/v2.0/servers
  {
    "server": {
      "networks": [
        {"uuid": 9876},
        {"uuid": 2719, "fixed_ip": "192.168.1.2"},
      ],
      ...
    }
  }
715 716


717
Get Server Stats
718
----------------
719

720 721 722
.. note:: This operation is not part of OS/Compute v2.

This operation returns URLs of graphs showing CPU and Network statistics.
723

724
.. rubric:: Request
725

726
============================== ====== ======== ==========
727
URI                            Method Cyclades OS/Compute
728 729 730
============================== ====== ======== ==========
``/servers/<server-id>/stats`` GET    ✔        **✘**
============================== ====== ======== ==========
731

732
|
733
==============  ========================= ======== ==========
734
Request Header  Value                     Cyclades OS/Compute
735 736 737
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========
738 739 740 741 742 743 744 745 746

|
================= ===============
Request Parameter Value          
================= ===============
json              Respond in json
xml               Respond in xml 
================= ===============

747 748
* **json** and **xml** parameters are mutually exclusive. If none supported,
the response will be formated in json.
749

750
.. rubric:: Response
751 752 753 754 755 756 757 758 759

=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
400 (Bad Request)           Invalid server ID or Server deleted
401 (Unauthorized)          Missing or expired user token
403 (Forbidden)             Administratively suspended server
404 (Not Found)             Server not found
760
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
761
\                           internal error
762 763 764 765
503 (Service Unavailable)   The server is not currently available
=========================== =====================

|
766

767 768 769 770 771
Response body contents::

  stats: {<parameter>: <value> }

============= ======================
772
Parameter     Description
773 774 775 776 777 778 779 780 781 782
============= ======================
serverRef     Server ID
refresh       Refresh frequency
cpuBar        Latest CPU load graph URL
cpuTimeSeries CPU load / time graph URL
netBar        Latest Network load graph URL
netTimeSeries Network load / time graph URL
============= ======================

* **refresh** is the recommended sampling rate
783

784
*Example Get Server Stats Response: JSON*
785 786

.. code-block:: javascript
787
  GET https://example.org/compute/v2.0/servers/5678/stats
788
  {
789
    "stats": {
790
      "serverRef": 5678,
791 792 793 794 795 796
      "refresh": 60,
      "cpuBar": "http://stats.okeanos.grnet.gr/b9a...048c/cpu-bar.png",
      "cpuTimeSeries": "http://stats.okeanos.grnet.gr/b9a...048c/cpu-ts.png",
      "netBar": "http://stats.okeanos.grnet.gr/b9a...048c/net-bar.png",
      "netTimeSeries": "http://stats.okeanos.grnet.gr/b9a...048c/net-ts.png"
    }
797 798
  }

799
Get Server Diagnostics
800
----------------------
801

802
.. note:: This operation is not part of OS/Compute v2.
803

804 805 806
This operation returns diagnostic information (logs) for a server.

.. rubric:: Request
807 808

==================================== ====== ======== ==========
809
URI                                  Method Cyclades OS/Compute
810 811 812 813 814
==================================== ====== ======== ==========
``/servers/<server-id>/diagnostics`` GET    ✔        **✘**
==================================== ====== ======== ==========

|
815 816 817 818 819
==============  ========================= ======== ==========
Request Header  Value                     Cyclades OS/Compute
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========
820

821
.. rubric:: Response
822 823 824 825 826 827 828 829 830 831

=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
400 (Bad Request)           Invalid server ID or Server deleted
401 (Unauthorized)          Missing or expired user token
403 (Forbidden)             Administratively suspended server
404 (Not Found)             Server not found
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
832
\                           internal error
833 834 835
503 (Service Unavailable)   The server is not currently available
=========================== =====================

836 837 838 839 840 841 842 843 844 845 846
|

Response body contents::

  [
    {
      <diagnostic attribute}: <value>,
      ...
    },
    ...
  ]
847 848 849 850 851 852 853

==================== ===========
Diagnostic attribute Description
==================== ===========
level                Debug level
created              Log entry timestamp
source               Log source proccess
854
source_date          Log source date
855 856 857 858
message              Log description
details              Detailed log description
==================== ===========

859
*Example Get Server Diagnostics Response: JSON*
860 861 862

.. code-block:: javascript

863
  GET https://example.org/compute/v2.0/servers/5678/diagnostics
864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881
  [
    {
      "level": "DEBUG",
      "created": "2013-04-09T15:25:53.965144+00:00",
      "source": "image-helper-task-start",
      "source_date": "2013-04-09T15:25:53.954695+00:00",
      "message": "FixPartitionTable",
      "details": null
    }, {
      "level": "DEBUG",
      "created": "2013-04-09T15:25:46.413718+00:00",
      "source": "image-info",
      "source_date": "2013-04-09T15:25:46.404477+00:00",
      "message": "Starting customization VM...",
      "details": null
    }
  ]

882
Get Server Details
883
------------------
884

885 886 887 888
This operation returns detailed information for a virtual server

.. rubric:: Request

889
======================== ====== ======== ==========
890
URI                      Method Cyclades OS/Compute
891 892 893 894 895 896 897
======================== ====== ======== ==========
``/servers/<server id>`` GET    ✔        ✔
======================== ====== ======== ==========

|

==============  ========================= ======== ==========
898
Request Header  Value                     Cyclades OS/Compute
899 900 901 902
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========

903
.. rubric:: Response
904 905 906 907 908 909 910 911 912

=========================== =====================
Return Code                 Description
=========================== =====================
200 (OK)                    Request succeeded
400 (Bad Request)           Malformed server id
401 (Unauthorized)          Missing or expired user token
403 (Forbidden)             Administratively suspended server
404 (Not Found)             Server not found
913
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
914
\                           internal error
915
503 (Service Unavailable)   No available backends or service currently
Stavros Sachtouris's avatar
Stavros Sachtouris committed
916
\                           unavailable
917 918 919 920
=========================== =====================

|

921 922 923 924 925 926
Response body contents::

  server: {
    <server attribute>: <value>,
    ...
  }
927

928 929 930
Server attributes are explained `here <#server-ref>`_

*Example get server Details*
931 932 933

.. code-block:: javascript

934 935 936
  GET https://example.org/compute/v2.0/servers/84


937 938
  {
    "server": {
939 940 941 942 943 944 945
      "addresses": [
        "2718": [
          {
            "version": 6,
            "addr": "2001:443:2dfc:1232:a810:3cf:fe9b:21cd",
            "OS-EXT-IPS:type": "fixed"
          }
946
        ],
947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984
        "4178": [
          {
            "version": 4,
            "addr": "192.168.1.3",
            "OS-EXT-IPS:type": "floating"
          }
        ]
      ],
      "attachments": [
          {
            "id": "36",
            "network_id": "2718",
            "mac_address": "aa:01:02:6c:34:cd",
            "firewallProfile": "DISABLED",
            "ipv4": "",
            "ipv6": "2001:443:2dfc:1232:a810:3cf:fe9b:21cd"
            "OS-EXT-IPS:type": "fixed"
          }, {
            "id": "38",
            "network_id": "4178",
            "mac_address": "aa:00:0c:6d:34:cc",
            "firewallProfile": "PROTECTED",
            "ipv4": "192.168.1.3",
            "ipv6": ""
            "OS-EXT-IPS:type": "floating"
          }
      ],
      "links": [
        {
          "href": "https://example.org/compute/v2.0/servers/84", 
          "rel": "self"
        }, {
          "href": "https://example.org/compute/v2.0/servers/84", 
          "rel": "bookmark"
        }
      ],
      "image": {
        "id": "im4g3-1d",
985
        "links": [
986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041
          {
            "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
            "rel": "self"
          }, {
            "href": "https://example.org/compute/v2.0/images/im4g3-1d", 
            "rel": "bookmark"
          }, {
            "href": "https://example.org/image/v1.0/images/im4g3-1d", 
            "rel": "alternate"
          }
        ]
      },
      "suspended": false,
      "created': '2011-04-21T10:18:52.085737+00:00',
      "flavor": {
        "id": 3",
        "links": [
          {
            "href": "https://example.org/compute/v2.0/flavors/3", 
            "rel": "self"
          }, {
            "href": "https://example.org/compute/v2.0/flavors/3", 
            "rel": "bookmark"
          }
        ]
      },
      "id": "84",
      "security_groups": [{"name": "default"}],
      "user_id": "s0m5-u5e7-1d",
      "accessIPv4": "",
      "accessIPv6": "",
      "progress": 100,
      "config_drive": "",
      "status": "ACTIVE",
      "updated": "2011-05-30T14:07:07.037602+00:00",
      "hostId": "",
      "SNF:fqdn": "snf-84.vm.example.org",
      "key_name": null,
      "name": "My Other Server",
      "created": "2014-02-21T08:31:37.834542+00:00",
      "tenant_id": "s0m5-u5e7-1d",
      "SNF:port_forwarding": {},
      "SNF:task_state": "",
      "diagnostics": [
        {
          "level": "DEBUG",
          "created": "2014-02-21T08:31:37.834542+00:00",
          "source": "image-info",
          "source_date": "2014-02-21T08:32:35.929507+00:00",
          "message": "Image customization finished successfully.",
          "details": null
        }
      ],
      "metadata": {
        "os": "debian",
        "users": "root"
1042 1043 1044
      }
    }
  }
1045

1046
Rename Server
1047
-------------
1048

1049 1050
In Synnefo/Cyclades, only the ``name`` attribute of a virtual server can be
modified with this call.
1051 1052 1053

.. rubric:: Response

1054
======================== ====== ======== ==========
1055
URI                      Method Cyclades OS/Compute
1056 1057 1058 1059 1060 1061
======================== ====== ======== ==========
``/servers/<server id>`` PUT    ✔        ✔
======================== ====== ======== ==========

|
==============  ========================= ======== ==========
1062
Request Header  Value                     Cyclades OS/Compute
1063 1064
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
1065 1066
Content-Type    Type or request body      required required
Content-Length  Length of request body    required required
1067 1068
==============  ========================= ======== ==========

1069 1070 1071 1072 1073 1074
Request body contents::

  server: {
    <server attribute>: <value>,
    ...
  }
1075 1076

=========== ==================== ======== ==========
1077
Attribute   Description          Cyclades OS/Compute
1078 1079 1080 1081 1082 1083
=========== ==================== ======== ==========
name        The server name      ✔        ✔
accessIPv4  IP v4 address        **✘**    ✔
accessIPv6  IP v6 address        **✘**    ✔
=========== ==================== ======== ==========

1084 1085 1086
* **accessIPv4** and **accessIPv6** are ignored. Cyclades features a different
  `mechanism for managing network connections <network-api-guide.html>`_ on
  servers
1087

1088 1089 1090 1091
*Example Rename Server Request: JSON*

.. code-block:: javascript

1092
  {"server": {"name": "New name"}}
1093

1094
.. rubric:: Response
1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105

=========================== =====================
Return Code                 Description
=========================== =====================
204 (OK)                    Request succeeded
400 (Bad Request)           Malformed request or malformed server id
401 (Unauthorized)          Missing or expired user token
403 (Forbidden)             User is not allowed to perform this operation
404 (Not Found)             Server not found
415 (Bad Media Type)
409 (Build In Progress)     Server is not ready yet
1106
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
1107
\                           internal error
1108
503 (Service Unavailable)   No available backends or service currently
Stavros Sachtouris's avatar
Stavros Sachtouris committed
1109
\                           unavailable
1110 1111
=========================== =====================

1112 1113 1114
.. note:: In case of a 204 return code, there will be no request results
  according to the Cyclades API. Compute OS API suggests that response should
  include the new server details.
1115

1116
Delete Server
1117
-------------
1118

1119 1120
Delete a virtual server. When a server is deleted, all its attachments (ports)
are deleted as well.
1121 1122 1123

.. rubric:: Request

1124
======================== ====== ======== ==========
1125
URI                      Method Cyclades OS/Compute
1126 1127 1128 1129
======================== ====== ======== ==========
``/servers/<server id>`` DELETE ✔        ✔
======================== ====== ======== ==========

1130
* **server-id** is the identifier of the virtual server.
1131 1132 1133

|
==============  ========================= ======== ==========
1134
Request Header  Value                     Cyclades OS/Compute
1135 1136 1137 1138
==============  ========================= ======== ==========
X-Auth-Token    User authentication token required required
==============  ========================= ======== ==========

1139
.. rubric:: Response
1140 1141 1142 1143 1144 1145 1146 1147 1148

=========================== =====================
Return Code                 Description
=========================== =====================
204 (OK)                    Request succeeded
400 (Bad Request)           Malformed server id or machine already deleted
401 (Unauthorized)          Missing or expired user token
404 (Not Found)             Server not found
409 (Build In Progress)     Server is not ready yet
1149
500 (Internal Server Error) The request cannot be completed because of an
Stavros Sachtouris's avatar
Stavros Sachtouris committed
1150
\                           internal error
1151
503 (Service Unavailable)   Action not supported or service currently
Stavros Sachtouris's avatar
Stavros Sachtouris committed
1152
\                           unavailable
1153 1154
=========================== =====================

1155 1156
List Server Connections
-----------------------
1157

1158 1159
List a server's network connections. In Cyclades, connections are ports between
a network and the server.
1160 1161

.. rubric:: Request
1162 1163

============================ ====== ======== ==========
1164
URI                          Method Cyclades OS/Compute
1165 1166 1167 1168 1169 1170
============================ ====== ======== ==========
``/servers/<server id>/ips`` GET    ✔        ✔
============================ ====== ======== ==========

|
==============  ========================= ======== ==========
1171
Request Header  Value                     Cyclades OS/Compute