Blazar REST API v2 (deprecated)

NOTE: This version is deprecated. Please use the Blazar REST API v1.

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.

type Lease

Data samples:

Json
{
    "before_end_date": "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": "physical:host"
        }
    ],
    "start_date": "2014-01-01 01:23",
    "status": "ACTIVE",
    "trust_id": "35b17138b3644e6aa1318f3099c5be68",
    "user_id": "efd8780712d24b389c705f5c2ac427ff"
}
XML
b'<value>\n  <id>2bb8720a-0873-4d97-babf-0d906851a1eb</id>\n  <name>lease_test</name>\n  <start_date>2014-01-01 01:23</start_date>\n  <end_date>2014-02-01 13:37</end_date>\n  <user_id>efd8780712d24b389c705f5c2ac427ff</user_id>\n  <project_id>bd9431c18d694ad3803a8d4a6b89fd36</project_id>\n  <trust_id>35b17138b3644e6aa1318f3099c5be68</trust_id>\n  <reservations>\n    <item>\n      <item>\n        <key>resource_id</key>\n        <value>1234</value>\n      </item>\n      <item>\n        <key>resource_type</key>\n        <value>physical:host</value>\n      </item>\n    </item>\n  </reservations>\n  <events />\n  <before_end_date>2014-02-01 10:37</before_end_date>\n  <status>ACTIVE</status>\n</value>'
before_end_date
Type

datetime

Datetime when some actions will be taken before lease ending

end_date
Type

datetime

Datetime when the lease should end

events
Type

list(dict(str: str))

The list of events attached to the lease

id
Type

uuid

The UUID of the lease

name
Type

str

The name of the lease

project_id
Type

uuid

The ID of the project or tenant the lease belongs to

reservations
Type

list(dict(str: str))

The list of reservations belonging to the lease

start_date
Type

datetime

Datetime when the lease should start

status
Type

str

The status of the lease

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.

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
b'<value>\n  <id>1</id>\n  <hypervisor_hostname>host01</hypervisor_hostname>\n  <hypervisor_type>QEMU</hypervisor_type>\n  <vcpus>1</vcpus>\n  <hypervisor_version>1000000</hypervisor_version>\n  <memory_mb>8192</memory_mb>\n  <local_gb>50</local_gb>\n  <cpu_info>{"vendor": "Intel", "model": "qemu32", "arch": "x86_64", "features": [], "topology": {"cores": 1}}</cpu_info>\n  <extra_capas>\n    <item>\n      <key>vgpus</key>\n      <value>2</value>\n    </item>\n    <item>\n      <key>fruits</key>\n      <value>bananas</value>\n    </item>\n  </extra_capas>\n</value>'
cpu_info
Type

cpuinfo as JSON formated str

The CPU info JSON data given by the hypervisor

extra_capas
Type

dict(str: textorinteger)

Extra capabilities for the host

hypervisor_hostname
Type

str

The hostname of the host

hypervisor_type
Type

str

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