Add hosts operations to the API reference

Change-Id: Ied65258a8db6c5c2109a288ede647b25138cc9bc
Partial-Bug: #1721489
Partial-Bug: #1703268
This commit is contained in:
Hiroaki Kobayashi 2017-12-26 14:29:43 +09:00
parent 0fe88e62ae
commit e7c93fb5e7
8 changed files with 476 additions and 1 deletions

View File

@ -4,4 +4,247 @@
Hosts
=====
TBD
List Hosts
==========
.. rest_method:: GET v1/os_hosts
List hosts.
**Response codes**
Normal response code: 200
Error response codes: Bad Request(400), Unauthorized(401), Forbidden(403),
Internal Server Error(500)
Request
-------
No body content, path, nor query option.
Response
--------
.. rest_parameters:: parameters.yaml
- hosts: hosts
- id: host_id
- hypervisor_hostname: host_hypervisor_hostname
- hypervisor_type: host_hypervisor_type
- hypervisor_version: host_hypervisor_version
- vcpus: host_vcpus
- cpu_info: host_cpu_info
- memory_mb: host_memory_mb
- local_gb: host_local_gb
- service_name: host_service_name
- reservable: host_reservable
- status: host_status
- trust_id: host_trust_id
- created_at: created_at
- updated_at: updated_at
- extra_capability: host_extra_capability
**Example of List Hosts Response**
.. literalinclude:: ../../../doc/api_samples/hosts/host-list-resp.json
:language: javascript
Create Host
===========
.. rest_method:: POST v1/os_hosts
Create a host.
**Response codes**
Normal response code: 200
Error response codes: Bad Request(400), Unauthorized(401), Forbidden(403),
Conflict(409), Internal Server Error(500)
Request
-------
.. rest_parameters:: parameters.yaml
- name: host_name
- extra_capability: host_extra_capability
**Example of Create Host Request**
.. literalinclude:: ../../../doc/api_samples/hosts/host-create-req.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- host: host
- id: host_id
- hypervisor_hostname: host_hypervisor_hostname
- hypervisor_type: host_hypervisor_type
- hypervisor_version: host_hypervisor_version
- vcpus: host_vcpus
- cpu_info: host_cpu_info
- memory_mb: host_memory_mb
- local_gb: host_local_gb
- service_name: host_service_name
- reservable: host_reservable
- status: host_status
- trust_id: host_trust_id
- created_at: created_at
- updated_at: updated_at
- extra_capability: host_extra_capability
**Example of Create Host Response**
.. literalinclude:: ../../../doc/api_samples/hosts/host-create-resp.json
:language: javascript
Show Host Details
=================
.. rest_method:: GET v1/os_hosts/{host_id}
Show details of a host.
**Preconditions**
The host must exist.
**Response codes**
Normal response code: 200
Error response codes: Bad Request(400), Unauthorized(401), Forbidden(403),
Not Found(404), Internal Server Error(500)
Request
-------
.. rest_parameters:: parameters.yaml
- host_id: host_id_path
Response
--------
.. rest_parameters:: parameters.yaml
- host: host
- id: host_id
- hypervisor_hostname: host_hypervisor_hostname
- hypervisor_type: host_hypervisor_type
- hypervisor_version: host_hypervisor_version
- vcpus: host_vcpus
- cpu_info: host_cpu_info
- memory_mb: host_memory_mb
- local_gb: host_local_gb
- service_name: host_service_name
- reservable: host_reservable
- status: host_status
- trust_id: host_trust_id
- created_at: created_at
- updated_at: updated_at
- extra_capability: host_extra_capability
**Example of Show Host Details Response**
.. literalinclude:: ../../../doc/api_samples/hosts/host-details-resp.json
:language: javascript
Update Host
===========
.. rest_method:: PUT v1/os_hosts/{host_id}
Update a host.
**Preconditions**
The host must exist.
**Response codes**
Normal response code: 200
Error response codes: Bad Request(400), Unauthorized(401), Forbidden(403),
Not Found(404), Conflict(409), Internal Server Error(500)
Request
-------
.. rest_parameters:: parameters.yaml
- host_id: host_id_path
- extra_capability: host_extra_capability
**Example of Update Host Request**
.. literalinclude:: ../../../doc/api_samples/hosts/host-update-req.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- host: host
- id: host_id
- hypervisor_hostname: host_hypervisor_hostname
- hypervisor_type: host_hypervisor_type
- hypervisor_version: host_hypervisor_version
- vcpus: host_vcpus
- cpu_info: host_cpu_info
- memory_mb: host_memory_mb
- local_gb: host_local_gb
- service_name: host_service_name
- reservable: host_reservable
- status: host_status
- trust_id: host_trust_id
- created_at: created_at
- updated_at: updated_at
- extra_capability: host_extra_capability
**Example of Host Update Response**
.. literalinclude:: ../../../doc/api_samples/hosts/host-update-resp.json
:language: javascript
Delete Host
===========
.. rest_method:: DELETE v1/os_hosts/{host_id}
Delete a host.
**Preconditions**
The host must exist.
**Response codes**
Normal response code: 200
Error response codes: Bad Request(400), Unauthorized(401), Forbidden(403),
Not Found(404), Conflict(409), Internal Server Error(500)
Request
-------
.. rest_parameters:: parameters.yaml
- host_id: host_id_path
Response
--------
No body content is returned on a successful DELETE.

View File

@ -1,4 +1,10 @@
# variables in path
host_id_path:
description: |
The ID of the host.
in: path
required: true
type: string
lease_id_path:
description: |
The UUID of the lease.
@ -61,6 +67,107 @@ events_optional:
in: body
required: false
type: array
host:
description: |
A ``host`` object.
in: body
required: true
type: object
host_cpu_info:
description: |
Information of the CPU of the host.
in: body
required: true
type: string
host_extra_capability:
description: |
The extra capability of the host.
.. note:: Any key-value pair can be stored as one of extra capabilities of
the host.
in: body
required: false
type: any
host_hypervisor_hostname:
description: |
The hypervisor name of the host.
in: body
required: true
type: string
host_hypervisor_type:
description: |
The hypervisor type the host.
in: body
required: true
type: string
host_hypervisor_version:
description: |
The hypervisor version of the host.
in: body
required: true
type: integer
host_id:
description: |
The ID of the host.
in: body
required: true
type: string
host_local_gb:
description: |
Gigabytes of the disk of the host.
in: body
required: true
type: integer
host_memory_mb:
description: |
Megabytes of the memory of the host.
in: body
required: true
type: integer
host_name:
description: |
The name of the host.
in: body
required: true
type: string
host_reservable:
description: |
The flag which represents whether the host is reservable or not.
in: body
required: true
type: boolean
host_service_name:
description: |
The compute service name of the host.
in: body
required: true
type: string
host_status:
description: |
The status of the host.
.. note:: This is null currently.
in: body
required: true
type: string
host_trust_id:
description: |
The UUID of the trust of the host operator.
in: body
required: true
type: string
host_vcpus:
description: |
The number of the VCPUs of the host.
in: body
required: true
type: integer
hosts:
description: |
A list of ``host`` objects.
in: body
required: true
type: array
lease:
description: |
A ``lease`` object.

View File

@ -0,0 +1,4 @@
{
"name": "compute-1",
"extra_capability_sample": "foo"
}

View File

@ -0,0 +1,29 @@
{
"host": {
"id": "1",
"hypervisor_hostname": "compute-1",
"hypervisor_type": "QEMU",
"hypervisor_version": 2010001,
"vcpus": 4,
"cpu_info": "{'arch': 'x86_64', 'model': 'cpu64-rhel6',
'vendor': 'Intel', 'features': [
'pge', 'clflush', 'sep', 'syscall', 'msr',
'vmx', 'cmov', 'nx', 'pat', 'lm', 'tsc',
'fpu', 'fxsr', 'pae', 'mmx', 'cx8', 'mce',
'de', 'mca', 'pse', 'pni', 'apic', 'sse',
'lahf_lm', 'sse2', 'hypervisor', 'cx16',
'pse36', 'mttr', 'x2apic'],
'topology': {
'cores': 1, 'cells': 1, 'threads': 1, 'sockets': 4
}}",
"memory_mb": 8192,
"local_gb": 100,
"service_name": "compute-1",
"reservable": true,
"status": null,
"trust_id": "5f67f11215cf4c52906453a181bfcfea",
"created_at": "2017-12-27 10:00:00",
"updated_at": null,
"extra_capability_sample": "foo"
}
}

View File

@ -0,0 +1,29 @@
{
"host": {
"id": "1",
"hypervisor_hostname": "compute-1",
"hypervisor_type": "QEMU",
"hypervisor_version": 2010001,
"vcpus": 4,
"cpu_info": "{'arch': 'x86_64', 'model': 'cpu64-rhel6',
'vendor': 'Intel', 'features': [
'pge', 'clflush', 'sep', 'syscall', 'msr',
'vmx', 'cmov', 'nx', 'pat', 'lm', 'tsc',
'fpu', 'fxsr', 'pae', 'mmx', 'cx8', 'mce',
'de', 'mca', 'pse', 'pni', 'apic', 'sse',
'lahf_lm', 'sse2', 'hypervisor', 'cx16',
'pse36', 'mttr', 'x2apic'],
'topology': {
'cores': 1, 'cells': 1, 'threads': 1, 'sockets': 4
}}",
"memory_mb": 8192,
"local_gb": 100,
"service_name": "compute-1",
"reservable": true,
"status": null,
"trust_id": "5f67f11215cf4c52906453a181bfcfea",
"created_at": "2017-12-27 10:00:00",
"updated_at": null,
"extra_capability_sample": "foo"
}
}

View File

@ -0,0 +1,31 @@
{
"hosts": [
{
"id": "1",
"hypervisor_hostname": "compute-1",
"hypervisor_type": "QEMU",
"hypervisor_version": 2010001,
"vcpus": 4,
"cpu_info": "{'arch': 'x86_64', 'model': 'cpu64-rhel6',
'vendor': 'Intel', 'features': [
'pge', 'clflush', 'sep', 'syscall', 'msr',
'vmx', 'cmov', 'nx', 'pat', 'lm', 'tsc',
'fpu', 'fxsr', 'pae', 'mmx', 'cx8', 'mce',
'de', 'mca', 'pse', 'pni', 'apic', 'sse',
'lahf_lm', 'sse2', 'hypervisor', 'cx16',
'pse36', 'mttr', 'x2apic'],
'topology': {
'cores': 1, 'cells': 1, 'threads': 1, 'sockets': 4
}}",
"memory_mb": 8192,
"local_gb": 100,
"service_name": "compute-1",
"reservable": true,
"status": null,
"trust_id": "5f67f11215cf4c52906453a181bfcfea",
"created_at": "2017-12-27 10:00:00",
"updated_at": null,
"extra_capability_sample": "foo"
}
]
}

View File

@ -0,0 +1,3 @@
{
"extra_capability_sample": "bar"
}

View File

@ -0,0 +1,29 @@
{
"host": {
"id": "1",
"hypervisor_hostname": "compute-1",
"hypervisor_type": "QEMU",
"hypervisor_version": 2010001,
"vcpus": 4,
"cpu_info": "{'arch': 'x86_64', 'model': 'cpu64-rhel6',
'vendor': 'Intel', 'features': [
'pge', 'clflush', 'sep', 'syscall', 'msr',
'vmx', 'cmov', 'nx', 'pat', 'lm', 'tsc',
'fpu', 'fxsr', 'pae', 'mmx', 'cx8', 'mce',
'de', 'mca', 'pse', 'pni', 'apic', 'sse',
'lahf_lm', 'sse2', 'hypervisor', 'cx16',
'pse36', 'mttr', 'x2apic'],
'topology': {
'cores': 1, 'cells': 1, 'threads': 1, 'sockets': 4
}}",
"memory_mb": 8192,
"local_gb": 100,
"service_name": "compute-1",
"reservable": true,
"status": null,
"trust_id": "5f67f11215cf4c52906453a181bfcfea",
"created_at": "2017-12-27 10:00:00",
"updated_at": null,
"extra_capability_sample": "bar"
}
}