From 3b60eba9aa022a5f5a7b84ce236626f31493485b Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Thu, 9 Mar 2017 09:25:32 +0800 Subject: [PATCH] Fix all_tenants doesn't work for group list all_tenants is forgotten to pass by group list. This patch fixed it. Change-Id: I419430e929038c35747c59600be83f2e2d084802 Closes-bug: #1671293 --- cinderclient/tests/unit/v3/test_shell.py | 5 +++++ cinderclient/v3/shell.py | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py index 7bc13f3ab..4599c67ad 100644 --- a/cinderclient/tests/unit/v3/test_shell.py +++ b/cinderclient/tests/unit/v3/test_shell.py @@ -236,6 +236,11 @@ class ShellTest(utils.TestCase): self.run_command('--os-volume-api-version 3.13 group-list') self.assert_called_anytime('GET', '/groups/detail') + def test_group_list__with_all_tenant(self): + self.run_command( + '--os-volume-api-version 3.13 group-list --all-tenants') + self.assert_called_anytime('GET', '/groups/detail?all_tenants=1') + def test_group_show(self): self.run_command('--os-volume-api-version 3.13 ' 'group-show 1234') diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py index 81c021cae..899bcaa64 100644 --- a/cinderclient/v3/shell.py +++ b/cinderclient/v3/shell.py @@ -753,11 +753,13 @@ def do_manageable_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.') def do_group_list(cs, args): """Lists all groups.""" - groups = cs.groups.list() + search_opts = {'all_tenants': args.all_tenants} + + groups = cs.groups.list(search_opts=search_opts) columns = ['ID', 'Status', 'Name'] utils.print_list(groups, columns)