Merge "[BugFix] Add 'all_tenants', 'project_id' in attachment-list"

This commit is contained in:
Jenkins 2017-04-06 01:51:53 +00:00 committed by Gerrit Code Review
commit 0cf8d9bf30
3 changed files with 15 additions and 3 deletions

View File

@ -133,7 +133,12 @@ class ShellTest(utils.TestCase):
{'cmd': '--all-tenants 1',
'expected': '?all_tenants=1'},
{'cmd': '--all-tenants 1 --volume-id 12345',
'expected': '?all_tenants=1&volume_id=12345'}
'expected': '?all_tenants=1&volume_id=12345'},
{'cmd': '--all-tenants 1 --tenant 12345',
'expected': '?all_tenants=1&project_id=12345'},
{'cmd': '--tenant 12345',
'expected': '?all_tenants=1&project_id=12345'}
)
@ddt.unpack
def test_attachment_list(self, cmd, expected):

View File

@ -1303,6 +1303,7 @@ def do_snapshot_list(cs, args):
['ID', 'Volume ID', 'Status', 'Name', 'Size'],
sortby_index=sortby_index)
@api_versions.wraps('3.27')
@utils.arg('--all-tenants',
dest='all_tenants',
@ -1310,7 +1311,7 @@ def do_snapshot_list(cs, args):
nargs='?',
type=int,
const=1,
default=0,
default=utils.env('ALL_TENANTS', default=0),
help='Shows details for all tenants. Admin only.')
@utils.arg('--volume-id',
metavar='<volume-id>',
@ -1346,7 +1347,8 @@ def do_snapshot_list(cs, args):
def do_attachment_list(cs, args):
"""Lists all attachments."""
search_opts = {
'all_tenants': args.all_tenants,
'all_tenants': 1 if args.tenant else args.all_tenants,
'project_id': args.tenant,
'status': args.status,
'volume_id': args.volume_id,
}

View File

@ -0,0 +1,5 @@
---
fixes:
- The 'tenant' argument was ignored when listing attachments,
and now has been fixed.
[Bug `1675974 <https://bugs.launchpad.net/bugs/1675974>`_]