summaryrefslogtreecommitdiff
path: root/cinderclient/v2/shell.py
diff options
context:
space:
mode:
authorliyingjun <liyingjun1988@gmail.com>2014-08-07 06:13:25 +0800
committerliyingjun <yingjun.li@kylin-cloud.com>2015-02-24 16:11:46 +0800
commitc01529fa538d28af3a9f0f7cdc1a96a9df5ed221 (patch)
treedbe5923558eb955cb8f47ee74a0520afa102c15b /cinderclient/v2/shell.py
parent9e94d814c6ae07c3d5e8242754aebcce150265cc (diff)
downloadpython-cinderclient-c01529fa538d28af3a9f0f7cdc1a96a9df5ed221.tar.gz
Add missing all-tenants option to transfer-list
cinder transfer-list is missing the --all-tenants option, which makes it inconsistent with 'cinder list'. Without this fix, when running as admin horizon will need to make multiple queries to cinder (one for each tenant present in the volume list) in order to display the transfers that exist for the volumes being shown. Change-Id: Ic4d72a54c450876ff24c64efd83678062c93a24e Closes-bug: 1351084
Diffstat (limited to 'cinderclient/v2/shell.py')
-rw-r--r--cinderclient/v2/shell.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py
index c656248..77d99a5 100644
--- a/cinderclient/v2/shell.py
+++ b/cinderclient/v2/shell.py
@@ -1270,10 +1270,27 @@ def do_transfer_accept(cs, args):
utils.print_dict(info)
+@utils.arg('--all-tenants',
+ dest='all_tenants',
+ metavar='<0|1>',
+ nargs='?',
+ type=int,
+ const=1,
+ default=0,
+ help='Shows details for all tenants. Admin only.')
+@utils.arg('--all_tenants',
+ nargs='?',
+ type=int,
+ const=1,
+ help=argparse.SUPPRESS)
@utils.service_type('volumev2')
def do_transfer_list(cs, args):
"""Lists all transfers."""
- transfers = cs.transfers.list()
+ all_tenants = int(os.environ.get("ALL_TENANTS", args.all_tenants))
+ search_opts = {
+ 'all_tenants': all_tenants,
+ }
+ transfers = cs.transfers.list(search_opts=search_opts)
columns = ['ID', 'Volume ID', 'Name']
utils.print_list(transfers, columns)