Remove extra-specs from types-list command output

type-list was including the extra-specs info in it's response,
however extra-specs are admin accessible only. As a result only admin
users could run type-list which is not what we want.

Add a seperate admin only call to provide volume-types with associated
extra-specs info (extra-specs-list).

Change-Id: I2a716cd7076fb17fd5f2ceb94363eef0009e9bce
This commit is contained in:
John Griffith 2012-10-31 18:10:54 -06:00
parent 92bd08b9e1
commit a8be1b2a20

@ -379,7 +379,10 @@ def do_snapshot_rename(cs, args):
def _print_volume_type_list(vtypes):
#_translate_type_keys(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)
@ -391,6 +394,13 @@ def do_type_list(cs, args):
_print_volume_type_list(vtypes)
@utils.service_type('volume')
def do_extra_specs_list(cs, args):
"""Print a list of current 'volume types and extra specs' (Admin Only)."""
vtypes = cs.volume_types.list()
_print_type_and_extra_specs_list(vtypes)
@utils.arg('name',
metavar='<name>',
help="Name of the new volume type")