OpenNebula OCCI API Specification
The OpenNebula OCCI API is a RESTful service to create, control and monitor cloud resources based on the latest draft of the OGF OCCI API specification. There are two types of resources that resemble the basic entities managed by the OpenNebula system, namely:
A COMPUTE
entry resource can be linked to one or more DISK
or NETWORK
resources.
The methods associated with each resource type are as follows:
This section describes the XML format used to represent COMPUTE
, NETWORK
and DISK
resources; as well as the collection of them (Pool Resources, PRs).
The root element required for all the PRs is named after the pool name, eg. COMPUTES
, NETWORKS
or STORAGE
(note that XML tags are upper case). No attributes can be defined for the root element.
Each one of ERs in the pool are described by an element (e.g. COMPUTE
, NETWORK
or DISK
) with one attribute:
href
, a URI for the ER Example:
<COMPUTES> <COMPUTE href="http://www.opennebula.org/compute/234"> <COMPUTE href="http://www.opennebula.org/compute/432"> <COMPUTE href="http://www.opennebula.org/compute/123"> </COMPUTES>
The NETWORK
element defines a virtual network that interconnects those COMPUTES
with a network interface card attached to that network. The traffic of each network is isolated from any other network, so it constitutes a broadcasting domain.
The following elements can be defined for a NETWORK
:
ID
, the uuid of the networkNAME,
describing the networkADDRESS
, of the network SIZE
, of the network, defaults to CExample:
<NETWORK> <ID>123</ID> <NAME>BlueNetwork</NAME> <ADDRESS>192.168.0.1</ADDRESS> <SIZE>C</SIZE> </NETWORK>
The DISK
element defines a virtual disk that supports a VM block device. The following elements can be defined:
ID
, the uuid of the imageNAME
, describing the imageSIZE
, of the image in MBsURL
, pointer to the original imageExample:
<DISK> <ID>123</ID> <NAME>Ubuntu 9.04 LAMP</NAME> <SIZE>2048</SIZE> <URL>file:///images/ubuntu/jaunty.img</URL> </DISK>
The COMPUTE
element defines a virtual machine by specifying its basic configuration attributes such as NIC
or DISK
. The following elements can be defined:
ID
, the uuid of the virtual machine.NAME
, describing the virtual machine.TYPE
, a COMPUTE type specifies a CPU and memory capacity, valid types are small, medium and large. STATE
, the state of the COMPUTE. This can be changed toDISKS
, the block devices attached to the virtual machine. The following devices can be specified:DISK
, a block device supported by a previously registered image. The id attribute specifies the image, dev the device to attach the image to.SWAP
, a swap device attached to the specified device (dev) with the given size (in MBs).FS
, a plain filesystem attached to the specified device (dev) with the given size (in MBs) and format (ext3 and ext2).NICS
, the network interfaces, defined with a list of NIC elements. Each NIC can have the following attributes:Example:
<COMPUTE> <ID>123AF</ID> <NAME>Web Server</NAME> <INSTANCE_TYPE>small</INSTANCE_TYPE> <STATE>running</STATE> <DISKS> <DISK image="234" dev="sda1"/> <SWAP size="1024" dev="sda2"/> <FS size="1024" format="ext3" dev="sda3"/> </DISKS> <NETWORK> <NIC network="4567f" ip="19.12.1.1"/> <NIC network="0"/> </NETWORK> </COMPUTE>
User authentication will be HTTP Basic access authentication to comply with REST philosophy. Authorization will be handled by OpenNebula's user management module, that currently works as:
The following headers are compulsory:
Uploading images needs HTTP multi part support, and also the following header
The OpenNebula Cloud API uses the following subset of HTTP Status codes:
The methods specified below are described without taking into account 4xx (can be inferred from authorization information in section above) and 5xx errors (which are method independent). HTTP verbs not defined for a particular entity will return a 501 Not Implemented.
All the above resources share the same HTTP verb semantics:
Method | Meaning / Entity Body | Response |
---|---|---|
GET | Request for the contents of the pool | 200 OK: An XML representation of the pool in the http body |
POST | Request for the creation of an ER. An XML representation of a VM without the ID element should be passed in the http body | 201 Created: An XML representation of a ER of type COMPUTE with the ID |
Method | Meaning / Entity Body | Response |
---|---|---|
GET | Request the representation of the network resource identified by <net_id> | 200 OK : An XML representation of the network in the http body |
DELETE | Deletes the Network resource identified by <net-id> | 200 OK: The Network has been successfully deleted |
Method | Meaning / Entity Body | Response |
---|---|---|
GET | Request the representation of the image resource identified by <storage_id> | 200 OK : An XML representation of the image in the http body |
DELETE | Deletes the Image resource identified by <storage_id> | 200 OK : The image has been successfully deleted |
Method | Meaning / Entity Body | Response |
---|---|---|
GET | Request the representation of the Compute resource identified by <compute_id> | 200 OK : An XML representation of the Compute in the http body |
PUT | Update request for a Compute identified by <compute_id> | 202 Accepted : The update request is being process, polling required to confirm update |
DELETE | Deletes the Compute resource identified by <compute_id> | 200 OK : The Compute has been successfully deleted |
It is recommended that the server-client communication is performed over HTTPS to avoid sending user authentication information in plain text.
HTTP protocol does not provide means for notification, so this API relies on asynchronous polling to find whether a VM update is successful or not.