diff --git a/glance/api/middleware/version_negotiation.py b/glance/api/middleware/version_negotiation.py index 99a5286c46..83bd068a80 100644 --- a/glance/api/middleware/version_negotiation.py +++ b/glance/api/middleware/version_negotiation.py @@ -92,6 +92,7 @@ class VersionNegotiationFilter(wsgi.Middleware): allowed_versions['v2.11'] = 2 allowed_versions['v2.12'] = 2 allowed_versions['v2.13'] = 2 + allowed_versions['v2.17'] = 2 return allowed_versions def _match_version_string(self, subject): diff --git a/glance/api/versions.py b/glance/api/versions.py index 76e12f9387..8ef5bcefb6 100644 --- a/glance/api/versions.py +++ b/glance/api/versions.py @@ -79,13 +79,13 @@ class Controller(object): version_objs = [] if CONF.image_cache_dir: version_objs.extend([ - build_version_object('2.16', 'v2', 'CURRENT'), + build_version_object('2.16', 'v2', 'SUPPORTED'), build_version_object('2.15', 'v2', 'SUPPORTED'), build_version_object('2.14', 'v2', 'SUPPORTED'), ]) else: version_objs.extend([ - build_version_object('2.15', 'v2', 'CURRENT'), + build_version_object('2.15', 'v2', 'SUPPORTED'), ]) if CONF.enabled_backends: version_objs.extend([ @@ -101,6 +101,7 @@ class Controller(object): build_version_object('2.9', 'v2', 'SUPPORTED'), ]) version_objs.extend([ + build_version_object('2.17', 'v2', 'CURRENT'), build_version_object('2.7', 'v2', 'SUPPORTED'), build_version_object('2.6', 'v2', 'SUPPORTED'), build_version_object('2.5', 'v2', 'SUPPORTED'), diff --git a/glance/tests/unit/test_versions.py b/glance/tests/unit/test_versions.py index cc1911e799..c34d0c25b9 100644 --- a/glance/tests/unit/test_versions.py +++ b/glance/tests/unit/test_versions.py @@ -32,7 +32,7 @@ def get_versions_list(url, enabled_backends=False, image_versions = [ { 'id': 'v2.15', - 'status': 'CURRENT', + 'status': 'SUPPORTED', 'links': [{'rel': 'self', 'href': '%s/v2/' % url}], }, @@ -42,6 +42,12 @@ def get_versions_list(url, enabled_backends=False, 'links': [{'rel': 'self', 'href': '%s/v2/' % url}], }, + { + 'id': 'v2.17', + 'status': 'CURRENT', + 'links': [{'rel': 'self', + 'href': '%s/v2/' % url}], + }, { 'id': 'v2.7', 'status': 'SUPPORTED', @@ -95,7 +101,7 @@ def get_versions_list(url, enabled_backends=False, image_versions = [ { 'id': 'v2.15', - 'status': 'CURRENT', + 'status': 'SUPPORTED', 'links': [{'rel': 'self', 'href': '%s/v2/' % url}], }, @@ -147,7 +153,7 @@ def get_versions_list(url, enabled_backends=False, }) image_versions.insert(0, { 'id': 'v2.16', - 'status': 'CURRENT', + 'status': 'SUPPORTED', 'links': [{'rel': 'self', 'href': '%s/v2/' % url}], }) @@ -377,15 +383,26 @@ class VersionNegotiationTest(base.IsolatedUnitTest): self.middleware.process_request(request) self.assertEqual('/v2/images', request.path_info) - # version 2.17 does not exist - def test_request_url_v2_17_default_unsupported(self): + def test_request_url_v2_17_default_supported(self): request = webob.Request.blank('/v2.17/images') + self.middleware.process_request(request) + self.assertEqual('/v2/images', request.path_info) + + def test_request_url_v2_17_enabled_supported(self): + self.config(enabled_backends='slow:one,fast:two') + request = webob.Request.blank('/v2.17/images') + self.middleware.process_request(request) + self.assertEqual('/v2/images', request.path_info) + + # version 2.18 does not exist + def test_request_url_v2_18_default_unsupported(self): + request = webob.Request.blank('/v2.18/images') resp = self.middleware.process_request(request) self.assertIsInstance(resp, versions.Controller) - def test_request_url_v2_17_enabled_unsupported(self): + def test_request_url_v2_18_enabled_unsupported(self): self.config(enabled_backends='slow:one,fast:two') - request = webob.Request.blank('/v2.17/images') + request = webob.Request.blank('/v2.18/images') resp = self.middleware.process_request(request) self.assertIsInstance(resp, versions.Controller)