diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py index 80fd0fe..d2c12dd 100644 --- a/cinderclient/tests/unit/v3/test_shell.py +++ b/cinderclient/tests/unit/v3/test_shell.py @@ -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): diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py index 1e8c156..a4e402f 100644 --- a/cinderclient/v3/shell.py +++ b/cinderclient/v3/shell.py @@ -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='', @@ -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, } diff --git a/releasenotes/notes/bug-1675974-34edd5g9870e65b2.yaml b/releasenotes/notes/bug-1675974-34edd5g9870e65b2.yaml new file mode 100644 index 0000000..14ef33c --- /dev/null +++ b/releasenotes/notes/bug-1675974-34edd5g9870e65b2.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - The 'tenant' argument was ignored when listing attachments, + and now has been fixed. + [Bug `1675974 `_]