diff options
author | Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> | 2015-04-15 03:13:43 +0000 |
---|---|---|
committer | Doug Hellmann <doug@doughellmann.com> | 2015-04-15 19:56:32 +0000 |
commit | 68d6f924037f3b931add2ce5d0d433913e720ca6 (patch) | |
tree | bb8bb0bb28fa9b5206d3aea07de5a77c6e706cbc | |
parent | 77d19b97c69d48ef2512fb3d14b0486ed2137b39 (diff) | |
download | nova-68d6f924037f3b931add2ce5d0d433913e720ca6.tar.gz |
Add min/max of API microversions to version API
As nova-spec api-microversions, versions API needs to expose minimum
and maximum microversions to version API, because clients need to
know available microversions through the API. That is very important
for the interoperability.
This patch adds these versions as the nova-spec mentioned.
Note:
As v2(not v2.1) API change manner, we have added new extensions if
changing API. However, this patch doesn't add a new extension even
if adding new parameters "version" and "min_version" because version
API is independent from both v2 and v2.1 APIs.
Change-Id: Id464a07d624d0e228fe0aa66a04c8e51f292ba0c
Closes-Bug: #1443375
(cherry picked from commit 1830870718fe7472b47037f3331cfe59b5bdda07)
(cherry picked from commit 853671e912c6ad9a4605acad2575417911875cdd)
5 files changed, 29 insertions, 0 deletions
diff --git a/doc/api_samples/versions/versions-get-resp.json b/doc/api_samples/versions/versions-get-resp.json index 371e0ccc95..2b456fd73a 100644 --- a/doc/api_samples/versions/versions-get-resp.json +++ b/doc/api_samples/versions/versions-get-resp.json @@ -9,6 +9,8 @@ } ], "status": "SUPPORTED", + "version": "", + "min_version": "", "updated": "2011-01-21T11:33:21Z" }, { @@ -20,6 +22,8 @@ } ], "status": "CURRENT", + "version": "2.3", + "min_version": "2.1", "updated": "2013-07-23T11:33:21Z" } ] diff --git a/nova/api/openstack/compute/versions.py b/nova/api/openstack/compute/versions.py index d6a633f3ba..4b727de320 100644 --- a/nova/api/openstack/compute/versions.py +++ b/nova/api/openstack/compute/versions.py @@ -15,6 +15,7 @@ from oslo_config import cfg +from nova.api.openstack import api_version_request from nova.api.openstack.compute.views import versions as views_versions from nova.api.openstack import wsgi @@ -36,6 +37,8 @@ VERSIONS = { "v2.0": { "id": "v2.0", "status": "SUPPORTED", + "version": "", + "min_version": "", "updated": "2011-01-21T11:33:21Z", "links": [ { @@ -54,6 +57,8 @@ VERSIONS = { "v2.1": { "id": "v2.1", "status": "CURRENT", + "version": api_version_request._MAX_API_VERSION, + "min_version": api_version_request._MIN_API_VERSION, "updated": "2013-07-23T11:33:21Z", "links": [ { diff --git a/nova/api/openstack/compute/views/versions.py b/nova/api/openstack/compute/views/versions.py index cf76c2be8d..237826a344 100644 --- a/nova/api/openstack/compute/views/versions.py +++ b/nova/api/openstack/compute/views/versions.py @@ -55,6 +55,8 @@ class ViewBuilder(common.ViewBuilder): version_objs.append({ "id": version['id'], "status": version['status'], + "version": version['version'], + "min_version": version['min_version'], "updated": version['updated'], "links": self._build_links(version), }) diff --git a/nova/tests/functional/api_samples/versions/versions-get-resp.json.tpl b/nova/tests/functional/api_samples/versions/versions-get-resp.json.tpl index 371e0ccc95..2b456fd73a 100644 --- a/nova/tests/functional/api_samples/versions/versions-get-resp.json.tpl +++ b/nova/tests/functional/api_samples/versions/versions-get-resp.json.tpl @@ -9,6 +9,8 @@ } ], "status": "SUPPORTED", + "version": "", + "min_version": "", "updated": "2011-01-21T11:33:21Z" }, { @@ -20,6 +22,8 @@ } ], "status": "CURRENT", + "version": "2.3", + "min_version": "2.1", "updated": "2013-07-23T11:33:21Z" } ] diff --git a/nova/tests/unit/api/openstack/compute/test_versions.py b/nova/tests/unit/api/openstack/compute/test_versions.py index 46cd4f91e7..9b235c782a 100644 --- a/nova/tests/unit/api/openstack/compute/test_versions.py +++ b/nova/tests/unit/api/openstack/compute/test_versions.py @@ -45,6 +45,8 @@ EXP_VERSIONS = { "v2.0": { "id": "v2.0", "status": "SUPPORTED", + "version": "", + "min_version": "", "updated": "2011-01-21T11:33:21Z", "links": [ { @@ -63,6 +65,8 @@ EXP_VERSIONS = { "v2.1": { "id": "v2.1", "status": "CURRENT", + "version": "2.3", + "min_version": "2.1", "updated": "2013-07-23T11:33:21Z", "links": [ { @@ -98,6 +102,8 @@ class VersionsTestV20(test.NoDBTestCase): { "id": "v2.0", "status": "SUPPORTED", + "version": "", + "min_version": "", "updated": "2011-01-21T11:33:21Z", "links": [ { @@ -108,6 +114,8 @@ class VersionsTestV20(test.NoDBTestCase): { "id": "v2.1", "status": "CURRENT", + "version": "2.3", + "min_version": "2.1", "updated": "2013-07-23T11:33:21Z", "links": [ { @@ -139,6 +147,8 @@ class VersionsTestV20(test.NoDBTestCase): "version": { "id": "v2.0", "status": "SUPPORTED", + "version": "", + "min_version": "", "updated": "2011-01-21T11:33:21Z", "links": [ { @@ -291,6 +301,8 @@ class VersionsViewBuilderTests(test.NoDBTestCase): "v3.2.1": { "id": "3.2.1", "status": "CURRENT", + "version": "2.3", + "min_version": "2.1", "updated": "2011-07-18T11:30:00Z", } } @@ -300,6 +312,8 @@ class VersionsViewBuilderTests(test.NoDBTestCase): { "id": "3.2.1", "status": "CURRENT", + "version": "2.3", + "min_version": "2.1", "updated": "2011-07-18T11:30:00Z", "links": [ { |