Add API version 2.8

This change bumps the API to EXPERIMENTAL 2.8 when multi back-end
is enabled.

Change-Id: Ie0e1ed84db1b227eea1774138b2a83172ff85bec
This commit is contained in:
Erno Kuvaja 2018-08-07 13:36:50 +01:00
parent cacede14b4
commit 208935af96
4 changed files with 18 additions and 2 deletions

View File

@ -1,5 +1,15 @@
{ {
"versions": [ "versions": [
{
"id": "v2.8",
"links": [
{
"href": "http://glance.openstack.example.org/v2/",
"rel": "self"
}
],
"status": "EXPERIMENTAL"
},
{ {
"id": "v2.7", "id": "v2.7",
"links": [ "links": [

View File

@ -82,6 +82,8 @@ class VersionNegotiationFilter(wsgi.Middleware):
allowed_versions['v2.5'] = 2 allowed_versions['v2.5'] = 2
allowed_versions['v2.6'] = 2 allowed_versions['v2.6'] = 2
allowed_versions['v2.7'] = 2 allowed_versions['v2.7'] = 2
if CONF.enabled_backends:
allowed_versions['v2.8'] = 2
return allowed_versions return allowed_versions
def _match_version_string(self, subject): def _match_version_string(self, subject):

View File

@ -73,6 +73,10 @@ class Controller(object):
version_objs = [] version_objs = []
if CONF.enable_v2_api: if CONF.enable_v2_api:
if CONF.enabled_backends:
version_objs.extend([
build_version_object(2.8, 'v2', 'EXPERIMENTAL')
])
version_objs.extend([ version_objs.extend([
build_version_object(2.7, 'v2', 'CURRENT'), build_version_object(2.7, 'v2', 'CURRENT'),
build_version_object(2.6, 'v2', 'SUPPORTED'), build_version_object(2.6, 'v2', 'SUPPORTED'),

View File

@ -181,8 +181,8 @@ class VersionNegotiationTest(base.IsolatedUnitTest):
self.middleware.process_request(request) self.middleware.process_request(request)
self.assertEqual('/v2/images', request.path_info) self.assertEqual('/v2/images', request.path_info)
def test_request_url_v2_8_unsupported(self): def test_request_url_v2_9_unsupported(self):
request = webob.Request.blank('/v2.8/images') request = webob.Request.blank('/v2.9/images')
resp = self.middleware.process_request(request) resp = self.middleware.process_request(request)
self.assertIsInstance(resp, versions.Controller) self.assertIsInstance(resp, versions.Controller)