diff --git a/api-ref/source/baremetal-api-versions.inc b/api-ref/source/baremetal-api-versions.inc index dc580811c3..2fac3bd58c 100644 --- a/api-ref/source/baremetal-api-versions.inc +++ b/api-ref/source/baremetal-api-versions.inc @@ -12,10 +12,15 @@ supports versioning. There are two kinds of versions in Ironic. - ''major versions'', which have dedicated urls. - ''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 ``. 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 ``. +If that's not present, we fall back to the legacy headers. + Beginning with the Kilo release, all API requests support the ``X-OpenStack-Ironic-API-Version`` header. This header SHOULD be supplied with every request; in the absence of this header, each request is treated diff --git a/ironic/tests/unit/api/controllers/test_base.py b/ironic/tests/unit/api/controllers/test_base.py index 252e7f9a28..7d278f5af2 100644 --- a/ironic/tests/unit/api/controllers/test_base.py +++ b/ironic/tests/unit/api/controllers/test_base.py @@ -71,6 +71,11 @@ class TestVersion(base.BaseApiTest): {cbase.Version.string: '123.456'}, mock.ANY, mock.ANY) 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): for s in ['latest', 'LATEST']: version = cbase.Version.parse_headers( diff --git a/releasenotes/notes/parse-headers-with-the-microversion-parse-library-090d2cf5d9cfb74f.yaml b/releasenotes/notes/parse-headers-with-the-microversion-parse-library-090d2cf5d9cfb74f.yaml new file mode 100644 index 0000000000..28713a1d77 --- /dev/null +++ b/releasenotes/notes/parse-headers-with-the-microversion-parse-library-090d2cf5d9cfb74f.yaml @@ -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 '.