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.

Closes-Bug: #1443375

Change-Id: Id464a07d624d0e228fe0aa66a04c8e51f292ba0c
This commit is contained in:
Ken'ichi Ohmichi
2015-04-13 09:21:46 +00:00
parent 6b69b70548
commit 1830870718
5 changed files with 29 additions and 0 deletions

View File

@@ -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"
}
]

View File

@@ -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": [
{

View File

@@ -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),
})

View File

@@ -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"
}
]

View File

@@ -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": [
{