Add API versioning similar to what Ironic does

Registered by Dmitry Tantsur

Every request may have X-OpenStack-Ironic-Inspector-API-Version header with version in form of "X.Y". Error 406 will be returned, if unknown (or unsupported) version is supplied. Minimal known (1.0) version will be assumed, if header is missing.

In every response X-OpenStack-Ironic-Inspector-API-Minimum-Version and X-OpenStack-Ironic-Inspector-API-Maximum-Version will be returned, again in form of "X.Y". Minimum version should be "1.0" for now and foreseeable future.

Both client functions will accept "api_version" argument, either as 1 number (major version, use the default) or as a tuple (X,Y), or as a string "X.Y". Client will have DEFAULT_API_VERSION attribute set to (1,0).

No effort will be undertaken to prevent a user from NOT declaring a needed API version (as opposed to what Ironic and Nova are doing).

Server change:
* Return API versions in *every* response
* Check that provided API version is supported

Client change:
* Actually pass headers to the server
* Implement server_api_version() function which does GET /
* If api_version is provided, call server_api_version() to check it _before_ issuing any request (TODO: caching)

Reference:
* https://review.openstack.org/#/c/187112/ - API-WG spec API versioning
* https://review.openstack.org/196320 - Ironic spec on finishing API versioning

Blueprint information

Status:
Complete
Approver:
Dmitry Tantsur
Priority:
Essential
Drafter:
Dmitry Tantsur
Direction:
Approved
Assignee:
Dmitry Tantsur
Definition:
Approved
Series goal:
Accepted for liberty
Implementation:
Implemented
Milestone target:
milestone icon 2.1.0
Started by
Dmitry Tantsur
Completed by
Dmitry Tantsur

Related branches

Sprints

Whiteboard

dtantsur: discussion is still going on, not sure if we manage to fit this in 2.1.0..
dtantsur: priority "essential" as we need to have it at least in _some_ form before we start adding API

Client change:
https://review.openstack.org/#/c/203618/

Gerrit topic: https://review.openstack.org/#q,topic:bp/api-versioning,n,z

Addressed by: https://review.openstack.org/205070
    Fix functional test invocation

Addressed by: https://review.openstack.org/205071
    Implement optional API versioning

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.