summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordanP <jordan.pittier@cloudwatt.com>2014-08-05 11:28:09 +0200
committerJordanP <jordan.pittier@cloudwatt.com>2014-08-05 11:28:09 +0200
commit6565e275fdba7edc0a63330d0be898923f0f5f20 (patch)
tree97201de3684a073f4867353b07349c8bed73cb5c
parent0c4010e7fbc9939905e8647afbe1358c384dc658 (diff)
downloadpython-cinderclient-6565e275fdba7edc0a63330d0be898923f0f5f20.tar.gz
Avoid extra lookups in extra-specs-list
extra-specs-list used to use the extra-specs cinder extension to get information on volume type extra specs. This information is publicly available through the volume-type API [1] thus we can avoid the extra-lookups of querying the extra-specs extension. As the extra-spec info is publicly available, remove the part of the docstring of cinder extra-specs-list that says 'admin only'. [1] http://docs.openstack.org/api/openstack-block-storage/2.0/content/GET_getVolumeTypes__v2__tenant_id__types_Volume_Types.html Change-Id: I9a8256a044511ac5233d8170fc57118ccaa1e217 Closes-Bug: 1343876
-rw-r--r--cinderclient/v1/shell.py16
-rw-r--r--cinderclient/v2/shell.py16
2 files changed, 4 insertions, 28 deletions
diff --git a/cinderclient/v1/shell.py b/cinderclient/v1/shell.py
index 47e0a57..c806327 100644
--- a/cinderclient/v1/shell.py
+++ b/cinderclient/v1/shell.py
@@ -573,11 +573,6 @@ def _print_volume_type_list(vtypes):
utils.print_list(vtypes, ['ID', 'Name'])
-def _print_type_and_extra_specs_list(vtypes):
- formatters = {'extra_specs': _print_type_extra_specs}
- utils.print_list(vtypes, ['ID', 'Name', 'extra_specs'], formatters)
-
-
@utils.service_type('volume')
def do_type_list(cs, args):
"""Lists available 'volume types'."""
@@ -587,9 +582,9 @@ def do_type_list(cs, args):
@utils.service_type('volume')
def do_extra_specs_list(cs, args):
- """Lists current volume types and extra specs. Admin only."""
+ """Lists current volume types and extra specs."""
vtypes = cs.volume_types.list()
- _print_type_and_extra_specs_list(vtypes)
+ utils.print_list(vtypes, ['ID', 'Name', 'extra_specs'])
@utils.arg('name',
@@ -810,13 +805,6 @@ def do_rate_limits(cs, args):
utils.print_list(limits, columns)
-def _print_type_extra_specs(vol_type):
- try:
- return vol_type.get_keys()
- except exceptions.NotFound:
- return "N/A"
-
-
def _find_volume_type(cs, vtype):
"""Gets a volume type by name or ID."""
return utils.find_resource(cs.volume_types, vtype)
diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py
index 4842709..6af0829 100644
--- a/cinderclient/v2/shell.py
+++ b/cinderclient/v2/shell.py
@@ -621,11 +621,6 @@ def _print_volume_type_list(vtypes):
utils.print_list(vtypes, ['ID', 'Name'])
-def _print_type_and_extra_specs_list(vtypes):
- formatters = {'extra_specs': _print_type_extra_specs}
- utils.print_list(vtypes, ['ID', 'Name', 'extra_specs'], formatters)
-
-
@utils.service_type('volumev2')
def do_type_list(cs, args):
"""Lists available 'volume types'."""
@@ -635,9 +630,9 @@ def do_type_list(cs, args):
@utils.service_type('volumev2')
def do_extra_specs_list(cs, args):
- """Lists current volume types and extra specs. Admin only."""
+ """Lists current volume types and extra specs."""
vtypes = cs.volume_types.list()
- _print_type_and_extra_specs_list(vtypes)
+ utils.print_list(vtypes, ['ID', 'Name', 'extra_specs'])
@utils.arg('name',
@@ -862,13 +857,6 @@ def do_rate_limits(cs, args):
utils.print_list(limits, columns)
-def _print_type_extra_specs(vol_type):
- try:
- return vol_type.get_keys()
- except exceptions.NotFound:
- return "N/A"
-
-
def _find_volume_type(cs, vtype):
"""Gets a volume type by name or ID."""
return utils.find_resource(cs.volume_types, vtype)