summaryrefslogtreecommitdiff
path: root/cinderclient/v3
diff options
context:
space:
mode:
authorGorka Eguileor <geguileo@redhat.com>2021-04-21 16:01:11 +0200
committerBrian Rosmaita <rosmaita.fossdev@gmail.com>2021-08-25 17:17:46 -0400
commitf94908008e7432678f89c58e7e61773e71c2acf5 (patch)
tree4588f364ae1609c2ac782cd0a6a49bc00af1767b /cinderclient/v3
parentfe1a377527ae8477246571eaa2a785014f746af5 (diff)
downloadpython-cinderclient-f94908008e7432678f89c58e7e61773e71c2acf5.tar.gz
Add consumes quota field support
Cinder microversion v3.65 adds consumes_quota key to volume and snapshots as a way to differentiate between use generated resources and temporary ones. This patch adds support for this microversion and presents the consumes_quota field when the server sends it (which only happens when we request this microversion). Change-Id: I524490aa988fa4d654bfa8050d89cf99ce50bb4b Depends-On: I655a47fc75ddc11caf1defe984d9a66a9ad5a2e7 Implements: blueprint temp-resources
Diffstat (limited to 'cinderclient/v3')
-rw-r--r--cinderclient/v3/shell.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py
index 7ffba81..195d859 100644
--- a/cinderclient/v3/shell.py
+++ b/cinderclient/v3/shell.py
@@ -507,8 +507,8 @@ def do_list(cs, args):
[x.title().strip() for x in field_titles]) if k != 'Id']
key_list.extend(unique_titles)
else:
- key_list = ['ID', 'Status', 'Name', 'Size', 'Volume Type',
- 'Bootable', 'Attached to']
+ key_list = ['ID', 'Status', 'Name', 'Size', 'Consumes Quota',
+ 'Volume Type', 'Bootable', 'Attached to']
# If all_tenants is specified, print
# Tenant ID as well.
if search_opts['all_tenants']:
@@ -2173,15 +2173,14 @@ def do_snapshot_list(cs, args):
shell_utils.translate_volume_snapshot_keys(snapshots)
sortby_index = None if args.sort else 0
- if cs.api_version >= api_versions.APIVersion("3.41"):
- utils.print_list(snapshots,
- ['ID', 'Volume ID', 'Status',
- 'Name', 'Size', 'User ID'],
- sortby_index=sortby_index)
- else:
- utils.print_list(snapshots,
- ['ID', 'Volume ID', 'Status', 'Name', 'Size'],
- sortby_index=sortby_index)
+ # It's the server's responsibility to return the appropriate fields for the
+ # requested microversion, we present all known fields and skip those that
+ # are missing.
+ utils.print_list(snapshots,
+ ['ID', 'Volume ID', 'Status', 'Name', 'Size',
+ 'Consumes Quota', 'User ID'],
+ exclude_unavailable=True,
+ sortby_index=sortby_index)
if show_count:
print("Snapshot in total: %s" % total_count)