diff options
| author | liyingjun <liyingjun1988@gmail.com> | 2014-06-25 04:47:25 +0800 |
|---|---|---|
| committer | liyingjun <liyingjun1988@gmail.com> | 2014-06-27 03:29:27 +0800 |
| commit | ae04b4b09982bf98ed963fb541da5f3bf73b9a17 (patch) | |
| tree | 9b94209c6e79bb2ed1302fc6e56286377c7057fd /cinderclient/v2/shell.py | |
| parent | 0c4010e7fbc9939905e8647afbe1358c384dc658 (diff) | |
| download | python-cinderclient-ae04b4b09982bf98ed963fb541da5f3bf73b9a17.tar.gz | |
Add tenant uuid when running cinder list --all-tenants
Add the tenant uuid to the output when running cinder list --all-tenants,
since this is an admin command any way, it would help to list the tenant
UUID so we do not have to run cinder show to see the tenant uuid when we
have further queries to run.
Change-Id: I661789e957fa00947c4d5595f7e0515c27963735
Closes-bug: 1333257
Diffstat (limited to 'cinderclient/v2/shell.py')
| -rw-r--r-- | cinderclient/v2/shell.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py index 4842709..84c140a 100644 --- a/cinderclient/v2/shell.py +++ b/cinderclient/v2/shell.py @@ -97,7 +97,8 @@ def _translate_keys(collection, convert): def _translate_volume_keys(collection): - convert = [('volumeType', 'volume_type')] + convert = [('volumeType', 'volume_type'), + ('os-vol-tenant-attr:tenant_id', 'tenant_id')] _translate_keys(collection, convert) @@ -177,8 +178,13 @@ def do_list(cs, args): servers = [s.get('server_id') for s in vol.attachments] setattr(vol, 'attached_to', ','.join(map(str, servers))) - utils.print_list(volumes, ['ID', 'Status', 'Name', - 'Size', 'Volume Type', 'Bootable', 'Attached to']) + if all_tenants: + key_list = ['ID', 'Tenant ID', 'Status', 'Name', + 'Size', 'Volume Type', 'Bootable', 'Attached to'] + else: + key_list = ['ID', 'Status', 'Name', + 'Size', 'Volume Type', 'Bootable', 'Attached to'] + utils.print_list(volumes, key_list) @utils.arg('volume', |
