summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-08-23 15:27:05 +0000
committerGerrit Code Review <review@openstack.org>2014-08-23 15:27:05 +0000
commit0c5f0a92b4c82adc16031c56f2f437871c2ae65b (patch)
tree2da9830167e2b1cee9aca6b8fe268446311b8f1f
parent09422b600ed797b9dcc58247d0f8a695843c0096 (diff)
parent6565e275fdba7edc0a63330d0be898923f0f5f20 (diff)
downloadpython-cinderclient-0c5f0a92b4c82adc16031c56f2f437871c2ae65b.tar.gz
Merge "Avoid extra lookups in extra-specs-list"
-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 7ed30ac..4526a4e 100644
--- a/cinderclient/v1/shell.py
+++ b/cinderclient/v1/shell.py
@@ -575,11 +575,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'."""
@@ -589,9 +584,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',
@@ -812,13 +807,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 471240d..6fed443 100644
--- a/cinderclient/v2/shell.py
+++ b/cinderclient/v2/shell.py
@@ -657,11 +657,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'."""
@@ -671,9 +666,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',
@@ -898,13 +893,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)