Merge "Filtering attachment doesn't support 'instance_id'"
This commit is contained in:
commit
8a7111b03d
|
@ -70,10 +70,10 @@ class AttachmentsController(wsgi.Controller):
|
|||
sort_keys, sort_dirs = common.get_sort_params(search_opts)
|
||||
marker, limit, offset = common.get_pagination_params(search_opts)
|
||||
|
||||
if search_opts.get('instance_id', None):
|
||||
search_opts['instance_uuid'] = search_opts.get('instance_id')
|
||||
utils.remove_invalid_filter_options(context, search_opts,
|
||||
self.allowed_filters)
|
||||
if search_opts.get('instance_id', None):
|
||||
search_opts['instance_uuid'] = search_opts.pop('instance_id', None)
|
||||
if context.is_admin and 'all_tenants' in search_opts:
|
||||
del search_opts['all_tenants']
|
||||
return objects.VolumeAttachmentList.get_all(
|
||||
|
|
|
@ -257,7 +257,11 @@ class AttachmentsAPITestCase(test.TestCase):
|
|||
{'admin': True, 'request_url':
|
||||
'?all_tenants=1&project_id=%s' % fake.PROJECT2_ID,
|
||||
'count': 1},
|
||||
{'admin': False, 'request_url': '', 'count': 3})
|
||||
{'admin': False, 'request_url': '', 'count': 3},
|
||||
{'admin': False, 'request_url': '?instance_id=%s' % fake.UUID1,
|
||||
'count': 2},
|
||||
{'admin': False, 'request_url': '?instance_id=%s' % fake.UUID2,
|
||||
'count': 1})
|
||||
@ddt.unpack
|
||||
def test_list_attachment_with_tenants(self, admin, request_url, count):
|
||||
url = '/v3/%s/attachments%s' % (fake.PROJECT_ID, request_url)
|
||||
|
|
Loading…
Reference in New Issue