Bump Images API to v2.6

The MVP of image import functionality will be introduced as an
EXPERIMENTAL 2.6 version of the Images API.  The current version
will remain at 2.5.

This patch:
* Updates the version response
* Updates version negotiation code
* Updates unit and functional tests
* Updates the api-ref
* Adds a releasenote

Change-Id: Ied573897157e05f7b0438baeb1553326fb06613a
This commit is contained in:
Brian Rosmaita 2017-08-03 17:07:28 -04:00
parent e7ceaebd49
commit af8c371a8c
7 changed files with 94 additions and 3 deletions

View File

@ -24,6 +24,10 @@ Image Service Versions
Version History
***************
**Pike changes**
- version 2.6 is EXPERIMENTAL
**Ocata changes**
- version 2.5 is CURRENT

View File

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

View File

@ -84,6 +84,7 @@ class VersionNegotiationFilter(wsgi.Middleware):
allowed_versions['v2.3'] = 2
allowed_versions['v2.4'] = 2
allowed_versions['v2.5'] = 2
allowed_versions['v2.6'] = 2
return allowed_versions
def _match_version_string(self, subject):

View File

@ -74,6 +74,7 @@ class Controller(object):
version_objs = []
if CONF.enable_v2_api:
version_objs.extend([
build_version_object(2.6, 'v2', 'EXPERIMENTAL'),
build_version_object(2.5, 'v2', 'CURRENT'),
build_version_object(2.4, 'v2', 'SUPPORTED'),
build_version_object(2.3, 'v2', 'SUPPORTED'),

View File

@ -32,6 +32,11 @@ class TestApiVersions(functional.FunctionalTest):
url = 'http://127.0.0.1:%d/v%%s/' % self.api_port
versions = {'versions': [
{
'id': 'v2.6',
'status': 'EXPERIMENTAL',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.5',
'status': 'CURRENT',
@ -89,6 +94,11 @@ class TestApiVersions(functional.FunctionalTest):
url = 'http://127.0.0.1:%d/v%%s/' % self.api_port
versions = {'versions': [
{
'id': 'v2.6',
'status': 'EXPERIMENTAL',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.5',
'status': 'CURRENT',
@ -164,6 +174,11 @@ class TestApiPaths(functional.FunctionalTest):
url = 'http://127.0.0.1:%d/v%%s/' % self.api_port
self.versions = {'versions': [
{
'id': 'v2.6',
'status': 'EXPERIMENTAL',
'links': [{'rel': 'self', 'href': url % '2'}],
},
{
'id': 'v2.5',
'status': 'CURRENT',

View File

@ -36,6 +36,12 @@ class VersionsTest(base.IsolatedUnitTest):
self.assertEqual('application/json', res.content_type)
results = jsonutils.loads(res.body)['versions']
expected = [
{
'id': 'v2.6',
'status': 'EXPERIMENTAL',
'links': [{'rel': 'self',
'href': 'http://127.0.0.1:9292/v2/'}],
},
{
'id': 'v2.5',
'status': 'CURRENT',
@ -97,6 +103,12 @@ class VersionsTest(base.IsolatedUnitTest):
self.assertEqual('application/json', res.content_type)
results = jsonutils.loads(res.body)['versions']
expected = [
{
'id': 'v2.6',
'status': 'EXPERIMENTAL',
'links': [{'rel': 'self',
'href': 'https://example.com:9292/v2/'}],
},
{
'id': 'v2.5',
'status': 'CURRENT',
@ -157,6 +169,12 @@ class VersionsTest(base.IsolatedUnitTest):
self.assertEqual('application/json', res.content_type)
results = jsonutils.loads(res.body)['versions']
expected = [
{
'id': 'v2.6',
'status': 'EXPERIMENTAL',
'links': [{'rel': 'self',
'href': 'http://localhost:9292/v2/'}],
},
{
'id': 'v2.5',
'status': 'CURRENT',
@ -218,6 +236,12 @@ class VersionsTest(base.IsolatedUnitTest):
self.assertEqual('application/json', res.content_type)
results = jsonutils.loads(res.body)['versions']
expected = [
{
'id': 'v2.6',
'status': 'EXPERIMENTAL',
'links': [{'rel': 'self',
'href': 'https://localhost:9292/v2/'}],
},
{
'id': 'v2.5',
'status': 'CURRENT',
@ -332,13 +356,18 @@ class VersionNegotiationTest(base.IsolatedUnitTest):
self.middleware.process_request(request)
self.assertEqual('/v2/images', request.path_info)
def test_request_url_v2_6_unsupported(self):
def test_request_url_v2_6(self):
request = webob.Request.blank('/v2.6/images')
self.middleware.process_request(request)
self.assertEqual('/v2/images', request.path_info)
def test_request_url_v2_7_unsupported(self):
request = webob.Request.blank('/v2.7/images')
resp = self.middleware.process_request(request)
self.assertIsInstance(resp, versions.Controller)
def test_request_url_v4_unsupported(self):
request = webob.Request.blank('/v4/images')
def test_request_url_v3_unsupported(self):
request = webob.Request.blank('/v3/images')
resp = self.middleware.process_request(request)
self.assertIsInstance(resp, versions.Controller)
@ -381,3 +410,8 @@ class VersionsAndNegotiationTest(VersionNegotiationTest, VersionsTest):
to_check = self._get_list_of_version_ids('DEPRECATED')
for version_id in to_check:
self._assert_version_is_negotiated(version_id)
def test_experimental_is_negotiated(self):
to_check = self._get_list_of_version_ids('EXPERIMENTAL')
for version_id in to_check:
self._assert_version_is_negotiated(version_id)

View File

@ -0,0 +1,26 @@
---
prelude: >
- The *minor* version of the Images API v2 is bumped to **2.6**
to introduce an EXPERIMENTAL version of the API that includes
the new calls introduced for the Minimal Viable Product delivery
of the `refactored image import`_ functionality. Version **2.5**
remains the CURRENT version of the Images API.
upgrade:
- |
An **EXPERIMENTAL** version of the Images API supplied by Glance
is introduced as **2.6**. It includes the new API calls introduced
for the `refactored image import`_ functionality. This functionality
is **not** enabled by default, so the CURRENT version of the Images
API remains at 2.5. There are no changes to the version 2.5 API in
this release, so all version 2.5 calls will work whether or not the
new import functionality is enabled or not.
The version 2.6 API is being introduced as EXPERIMENTAL because it
is a Minimal Viable Product delivery of the functionality described
in the `refactored image import`_ specification. As an MVP, the
responses described in that specification are abbreviated in version
2.6. It is expected that version 2.6 will be completed in Queens,
but at this time, we encourage operators to try out the new
functionality, but keep in mind its EXPERIMENTAL nature.
.. _`refactored image import`: https://specs.openstack.org/openstack/glance-specs/specs/mitaka/approved/image-import/image-import-refactor.html