compute: Fix --host in server list for new openstacksdk

With `openstacksdk` 3.2.0 the `host` attribute of an Instance got added
to the `Server` class [0]. With that change, listing servers with the `host`
attribute leads to a query-filter for `compute_host` as expected, but
`openstacksdk` will also filter for the `host` attribute locally after
the results are returned. Since `compute_host` being
`OS-EXT-SRV-ATTR:host` is not the same as `host, this means no results
are returned.

Since we want to keep the old behaviour of filtering by `compute_host`
i.e. the service host name, we need to switch to filter for
`compute_host`. This is already supported in older versions of
`openstacksdk`.

[0] 0f311ff3e2

Change-Id: I0cd32c5b7d6d4d21194f3efdcfb9b205dea6a91e
Closes-bug: #2074200
(cherry picked from commit ffa683ab4e)
This commit is contained in:
Johannes Kulik 2024-08-13 12:14:31 +02:00 committed by Stephen Finucane
parent e648750a11
commit 773b869323
2 changed files with 2 additions and 2 deletions

View File

@ -2648,7 +2648,7 @@ class ListServer(command.Lister):
'status': parsed_args.status,
'flavor': flavor_id,
'image': image_id,
'host': parsed_args.host,
'compute_host': parsed_args.host,
'project_id': project_id,
'all_projects': parsed_args.all_projects,
'user_id': user_id,

View File

@ -4581,7 +4581,7 @@ class _TestServerList(TestServer):
'status': None,
'flavor': None,
'image': None,
'host': None,
'compute_host': None,
'project_id': None,
'all_projects': False,
'user_id': None,