summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-10-15 00:06:54 +0000
committerGerrit Code Review <review@openstack.org>2020-10-15 00:06:54 +0000
commit78ac573a6cb6bba1f0c844a01602dec097a86b59 (patch)
tree7e1f72226d132aa82967496f3b635f473fedad16
parent9167558dfa8fc706c3d93727d6d5f6faf229b17c (diff)
parentdf1542686349a97ab1527f80c81861d89aaf4f78 (diff)
downloadnova-78ac573a6cb6bba1f0c844a01602dec097a86b59.tar.gz
Merge "[placement] Add status and links fields to version document at /" into stable/queens
-rw-r--r--nova/api/openstack/placement/handlers/root.py12
-rw-r--r--nova/tests/functional/api/openstack/placement/gabbits/microversion.yaml2
-rw-r--r--placement-api-ref/source/get-root.json9
-rw-r--r--placement-api-ref/source/parameters.yaml13
-rw-r--r--placement-api-ref/source/root.inc2
5 files changed, 37 insertions, 1 deletions
diff --git a/nova/api/openstack/placement/handlers/root.py b/nova/api/openstack/placement/handlers/root.py
index 2f9c6861f2..298dab3816 100644
--- a/nova/api/openstack/placement/handlers/root.py
+++ b/nova/api/openstack/placement/handlers/root.py
@@ -32,6 +32,18 @@ def home(req):
'id': 'v%s' % min_version,
'max_version': max_version,
'min_version': min_version,
+ # for now there is only ever one version, so it must be CURRENT
+ 'status': 'CURRENT',
+ 'links': [{
+ # Point back to this same URL as the root of this version.
+ # NOTE(cdent): We explicitly want this to be a relative-URL
+ # representation of "this same URL", otherwise placement needs
+ # to keep track of proxy addresses and the like, which we have
+ # avoided thus far, in order to construct full URLs. Placement
+ # is much easier to scale if we never track that stuff.
+ 'rel': 'self',
+ 'href': '',
+ }],
}
version_json = jsonutils.dumps({'versions': [version_data]})
req.response.body = encodeutils.to_utf8(version_json)
diff --git a/nova/tests/functional/api/openstack/placement/gabbits/microversion.yaml b/nova/tests/functional/api/openstack/placement/gabbits/microversion.yaml
index 2a40d4f5cc..27f81ca8c0 100644
--- a/nova/tests/functional/api/openstack/placement/gabbits/microversion.yaml
+++ b/nova/tests/functional/api/openstack/placement/gabbits/microversion.yaml
@@ -22,6 +22,8 @@ tests:
$.versions[0].max_version: /^\d+\.\d+$/
$.versions[0].min_version: /^\d+\.\d+$/
$.versions[0].id: v1.0
+ $.versions[0].status: CURRENT
+ $.versions[0].links[?rel = 'self'].href: ''
- name: unavailable microversion raises 406
GET: /
diff --git a/placement-api-ref/source/get-root.json b/placement-api-ref/source/get-root.json
index bdb92c3dec..e825006d71 100644
--- a/placement-api-ref/source/get-root.json
+++ b/placement-api-ref/source/get-root.json
@@ -3,7 +3,14 @@
{
"min_version" : "1.0",
"id" : "v1.0",
- "max_version" : "1.2"
+ "max_version" : "1.17",
+ "status": "CURRENT",
+ "links": [
+ {
+ "href": "",
+ "rel": "self"
+ }
+ ]
}
]
}
diff --git a/placement-api-ref/source/parameters.yaml b/placement-api-ref/source/parameters.yaml
index 6c1e87bdd9..187881798f 100644
--- a/placement-api-ref/source/parameters.yaml
+++ b/placement-api-ref/source/parameters.yaml
@@ -416,6 +416,12 @@ version_id:
required: true
description: >
A common name for the version being described. Informative only.
+version_links:
+ type: array
+ in: body
+ required: true
+ description: >
+ A list of links related to and describing this version.
version_max:
type: string
in: body
@@ -428,6 +434,13 @@ version_min:
required: true
description: >
The minimum microversion that is supported.
+version_status:
+ type: string
+ in: body
+ required: true
+ description: >
+ The status of the version being described. With placement this is
+ "CURRENT".
versions:
type: array
in: body
diff --git a/placement-api-ref/source/root.inc b/placement-api-ref/source/root.inc
index d6c498c052..b92b37aaa2 100644
--- a/placement-api-ref/source/root.inc
+++ b/placement-api-ref/source/root.inc
@@ -41,6 +41,8 @@ Response
- id: version_id
- min_version: version_min
- max_version: version_max
+ - status: version_status
+ - links: version_links
Response Example
----------------