Fix type-delete to allow deletion by name and ID

This change addresses bug #1286314, fixing type deletion to allow
deletion by either volume type name or ID. The former implementation
only accepted the volume type ID. Help documentation is also updated
to reflect this change.

Change-Id: I0fc66b54a7bcfa4e00a4d136ac513fa40e628dd2
Closes-Bug: #1286314
DocImpact
This commit is contained in:
Peter Hamilton
2014-02-28 15:30:54 -05:00
parent ea8c9554c9
commit 3ec28c3309
4 changed files with 8 additions and 6 deletions

View File

@@ -579,11 +579,12 @@ def do_type_create(cs, args):
@utils.arg('id',
metavar='<id>',
help="Unique ID of the volume type to delete")
help="Name or ID of the volume type to delete")
@utils.service_type('volume')
def do_type_delete(cs, args):
"""Delete a specific volume type."""
cs.volume_types.delete(args.id)
volume_type = _find_volume_type(cs, args.id)
cs.volume_types.delete(volume_type)
@utils.arg('vtype',

View File

@@ -101,7 +101,7 @@ class VolumeTypeManager(base.ManagerWithFind):
"""
Delete a specific volume_type.
:param volume_type: The ID of the :class:`VolumeType` to get.
:param volume_type: The name or ID of the :class:`VolumeType` to get.
"""
self._delete("/types/%s" % base.getid(volume_type))

View File

@@ -637,11 +637,12 @@ def do_type_create(cs, args):
@utils.arg('id',
metavar='<id>',
help="Unique ID of the volume type to delete")
help="Name or ID of the volume type to delete")
@utils.service_type('volumev2')
def do_type_delete(cs, args):
"""Delete a specific volume type."""
cs.volume_types.delete(args.id)
volume_type = _find_volume_type(cs, args.id)
cs.volume_types.delete(volume_type)
@utils.arg('vtype',

View File

@@ -88,7 +88,7 @@ class VolumeTypeManager(base.ManagerWithFind):
def delete(self, volume_type):
"""Delete a specific volume_type.
:param volume_type: The ID of the :class:`VolumeType` to get.
:param volume_type: The name or ID of the :class:`VolumeType` to get.
"""
self._delete("/types/%s" % base.getid(volume_type))