Skip to content

Commit ffa683a

Browse files
joker-at-workstephenfin
authored andcommitted
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] openstack/openstacksdk@0f311ff Change-Id: I0cd32c5b7d6d4d21194f3efdcfb9b205dea6a91e Closes-bug: #2074200
1 parent 50d1e09 commit ffa683a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

openstackclient/compute/v2/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2648,7 +2648,7 @@ def take_action(self, parsed_args):
26482648
'status': parsed_args.status,
26492649
'flavor': flavor_id,
26502650
'image': image_id,
2651-
'host': parsed_args.host,
2651+
'compute_host': parsed_args.host,
26522652
'project_id': project_id,
26532653
'all_projects': parsed_args.all_projects,
26542654
'user_id': user_id,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4581,7 +4581,7 @@ def setUp(self):
45814581
'status': None,
45824582
'flavor': None,
45834583
'image': None,
4584-
'host': None,
4584+
'compute_host': None,
45854585
'project_id': None,
45864586
'all_projects': False,
45874587
'user_id': None,

0 commit comments

Comments
 (0)