Files
melanie witt e1db68f194 Fix api-ref request samples containing curl commands instead of JSON
Several API sample files under doc/api_samples/ contained literal curl
commands instead of JSON request bodies, despite having .json file
extensions. This caused the api-ref documentation to render curl
command syntax with incorrect syntax highlighting (JavaScript or
default) instead of showing the actual JSON request payload.

Additionally, the attributes-post-curl.json file had a syntax error
with a missing closing brace in the embedded JSON.

Replace the curl command files with proper JSON request body files,
rename them from *-curl.json to *-req.json to match the existing
*-resp.json naming convention, and update the api-ref .inc files
to use consistent headings ("Example request:" instead of "Example
post curl") and add :language: javascript where it was missing.

Closes-Bug: #2158147

Assisted-by: Claude claude-opus-4-6 claude-code-2.1.190
Change-Id: I3b118051cb165c01ebefe8b8cecb9be9fc694827
Signed-off-by: melanie witt <melwittt@gmail.com>
2026-06-24 12:48:46 -07:00

119 lines
3.7 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
.. -*- rst -*-
.. needs:body_verification
Accelerator Requests
++++++++++++++++++++
Lists, creates, shows details for, updates and deletes accelerator requests.
An accelerator request (ARQ) represents a request for a single accelerator
to be assigned to an instance. ARQs are created in accordance with the
resource_groups defined in a `device_profile
<http://specs.openstack.org/openstack/cyborg-specs/specs/train/implemented/device-profiles.html>`_
by the operator. The accelerator request in the user request may have N
request groups, each asking for M accelerators; then N * M ARQs will be
created for that accelerator request.
List Accelerator Requests
-------------------------
.. rest_method:: GET /v2/accelerator_requests
Lists host_name, device_rp_uuid, instance_uuid and device_profile_group_id
for all accelerator_requests.
**Example response: list all accelerator requests**
.. literalinclude:: ../../doc/api_samples/accelerator_requests/accelerator_requests-list-resp.json
:language: javascript
Get One Accelerator Request
---------------------------
.. rest_method:: GET /v2/accelerator_requests/{accelerator_request_uuid}
Gets host_name, devices_RP_UUID, instance UUID and device_profile_group_ID
for one accelerator request with the specified UUID.
Request
=======
.. rest_parameters:: parameters.yaml
- accelerator_request_uuid: accelerator_request_uuid
**Example response: get details of a specific accelerator request**
.. literalinclude:: ../../doc/api_samples/accelerator_requests/accelerator_requests-getone-resp.json
Create Accelerator Requests
---------------------------
.. rest_method:: POST /v2/accelerator_requests
Creates an accelerator request. The payload should have the following field:
Request
=======
.. rest_parameters:: parameters.yaml
- device_profile_name: device_profile_name
**Example request: create an accelerator request**
.. literalinclude:: ../../doc/api_samples/accelerator_requests/accelerator_requests-post-req.json
:language: javascript
**Example response: create an accelerator request**
.. literalinclude:: ../../doc/api_samples/accelerator_requests/accelerator_requests-create-resp.json
Update Accelerator Requests
---------------------------
The Nova compute manager calls the Cyborg API PATCH /v2/accelerator_requests
to bind and unbind the ARQ with the host name, devices RP UUID and instance UUID. This
is an asynchronous call which prepares or reconfigures the device in the
background.
.. rest_method:: PATCH /v2/accelerator_requests/{accelerator_request_uuid}
Updates:an accelerator request. The payload should have these fields:
Request
=======
.. rest_parameters:: parameters.yaml
- accelerator_request_uuid: accelerator_request_uuid
- hostname: hostname_bind_unbind_req
- device_rp_uuid: device_rp_uuid_bind_unbind_req
- instance_uuid: instance_uuid_bind_unbind_req
- instance_project_id: instance_project_id_bind_unbind_req
**Example request: update an accelerator request**
.. literalinclude:: ../../doc/api_samples/accelerator_requests/accelerator_requests-patch-req.json
:language: javascript
**Example response: update an accelerator request**
.. literalinclude:: ../../doc/api_samples/accelerator_requests/accelerator_requests-after-update-resp.json
Delete Accelerator Requests by ARQ uuid
---------------------------------------
.. rest_method:: DELETE /v2/accelerator_requests?arqs={accelerator_request_uuid}
Delete Accelerator Requests by instance uuid
--------------------------------------------
.. rest_method:: DELETE /v2/accelerator_requests?instance={instance_uuid}
Delete an accelerator request. No query parameters required.
Response
========
Normal response codes: 204
There is no body content for the response of a successful DELETE query