Merge "Fix error in CLI 'manila list' with sorting key 'availability_zone'."

This commit is contained in:
Zuul 2021-04-01 14:00:35 +00:00 committed by Gerrit Code Review
commit 752aeccd4b
4 changed files with 10 additions and 1 deletions

View File

@ -20,7 +20,7 @@ SORT_DIR_VALUES = ('asc', 'desc')
SHARE_SORT_KEY_VALUES = (
'id', 'status', 'size', 'host', 'share_proto',
'availability_zone',
'availability_zone_id', 'availability_zone',
'user_id', 'project_id',
'created_at', 'updated_at',
'display_name', 'name',

View File

@ -332,6 +332,8 @@ class ShellTest(test_utils.TestCase):
key = 'share_network_id' if key == 'share_network' else key
key = 'snapshot_id' if key == 'snapshot' else key
key = 'share_type_id' if key == 'share_type' else key
key = ('availability_zone_id' if key == 'availability_zone'
else key)
self.assert_called('GET', '/shares/detail?sort_key=' + key)
def test_list_with_fake_sort_key(self):

View File

@ -388,6 +388,8 @@ class ShareManager(base.ManagerWithFind):
search_opts['sort_key'] = 'snapshot_id'
elif sort_key == 'share_network':
search_opts['sort_key'] = 'share_network_id'
elif sort_key == 'availability_zone':
search_opts['sort_key'] = 'availability_zone_id'
else:
raise ValueError('sort_key must be one of the following: %s.'
% ', '.join(constants.SHARE_SORT_KEY_VALUES))

View File

@ -0,0 +1,5 @@
---
fixes:
- |
`Launchpad bug 1920888 <https://bugs.launchpad.net/manila/+bug/1920888>`_:
Fix the bug in CLI 'manila list' with sorting key 'availability_zone'.