Add "links" in the response of "nova show" for a down-cell instance
The down-cell microversion 2.69 just recently merged and it returns links in the response for GET /servers/detail and GET /servers but not for GET /servers/{server_id} which was an oversight because that API returns links normally. We should include the links key in the 'nova show' case as well and this patch does exactly that. Typically this would require a microversion change but given the code merged recently and is not yet released we are just fixing this oversight through this patch without a microversion bump. Closes-Bug: #1818131 Change-Id: I2ce03df994f59c37b5ce3102c4e7165d17701798
This commit is contained in:
parent
e6b949e8d6
commit
a0b1951d2a
@ -240,6 +240,7 @@ behavior are described below:
|
||||
- availability_zone: The availability_zone of the server if it was specified
|
||||
during during boot time and "UNKNOWN" otherwise.
|
||||
- power_state: Its value will be 0 (``NOSTATE``).
|
||||
- links: Links to the servers in question.
|
||||
- server_groups: The UUIDs of the server groups to which the server belongs.
|
||||
Currently this can contain at most one entry. Note that this key will be in
|
||||
the response only from the "2.71" microversion.
|
||||
@ -275,6 +276,16 @@ behavior are described below:
|
||||
},
|
||||
"OS-EXT-AZ:availability_zone": "geneva",
|
||||
"OS-EXT-STS:power_state": 0,
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/servers/bcc6c6dd-3d0a-4633-9586-60878fd68edb",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/servers/bcc6c6dd-3d0a-4633-9586-60878fd68edb",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"server_groups": ["0fd77252-4eef-4ec4-ae9b-e05dfc98aeac"]
|
||||
}
|
||||
]
|
||||
|
@ -24,6 +24,16 @@
|
||||
},
|
||||
"status": "UNKNOWN",
|
||||
"tenant_id": "project",
|
||||
"user_id": "fake"
|
||||
"user_id": "fake",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/servers/33748c23-38dd-4f70-b774-522fc69e7b67",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/servers/33748c23-38dd-4f70-b774-522fc69e7b67",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -27,6 +27,16 @@
|
||||
],
|
||||
"status": "UNKNOWN",
|
||||
"tenant_id": "project",
|
||||
"user_id": "fake"
|
||||
"user_id": "fake",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/servers/2669556b-b4a3-41f1-a0c1-f9c7ff75e53c",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/6f70656e737461636b20342065766572/servers/2669556b-b4a3-41f1-a0c1-f9c7ff75e53c",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -149,6 +149,8 @@ class ViewBuilder(common.ViewBuilder):
|
||||
"status": "UNKNOWN",
|
||||
"tenant_id": instance.project_id,
|
||||
"created": utils.isotime(instance.created_at),
|
||||
"links": self._get_links(
|
||||
request, instance.uuid, self._collection_name),
|
||||
},
|
||||
}
|
||||
if 'flavor' in instance:
|
||||
@ -177,10 +179,6 @@ class ViewBuilder(common.ViewBuilder):
|
||||
context = request.environ['nova.context']
|
||||
ret['server']['server_groups'] = self._get_server_groups(
|
||||
context, instance)
|
||||
else:
|
||||
# GET /servers/detail includes links for GET /servers/{server_id}.
|
||||
ret['server']["links"] = self._get_links(
|
||||
request, instance.uuid, self._collection_name)
|
||||
return ret
|
||||
|
||||
def show(self, request, instance, extend_address=True,
|
||||
|
@ -24,6 +24,16 @@
|
||||
},
|
||||
"status": "UNKNOWN",
|
||||
"tenant_id": "project",
|
||||
"user_id": "fake"
|
||||
"user_id": "fake",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(versioned_compute_endpoint)s/servers/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(compute_endpoint)s/servers/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -25,6 +25,16 @@
|
||||
"status": "UNKNOWN",
|
||||
"server_groups": ["%(uuid)s"],
|
||||
"tenant_id": "project",
|
||||
"user_id": "fake"
|
||||
"user_id": "fake",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(versioned_compute_endpoint)s/servers/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(compute_endpoint)s/servers/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -7633,8 +7633,8 @@ class ServersViewBuilderTestV269(ServersViewBuilderTest):
|
||||
req = self.req('/fake/servers/%s' % FAKE_UUID)
|
||||
output = self.view_builder.show(req, self.instance,
|
||||
cell_down_support=True)
|
||||
# nine fields from request_spec and instance_mapping
|
||||
self.assertEqual(9, len(output['server']))
|
||||
# ten fields from request_spec and instance_mapping
|
||||
self.assertEqual(10, len(output['server']))
|
||||
image_bookmark = "http://localhost/fake/images/5"
|
||||
expected = {
|
||||
"server": {
|
||||
@ -7662,7 +7662,19 @@ class ServersViewBuilderTestV269(ServersViewBuilderTest):
|
||||
'swap': 0
|
||||
},
|
||||
"OS-EXT-AZ:availability_zone": "nova",
|
||||
"OS-EXT-STS:power_state": 0
|
||||
"OS-EXT-STS:power_state": 0,
|
||||
"links": [
|
||||
{
|
||||
"rel": "self",
|
||||
"href": "http://localhost/v2/fake/servers/%s" %
|
||||
self.uuid,
|
||||
},
|
||||
{
|
||||
"rel": "bookmark",
|
||||
"href": "http://localhost/fake/servers/%s" %
|
||||
self.uuid,
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
self.assertThat(output, matchers.DictMatches(expected))
|
||||
@ -7685,7 +7697,7 @@ class ServersViewBuilderTestV269(ServersViewBuilderTest):
|
||||
output = self.view_builder.show(req, self.instance,
|
||||
cell_down_support=True)
|
||||
# nine fields from request_spec and instance_mapping
|
||||
self.assertEqual(9, len(output['server']))
|
||||
self.assertEqual(10, len(output['server']))
|
||||
expected = {
|
||||
"server": {
|
||||
"id": self.uuid,
|
||||
@ -7704,7 +7716,19 @@ class ServersViewBuilderTestV269(ServersViewBuilderTest):
|
||||
'swap': 0
|
||||
},
|
||||
"OS-EXT-AZ:availability_zone": "UNKNOWN",
|
||||
"OS-EXT-STS:power_state": 0
|
||||
"OS-EXT-STS:power_state": 0,
|
||||
"links": [
|
||||
{
|
||||
"rel": "self",
|
||||
"href": "http://localhost/v2/fake/servers/%s" %
|
||||
self.uuid,
|
||||
},
|
||||
{
|
||||
"rel": "bookmark",
|
||||
"href": "http://localhost/fake/servers/%s" %
|
||||
self.uuid,
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
self.assertThat(output, matchers.DictMatches(expected))
|
||||
|
Loading…
x
Reference in New Issue
Block a user