Follow-up: Use `microversion-parse` to parse version headers in API requests

Adds a release note, unit test, and documentation update as a follow-up to the
`microversion-parse change <https://review.opendev.org/c/openstack/ironic/+/913793>`_

Change-Id: I535af988125a511e4f54c9d81acd47c327413774
This commit is contained in:
cid 2024-04-18 01:00:36 +01:00
parent c85d9c8326
commit 20543fc115
3 changed files with 17 additions and 1 deletions

View File

@ -12,10 +12,15 @@ supports versioning. There are two kinds of versions in Ironic.
- ''major versions'', which have dedicated urls. - ''major versions'', which have dedicated urls.
- ''microversions'', which can be requested through the use of the - ''microversions'', which can be requested through the use of the
``X-OpenStack-Ironic-API-Version`` header. ``X-OpenStack-Ironic-API-Version`` header or the new standard singular header
``OpenStack-API-Version: baremetal <version>``.
The Version APIs work differently from other APIs as they *do not* require authentication. The Version APIs work differently from other APIs as they *do not* require authentication.
Upon the Dalmatian release, all API requests support the
new standard singular header ``OpenStack-API-Version: baremetal <version>``.
If that's not present, we fall back to the legacy headers.
Beginning with the Kilo release, all API requests support the Beginning with the Kilo release, all API requests support the
``X-OpenStack-Ironic-API-Version`` header. This header SHOULD be supplied ``X-OpenStack-Ironic-API-Version`` header. This header SHOULD be supplied
with every request; in the absence of this header, each request is treated with every request; in the absence of this header, each request is treated

View File

@ -71,6 +71,11 @@ class TestVersion(base.BaseApiTest):
{cbase.Version.string: '123.456'}, mock.ANY, mock.ANY) {cbase.Version.string: '123.456'}, mock.ANY, mock.ANY)
self.assertEqual((123, 456), version) self.assertEqual((123, 456), version)
def test_parse_new_standard_singular_header_ok(self):
version = cbase.Version.parse_headers(
{'OpenStack-API-Version': 'baremetal 123.456'}, mock.ANY, mock.ANY)
self.assertEqual((123, 456), version)
def test_parse_headers_latest(self): def test_parse_headers_latest(self):
for s in ['latest', 'LATEST']: for s in ['latest', 'LATEST']:
version = cbase.Version.parse_headers( version = cbase.Version.parse_headers(

View File

@ -0,0 +1,6 @@
---
features:
- |
Delegate parsing of version headers in API requests to the
``microversion-parse`` library which also adds support for the new
standard singular header: 'OpenStack-API-Version: baremetal <version>'.