Fix bug for share type filter search

filter results do not take effect. for details, see comments
in review: https://review.openstack.org/#/c/522685/

Change-Id: Id577ae9d08dc0fae3dcac78d98ec0456f8378417
Closes-bug: #1768454
This commit is contained in:
junboli 2018-05-02 03:11:45 +08:00 committed by junbo.li
parent 626cb78c96
commit 20e890e97e
2 changed files with 4 additions and 4 deletions

View File

@ -94,7 +94,6 @@ def get_all_types(context, inactive=0, search_opts=None):
search_vars = {}
if 'extra_specs' in search_opts:
search_vars['extra_specs'] = search_opts.pop('extra_specs')
search_vars = search_opts.get('extra_specs')
if search_opts:
return {}

View File

@ -147,9 +147,10 @@ class ShareTypesTestCase(test.TestCase):
self.assertItemsEqual(share_type, returned_type)
search_filter = {'extra_specs': {'gold': 'False'}}
returned_type = share_types.get_all_types(self.context,
search_opts=search_filter)
self.assertEqual(share_type, returned_type)
expected_types = {}
returned_types = share_types.get_all_types(self.context,
search_opts=search_filter)
self.assertEqual(expected_types, returned_types)
share_type = self.fake_r_type_extra
search_filter = {'extra_specs': {'gold': 'True'}}