summaryrefslogtreecommitdiff
path: root/openstackclient/compute
diff options
context:
space:
mode:
authormelanie witt <melwittt@gmail.com>2021-11-18 00:31:02 +0000
committermelanie witt <melwittt@gmail.com>2022-05-16 17:55:40 +0000
commit93578ef85ba5f94ec5dc8fc4b2917e91c74121da (patch)
tree79399232d1bf0b3591baefd4e64f391a7a6f589e /openstackclient/compute
parent9fc9e8d9d7e9c61d92d05a9960a2f21d5f2b5168 (diff)
downloadpython-openstackclient-93578ef85ba5f94ec5dc8fc4b2917e91c74121da.tar.gz
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
Diffstat (limited to 'openstackclient/compute')
-rw-r--r--openstackclient/compute/v2/server.py15
1 files changed, 15 insertions, 0 deletions
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,
(