From 93578ef85ba5f94ec5dc8fc4b2917e91c74121da Mon Sep 17 00:00:00 2001 From: melanie witt Date: Thu, 18 Nov 2021 00:31:02 +0000 Subject: Add 'Host Status' to 'server list --long' with >= v2.16 Currently, the 'Host Status' field is shown only for 'server show' but not for 'server list'. The host_status can be helpful for users who are having issues with servers that show a status of ACTIVE, as it can show a hint about the compute host status when nova policy is configured to allow it. Story: 2009689 Task: 44003 Change-Id: I6209cf52044218b7b32ab2fa5712574f12ba2f5f --- openstackclient/compute/v2/server.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'openstackclient/compute') diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index 291244e7..436c2597 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -2569,6 +2569,21 @@ class ListServer(command.Lister): else: s.security_groups_name = [] + # The host_status field contains the status of the compute host the + # server is on. It is only returned by the API when the nova-api + # policy allows. Users can look at the host_status field when, for + # example, their server has status ACTIVE but is unresponsive. The + # host_status field can indicate a possible problem on the host + # it's on, providing useful information to a user in this + # situation. + if ( + compute_client.api_version >= api_versions.APIVersion('2.16') and + parsed_args.long + ): + if any([hasattr(s, 'host_status') for s in data]): + columns += ('Host Status',) + column_headers += ('Host Status',) + table = ( column_headers, ( -- cgit v1.2.1