cinder/api-ref/source/v3/hosts.inc
Sean McGinnis 86a96625d7 api-ref: Clarify os-host GET behavior
Getting all hosts returns every Cinder service host, regardless
of which service is running on the host. But getting a specific
host will fail if you try it for a host not running cinder-volume.

This looks to be the behavior from the beginning, but there was
nothing denoting this, causing errors and confusion for code that
thought it could get a host from the list, then get detailed info
about that host. The details return volume and snapshot counts,
so it really only makes sense for cinder-volume, so the code ends
up returning a 404 for anything else.

This API design seems a little disjointed, but since this is how
it appears to have always been, just make sure the api docs have
the right details for potential API consumers to know what to
expect.

Change-Id: If53279cfcbbde1297bb2e55e17d17b473e7d0d6e
Closes-bug: #1691144
2017-08-31 20:56:46 -05:00

86 lines
1.8 KiB
ReStructuredText

.. -*- rst -*-
Hosts extension (os-hosts)
====================================
Administrators only, depending on policy settings.
Lists, shows hosts.
List all hosts for a project
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. rest_method:: GET /v3/{admin_project_id}/os-hosts
Lists all hosts summary info that is not disabled.
Normal response codes: 200
Error response codes:
Request
-------
.. rest_parameters:: parameters.yaml
- admin_project_id: admin_project_id
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- service-status: service_status
- service: host_service
- zone: availability_zone_3
- service-state: service_state
- host_name: hostname
- last-update: updated_at
Response Example
----------------
.. literalinclude:: ./samples/hosts-list-response.json
:language: javascript
Show Host Details for a project
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. rest_method:: GET /v3/{admin_project_id}/os-hosts/{host_name}
Shows volume and snapshot details for a cinder-volume host.
*Note:* This API is meant specifically for cinder-volume hosts only.
It is not valid against other Cinder service hosts or hosts where the
cinder-volume service has been disabled.
Normal response codes: 200
Error response codes: unauthorized(401), forbidden(403), itemNotFound(404)
Request
-------
.. rest_parameters:: parameters.yaml
- admin_project_id: admin_project_id
- host_name: hostname
Response
--------
.. rest_parameters:: parameters.yaml
- volume_count: total_count
- total_volume_gb: totalGigabytesUsed
- total_snapshot_gb: totalSnapshotsUsed
- project: admin_project_id
- host: host
- snapshot_count: totalSnapshotsUsed
**Example Show Host Details**
.. literalinclude:: ./samples/hosts-get-response.json
:language: javascript