Docs cleanup: volume type
Clean up volume type command help, add volume type show to doc, sort command classes in v1/volume_type.py. Change-Id: I1f8e5c047d9c08f5704fc23cfb694f23d32e3caf
This commit is contained in:
parent
5f55e99d46
commit
b4402a0468
@ -20,7 +20,7 @@ Create new volume type
|
||||
|
||||
.. option:: --description <description>
|
||||
|
||||
New volume type description
|
||||
Volume type description
|
||||
|
||||
.. versionadded:: 2
|
||||
|
||||
@ -40,9 +40,10 @@ Create new volume type
|
||||
|
||||
Set a property on this volume type (repeat option to set multiple properties)
|
||||
|
||||
.. _volume_type_create-name:
|
||||
.. describe:: <name>
|
||||
|
||||
New volume type name
|
||||
Volume type name
|
||||
|
||||
volume type delete
|
||||
------------------
|
||||
@ -55,6 +56,7 @@ Delete volume type
|
||||
os volume type delete
|
||||
<volume-type>
|
||||
|
||||
.. _volume_type_delete-volume-type:
|
||||
.. describe:: <volume-type>
|
||||
|
||||
Volume type to delete (name or ID)
|
||||
@ -102,12 +104,30 @@ Set volume type properties
|
||||
|
||||
.. option:: --property <key=value>
|
||||
|
||||
Property to add or modify for this volume type (repeat option to set multiple properties)
|
||||
Set a property on this volume type (repeat option to set multiple properties)
|
||||
|
||||
.. _volume_type_set-volume-type:
|
||||
.. describe:: <volume-type>
|
||||
|
||||
Volume type to modify (name or ID)
|
||||
|
||||
volume type show
|
||||
----------------
|
||||
|
||||
Display volume type details
|
||||
|
||||
|
||||
.. program:: volume type show
|
||||
.. code:: bash
|
||||
|
||||
os volume type show
|
||||
<volume-type>
|
||||
|
||||
.. _volume_type_show-volume-type:
|
||||
.. describe:: <volume-type>
|
||||
|
||||
Volume type to display (name or ID)
|
||||
|
||||
volume type unset
|
||||
-----------------
|
||||
|
||||
@ -124,6 +144,7 @@ Unset volume type properties
|
||||
|
||||
Property to remove from volume type (repeat option to remove multiple properties)
|
||||
|
||||
.. _volume_type_unset-volume-type:
|
||||
.. describe:: <volume-type>
|
||||
|
||||
Volume type to modify (name or ID)
|
||||
|
@ -30,13 +30,13 @@ class CreateVolumeType(command.ShowOne):
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<name>',
|
||||
help='New volume type name',
|
||||
help='Volume type name',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--property',
|
||||
metavar='<key=value>',
|
||||
action=parseractions.KeyValueAction,
|
||||
help='Property to add for this volume type '
|
||||
help='Set a property on this volume type '
|
||||
'(repeat option to set multiple properties)',
|
||||
)
|
||||
return parser
|
||||
@ -114,7 +114,7 @@ class SetVolumeType(command.Command):
|
||||
'--property',
|
||||
metavar='<key=value>',
|
||||
action=parseractions.KeyValueAction,
|
||||
help='Property to add or modify for this volume type '
|
||||
help='Set a property on this volume type '
|
||||
'(repeat option to set multiple properties)',
|
||||
)
|
||||
return parser
|
||||
@ -128,40 +128,6 @@ class SetVolumeType(command.Command):
|
||||
volume_type.set_keys(parsed_args.property)
|
||||
|
||||
|
||||
class UnsetVolumeType(command.Command):
|
||||
"""Unset volume type properties"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetVolumeType, self).get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'volume_type',
|
||||
metavar='<volume-type>',
|
||||
help='Volume type to modify (name or ID)',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--property',
|
||||
metavar='<key>',
|
||||
action='append',
|
||||
default=[],
|
||||
help='Property to remove from volume type '
|
||||
'(repeat option to remove multiple properties)',
|
||||
required=True,
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
volume_client = self.app.client_manager.volume
|
||||
volume_type = utils.find_resource(
|
||||
volume_client.volume_types,
|
||||
parsed_args.volume_type,
|
||||
)
|
||||
|
||||
if parsed_args.property:
|
||||
volume_type.unset_keys(parsed_args.property)
|
||||
else:
|
||||
self.app.log.error("No changes requested\n")
|
||||
|
||||
|
||||
class ShowVolumeType(command.ShowOne):
|
||||
"""Display volume type details"""
|
||||
|
||||
@ -181,3 +147,37 @@ class ShowVolumeType(command.ShowOne):
|
||||
properties = utils.format_dict(volume_type._info.pop('extra_specs'))
|
||||
volume_type._info.update({'properties': properties})
|
||||
return zip(*sorted(six.iteritems(volume_type._info)))
|
||||
|
||||
|
||||
class UnsetVolumeType(command.Command):
|
||||
"""Unset volume type properties"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetVolumeType, self).get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'volume_type',
|
||||
metavar='<volume-type>',
|
||||
help='Volume type to modify (name or ID)',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--property',
|
||||
metavar='<key>',
|
||||
action='append',
|
||||
default=[],
|
||||
help='Remove a property from this volume type '
|
||||
'(repeat option to remove multiple properties)',
|
||||
required=True,
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
volume_client = self.app.client_manager.volume
|
||||
volume_type = utils.find_resource(
|
||||
volume_client.volume_types,
|
||||
parsed_args.volume_type,
|
||||
)
|
||||
|
||||
if parsed_args.property:
|
||||
volume_type.unset_keys(parsed_args.property)
|
||||
else:
|
||||
self.app.log.error("No changes requested\n")
|
||||
|
@ -29,12 +29,12 @@ class CreateVolumeType(command.ShowOne):
|
||||
parser.add_argument(
|
||||
"name",
|
||||
metavar="<name>",
|
||||
help="New volume type name"
|
||||
help="Volume type name",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--description",
|
||||
metavar="<description>",
|
||||
help="New volume type description",
|
||||
help="Volume type description",
|
||||
)
|
||||
public_group = parser.add_mutually_exclusive_group()
|
||||
public_group.add_argument(
|
||||
@ -55,7 +55,7 @@ class CreateVolumeType(command.ShowOne):
|
||||
'--property',
|
||||
metavar='<key=value>',
|
||||
action=parseractions.KeyValueAction,
|
||||
help='Property to add for this volume type'
|
||||
help='Set a property on this volume type'
|
||||
'(repeat option to set multiple properties)',
|
||||
)
|
||||
return parser
|
||||
@ -153,7 +153,7 @@ class SetVolumeType(command.Command):
|
||||
'--property',
|
||||
metavar='<key=value>',
|
||||
action=parseractions.KeyValueAction,
|
||||
help='Property to add or modify for this volume type '
|
||||
help='Set a property on this volume type '
|
||||
'(repeat option to set multiple properties)',
|
||||
)
|
||||
return parser
|
||||
@ -221,7 +221,7 @@ class UnsetVolumeType(command.Command):
|
||||
metavar='<key>',
|
||||
default=[],
|
||||
required=True,
|
||||
help='Property to remove from volume type '
|
||||
help='Remove a property from this volume type '
|
||||
'(repeat option to remove multiple properties)',
|
||||
)
|
||||
return parser
|
||||
|
Loading…
x
Reference in New Issue
Block a user