Blazar REST API v2

1 General API information

This section contains base information about the Blazar REST API design, including operations with different Blazar resource types and examples of possible requests and responses. Blazar supports JSON data serialization format, which means that requests with non empty body have to contain “application/json” Content-Type header or it should be added ”.json” extension to the resource name in the request.

This should look like the following:

GET /v2/leases.json

or

GET /v2/leases
Accept: application/json

2 Leases

Description

Lease is the main abstraction for the user in the Blazar case. Lease means some kind of contract where start time, end time and resources to be reserved are mentioned.

GET /v2/leases

Returns all leases.

Return type:list(Lease)
GET /v2/leases/(id)

Returns the lease having this specific uuid

Parameters:
  • id (uuid) – ID of lease
Return type:

Lease

POST /v2/leases

Creates a new lease.

Parameters:
  • lease – a lease within the request body.
Return type:

Lease

PUT /v2/leases

Update an existing lease.

Parameters:
  • id (uuid) – UUID of a lease.
  • lease – a subset of a Lease containing values to update.
Return type:

Lease

DELETE /v2/leases

Delete an existing lease.

Parameters:
  • id (uuid) – UUID of a lease.
type Lease

Data samples:

Json
{
    "action": "START",
    "before_end_notification": "2014-02-01 10:37",
    "end_date": "2014-02-01 13:37",
    "events": [],
    "id": "2bb8720a-0873-4d97-babf-0d906851a1eb",
    "name": "lease_test",
    "project_id": "bd9431c18d694ad3803a8d4a6b89fd36",
    "reservations": [
        {
            "resource_id": "1234",
            "resource_type": "virtual:instance"
        }
    ],
    "start_date": "2014-01-01 01:23",
    "status": "COMPLETE",
    "status_reason": "Lease currently running",
    "trust_id": "35b17138b3644e6aa1318f3099c5be68",
    "user_id": "efd8780712d24b389c705f5c2ac427ff"
}
XML
<value>
  <id>2bb8720a-0873-4d97-babf-0d906851a1eb</id>
  <name>lease_test</name>
  <start_date>2014-01-01 01:23</start_date>
  <end_date>2014-02-01 13:37</end_date>
  <user_id>efd8780712d24b389c705f5c2ac427ff</user_id>
  <project_id>bd9431c18d694ad3803a8d4a6b89fd36</project_id>
  <trust_id>35b17138b3644e6aa1318f3099c5be68</trust_id>
  <reservations>
    <item>
      <item>
        <key>resource_type</key>
        <value>virtual:instance</value>
      </item>
      <item>
        <key>resource_id</key>
        <value>1234</value>
      </item>
    </item>
  </reservations>
  <events />
  <before_end_notification>2014-02-01 10:37</before_end_notification>
  <action>START</action>
  <status>COMPLETE</status>
  <status_reason>Lease currently running</status_reason>
</value>
action
Type:unicode

The current action running

before_end_notification
Type:datetime

Datetime when notifications will be sent before lease ending

end_date
Type:datetime

Datetime when the lease should end

events
Type:list(dict(unicode: unicode))

The list of events attached to the lease

id
Type:uuid

The UUID of the lease

name
Type:unicode

The name of the lease

project_id
Type:uuid

The ID of the project or tenant the lease belongs to

reservations
Type:list(dict(unicode: unicode))

The list of reservations belonging to the lease

start_date
Type:datetime

Datetime when the lease should start

status
Type:unicode

The status of the action running

status_reason
Type:unicode

A brief description of the status, if any

trust_id
Type:uuid

The ID of the trust created for delegating the rights of the user

user_id
Type:uuid

The ID of the user who creates the lease

3 Hosts

Description

Host is the abstraction for a computehost in the Blazar case. Host means a specific type of resource to be allocated.

GET /v2/os-hosts

Returns all hosts.

Return type:list(Host)
GET /v2/os-hosts/(id)

Returns the host having this specific uuid

Parameters:
  • id (integer) – ID of host
Return type:

Host

POST /v2/os-hosts

Creates a new host.

Parameters:
  • host – a host within the request body.
Return type:

Host

PUT /v2/os-hosts

Update an existing host.

Parameters:
  • id (integer) – ID of a host.
  • host (Host) – a subset of a Host containing values to update.
Return type:

Host

DELETE /v2/os-hosts

Delete an existing host.

Parameters:
  • id (unicode) – UUID of a host.
type Host

Data samples:

Json
{
    "cpu_info": "{\"vendor\": \"Intel\", \"model\": \"qemu32\", \"arch\": \"x86_64\", \"features\": [], \"topology\": {\"cores\": 1}}",
    "extra_capas": {
        "fruits": "bananas",
        "vgpus": 2
    },
    "hypervisor_hostname": "host01",
    "hypervisor_type": "QEMU",
    "hypervisor_version": 1000000,
    "id": "1",
    "local_gb": 50,
    "memory_mb": 8192,
    "vcpus": 1
}
XML
<value>
  <id>1</id>
  <hypervisor_hostname>host01</hypervisor_hostname>
  <hypervisor_type>QEMU</hypervisor_type>
  <vcpus>1</vcpus>
  <hypervisor_version>1000000</hypervisor_version>
  <memory_mb>8192</memory_mb>
  <local_gb>50</local_gb>
  <cpu_info>{"vendor": "Intel", "model": "qemu32", "arch": "x86_64", "features": [], "topology": {"cores": 1}}</cpu_info>
  <extra_capas>
    <item>
      <key>vgpus</key>
      <value>2</value>
    </item>
    <item>
      <key>fruits</key>
      <value>bananas</value>
    </item>
  </extra_capas>
</value>
cpu_info
Type:cpuinfo

The CPU info JSON data given by the hypervisor

extra_capas
Type:dict(unicode: textorinteger)

Extra capabilities for the host

hypervisor_hostname
Type:unicode

The hostname of the host

hypervisor_type
Type:unicode

The type of the hypervisor

hypervisor_version
Type:integer

The version of the hypervisor

id
Type:integer

The ID of the host

local_gb
Type:integer

The disk size (in Gb) of the host

memory_mb
Type:integer

The memory size (in Mb) of the host

trust_id
Type:uuid

The ID of the trust created for delegating the rights of the user

vcpus
Type:integer

The number of VCPUs of the host