Skip to content

Commit 7feb9d3

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "API microversion 2.69: Handles Down Cells"
2 parents f992617 + 239b103 commit 7feb9d3

3 files changed

Lines changed: 61 additions & 0 deletions

File tree

openstackclient/compute/v2/server.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,14 @@ def take_action(self, parsed_args):
13141314
# Populate image_name, image_id, flavor_name and flavor_id attributes
13151315
# of server objects so that we can display those columns.
13161316
for s in data:
1317+
if compute_client.api_version >= api_versions.APIVersion('2.69'):
1318+
# NOTE(tssurya): From 2.69, we will have the keys 'flavor'
1319+
# and 'image' missing in the server response during
1320+
# infrastructure failure situations.
1321+
# For those servers with partial constructs we just skip the
1322+
# processing of the image and flavor informations.
1323+
if not hasattr(s, 'image') or not hasattr(s, 'flavor'):
1324+
continue
13171325
if 'id' in s.image:
13181326
image = images.get(s.image['id'])
13191327
if image:

openstackclient/tests/unit/compute/v2/test_server.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,50 @@ def test_server_list_with_invalid_changes_since(self, mock_parse_isotime):
22722272
'Invalid time value'
22732273
)
22742274

2275+
def test_server_list_v269_with_partial_constructs(self):
2276+
self.app.client_manager.compute.api_version = \
2277+
api_versions.APIVersion('2.69')
2278+
arglist = []
2279+
verifylist = []
2280+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
2281+
# include "partial results" from non-responsive part of
2282+
# infrastructure.
2283+
server_dict = {
2284+
"id": "server-id-95a56bfc4xxxxxx28d7e418bfd97813a",
2285+
"status": "UNKNOWN",
2286+
"tenant_id": "6f70656e737461636b20342065766572",
2287+
"created": "2018-12-03T21:06:18Z",
2288+
"links": [
2289+
{
2290+
"href": "http://fake/v2.1/",
2291+
"rel": "self"
2292+
},
2293+
{
2294+
"href": "http://fake",
2295+
"rel": "bookmark"
2296+
}
2297+
],
2298+
# We need to pass networks as {} because its defined as a property
2299+
# of the novaclient Server class which gives {} by default. If not
2300+
# it will fail at formatting the networks info later on.
2301+
"networks": {}
2302+
}
2303+
server = compute_fakes.fakes.FakeResource(
2304+
info=server_dict,
2305+
)
2306+
self.servers.append(server)
2307+
columns, data = self.cmd.take_action(parsed_args)
2308+
# get the first three servers out since our interest is in the partial
2309+
# server.
2310+
next(data)
2311+
next(data)
2312+
next(data)
2313+
partial_server = next(data)
2314+
expected_row = (
2315+
'server-id-95a56bfc4xxxxxx28d7e418bfd97813a', '',
2316+
'UNKNOWN', '', '', '')
2317+
self.assertEqual(expected_row, partial_server)
2318+
22752319

22762320
class TestServerLock(TestServer):
22772321

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
features:
3+
- |
4+
From microversion 2.69 the results of ``openstack server list`` and
5+
``openstack server show`` may contain missing information in their outputs
6+
when there are partial infrastructure failure periods in the deployment.
7+
See `Handling Down Cells`_ for more information on the missing keys/info.
8+
9+
.. _Handling Down Cells: https://developer.openstack.org/api-guide/compute/down_cells.html

0 commit comments

Comments
 (0)