API microversion 2.69: Handles Down Cells
This patch explicitly points out the change needed while forming the detailed lists for servers. In those cases where the server response for ``openstack server list`` has the flavor and image keys missing for the instances in the down cell, the servers will be skipped from being processed. Depends-On: https://review.openstack.org/591657/ Related to blueprint handling-down-cell Change-Id: Ibcfe9febdc45db1cb86c6e88f65976feceb01c02
This commit is contained in:
parent
dcff1012fd
commit
239b103849
@ -1314,6 +1314,14 @@ class ListServer(command.Lister):
|
|||||||
# Populate image_name, image_id, flavor_name and flavor_id attributes
|
# Populate image_name, image_id, flavor_name and flavor_id attributes
|
||||||
# of server objects so that we can display those columns.
|
# of server objects so that we can display those columns.
|
||||||
for s in data:
|
for s in data:
|
||||||
|
if compute_client.api_version >= api_versions.APIVersion('2.69'):
|
||||||
|
# NOTE(tssurya): From 2.69, we will have the keys 'flavor'
|
||||||
|
# and 'image' missing in the server response during
|
||||||
|
# infrastructure failure situations.
|
||||||
|
# For those servers with partial constructs we just skip the
|
||||||
|
# processing of the image and flavor informations.
|
||||||
|
if not hasattr(s, 'image') or not hasattr(s, 'flavor'):
|
||||||
|
continue
|
||||||
if 'id' in s.image:
|
if 'id' in s.image:
|
||||||
image = images.get(s.image['id'])
|
image = images.get(s.image['id'])
|
||||||
if image:
|
if image:
|
||||||
|
@ -2272,6 +2272,50 @@ class TestServerList(TestServer):
|
|||||||
'Invalid time value'
|
'Invalid time value'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_server_list_v269_with_partial_constructs(self):
|
||||||
|
self.app.client_manager.compute.api_version = \
|
||||||
|
api_versions.APIVersion('2.69')
|
||||||
|
arglist = []
|
||||||
|
verifylist = []
|
||||||
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
# include "partial results" from non-responsive part of
|
||||||
|
# infrastructure.
|
||||||
|
server_dict = {
|
||||||
|
"id": "server-id-95a56bfc4xxxxxx28d7e418bfd97813a",
|
||||||
|
"status": "UNKNOWN",
|
||||||
|
"tenant_id": "6f70656e737461636b20342065766572",
|
||||||
|
"created": "2018-12-03T21:06:18Z",
|
||||||
|
"links": [
|
||||||
|
{
|
||||||
|
"href": "http://fake/v2.1/",
|
||||||
|
"rel": "self"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"href": "http://fake",
|
||||||
|
"rel": "bookmark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
# We need to pass networks as {} because its defined as a property
|
||||||
|
# of the novaclient Server class which gives {} by default. If not
|
||||||
|
# it will fail at formatting the networks info later on.
|
||||||
|
"networks": {}
|
||||||
|
}
|
||||||
|
server = compute_fakes.fakes.FakeResource(
|
||||||
|
info=server_dict,
|
||||||
|
)
|
||||||
|
self.servers.append(server)
|
||||||
|
columns, data = self.cmd.take_action(parsed_args)
|
||||||
|
# get the first three servers out since our interest is in the partial
|
||||||
|
# server.
|
||||||
|
next(data)
|
||||||
|
next(data)
|
||||||
|
next(data)
|
||||||
|
partial_server = next(data)
|
||||||
|
expected_row = (
|
||||||
|
'server-id-95a56bfc4xxxxxx28d7e418bfd97813a', '',
|
||||||
|
'UNKNOWN', '', '', '')
|
||||||
|
self.assertEqual(expected_row, partial_server)
|
||||||
|
|
||||||
|
|
||||||
class TestServerLock(TestServer):
|
class TestServerLock(TestServer):
|
||||||
|
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
From microversion 2.69 the results of ``openstack server list`` and
|
||||||
|
``openstack server show`` may contain missing information in their outputs
|
||||||
|
when there are partial infrastructure failure periods in the deployment.
|
||||||
|
See `Handling Down Cells`_ for more information on the missing keys/info.
|
||||||
|
|
||||||
|
.. _Handling Down Cells: https://developer.openstack.org/api-guide/compute/down_cells.html
|
Loading…
Reference in New Issue
Block a user