This change introduces new return code (201 instead of 200) for POST /v1/rules endpoint on success rule creation. API less 1.6 continues returning 200. Default API version was changed from minimum to maximum which Inspector can support. Change-Id: I911c7c241d16b9948ee4b6db92b127c7f8f374ae
9.6 KiB
HTTP API
By default ironic-inspector listens on
0.0.0.0:5050, port can be changed in configuration.
Protocol is JSON over HTTP.
Start Introspection
POST /v1/introspection/<Node ID> initiate hardware
introspection for node <Node ID>. All power
management configuration for this node needs to be done prior to calling
the endpoint (except when setting-ipmi-creds).
Requires X-Auth-Token header with Keystone token for authentication.
Optional parameters:
new_ipmi_passwordif set, ironic-inspector will try to set IPMI password on the machine to this value. Power credentials validation will be skipped and manual power on will be required. Seesetting-ipmi-credsfor details.new_ipmi_usernameprovides new IPMI user name in addition to password set bynew_ipmi_password. Defaults to currentipmi_usernamein nodedriver_infofield.
Response:
- 202 - accepted introspection request
- 400 - bad request
- 401, 403 - missing or invalid authentication
- 404 - node cannot be found
Get Introspection Status
GET /v1/introspection/<Node ID> get hardware
introspection status.
Requires X-Auth-Token header with Keystone token for authentication.
Response:
- 200 - OK
- 400 - bad request
- 401, 403 - missing or invalid authentication
- 404 - node cannot be found
Response body: JSON dictionary with keys:
finished(boolean) whether introspection is finished (trueon introspection completion or if it ends because of an error)errorerror string ornull;Canceled by operatorin case introspection was aborted
Abort Running Introspection
POST /v1/introspection/<Node ID>/abort abort
running introspection.
Requires X-Auth-Token header with Keystone token for authentication.
Response:
- 202 - accepted
- 400 - bad request
- 401, 403 - missing or invalid authentication
- 404 - node cannot be found
- 409 - inspector has locked this node for processing
Get Introspection Data
GET /v1/introspection/<Node ID>/data get stored
data from successful introspection.
Requires X-Auth-Token header with Keystone token for authentication.
Response:
- 200 - OK
- 400 - bad request
- 401, 403 - missing or invalid authentication
- 404 - data cannot be found or data storage not configured
Response body: JSON dictionary with introspection data
Note
We do not provide any backward compatibility guarantees regarding the format and contents of the stored data. Notably, it depends on the ramdisk used and plugins enabled both in the ramdisk and in inspector itself.
Reapply introspection on stored data
POST /v1/introspection/<Node ID>/data/unprocessed
to trigger introspection on stored unprocessed data. No data is allowed
to be sent along with the request.
Requires X-Auth-Token header with Keystone token for authentication. Requires enabling Swift store in processing section of the configuration file.
Response:
- 202 - accepted
- 400 - bad request or store not configured
- 401, 403 - missing or invalid authentication
- 404 - node not found for Node ID
- 409 - inspector locked node for processing
Introspection Rules
See rules for
details.
All these API endpoints require X-Auth-Token header with Keystone token for authentication.
POST /v1/rulescreate a new introspection rule.Request body: JSON dictionary with keys:
conditionsrule conditions, seerulesactionsrule actions, seerulesdescription(optional) human-readable descriptionuuid(optional) rule UUID, autogenerated if missing
Response
- 200 - OK for API version < 1.6
- 201 - OK for API version 1.6 and higher
- 400 - bad request
Response body: JSON dictionary with introspection rule representation (the same as above with UUID filled in).
GET /v1/ruleslist all introspection rules.Response
- 200 - OK
Response body: JSON dictionary with key
rules- list of short rule representations. Short rule representation is a JSON dictionary with keys:uuidrule UUIDdescriptionhuman-readable descriptionlinkslist of HTTP links, use one withrel=selfto get the full rule details
DELETE /v1/rulesdelete all introspection rules.Response
- 204 - OK
GET /v1/rules/<UUID>get one introspection rule by its<UUID>.Response
- 200 - OK
- 404 - not found
Response body: JSON dictionary with introspection rule representation (see
POST /v1/rulesabove).DELETE /v1/rules/<UUID>delete one introspection rule by its<UUID>.Response
- 204 - OK
- 404 - not found
Ramdisk Callback
POST /v1/continue internal endpoint for the ramdisk to
post back discovered data. Should not be used for anything other than
implementing the ramdisk. Request body: JSON dictionary with at least
these keys:
inventoryfull hardware inventory from the ironic-python-agent with at least the following keys:memorymemory information containing at least keyphysical_mb-physical memory size as reported by dmidecode,cpuCPU infromation containing at least keyscount(CPU count) andarchitecture(CPU architecture, e.g.x86_64),bmc_addressIP address of the node's BMC,interfaceslist of dictionaries with the following keys:nameinterface name,ipv4_addressIPv4 address of the interface,mac_addressMAC (physical) address of the interface.
root_diskdefault deployment root disk as calculated by the ironic-python-agent algorithm.boot_interfaceMAC address of the NIC that the machine PXE booted from either in standard format11:22:33:44:55:66or in PXELinuxBOOTIFformat01-11-22-33-44-55-66. Strictly speaking, this key is optional, but some features will now work as expected, if it is not provided.
Optionally the following keys might be provided:
errorerror happened during ramdisk run, interpreted byramdisk_errorplugin.logsbase64-encoded logs from the ramdisk.
Note
This list highly depends on enabled plugins, provided above are
expected keys for the default set of plugins. See plugins for details.
Note
This endpoint is not expected to be versioned, though versioning will work on it.
Response:
- 200 - OK
- 400 - bad request
- 403 - node is not on introspection
- 404 - node cannot be found or multiple nodes found
Response body: JSON dictionary. If setting-ipmi-creds is requested, body will contain the
following keys:
ipmi_setup_credentialsbooleanTrueipmi_usernamenew IPMI user nameipmi_passwordnew IPMI password
Error Response
If an error happens during request processing, Ironic Inspector returns a response with an appropriate HTTP code set, e.g. 400 for bad request or 404 when something was not found (usually node in cache or node in ironic). The following JSON body is returned:
{
"error": {
"message": "Full error message"
}
}
This body may be extended in the future to include details that are more error specific.
API Versioning
The API supports optional API versioning. You can query for minimum and maximum API version supported by the server. You can also declare required API version in your requests, so that the server rejects request of unsupported version.
Note
Versioning was introduced in Ironic Inspector 2.1.0.
All versions must be supplied as string in form of X.Y,
where X is a major version and is always 1 for
now, Y is a minor version.
If
X-OpenStack-Ironic-Inspector-API-Versionheader is sent with request, the server will check if it supports this version. HTTP error 406 will be returned for unsupported API version.All HTTP responses contain
X-OpenStack-Ironic-Inspector-API-Minimum-VersionandX-OpenStack-Ironic-Inspector-API-Maximum-Versionheaders with minimum and maximum API versions supported by the server.Note
Maximum is server API version used by default.
API Discovery
The API supports API discovery. You can query different parts of the API to discover what other endpoints are avaliable.
GET /List API VersionsResponse:
- 200 - OK
Response body: JSON dictionary containing a list of
versions, each version contains:statusEither CURRENT or SUPPORTEDidThe version identifierlinksA list of links to this version endpoint containing:hrefThe URLrelThe relationship between the version and the href
GET /v1List API v1 resourcesResponse:
- 200 - OK
Response body: JSON dictionary containing a list of
resources, each resource contains:nameThe name of this resourceslinksA list of link to this resource containing:hrefThe URLrelThe relationship between the resource and the href
Version History
- 1.0 version of API at the moment of introducing versioning.
- 1.1 adds endpoint to retrieve stored introspection data.
- 1.2 endpoints for manipulating introspection rules.
- 1.3 endpoint for canceling running introspection
- 1.4 endpoint for reapplying the introspection over stored data.
- 1.5 support for Ironic node names.
- 1.6 endpoint for rules creating returns 201 instead of 200 on success.