Update to change name for volume type client
This continues to update the name for volume type: * Update a client method for volume type. update: to update an existing volume type's name * Update a command-line operations. type-update: (adminitrator only) to update a volume type name The corresponding cinder APIs change to update volume type name: https://review.openstack.org/#/c/140906/ Implements: blueprint volume-type-description Change-Id: I66adb7fd2a433e7443cb609046f64dbab3d9d4c7
This commit is contained in:
parent
7c68f6f6df
commit
425565b79c
cinderclient
@ -54,8 +54,11 @@ class TypesTest(utils.TestCase):
|
||||
self.assertIsInstance(t, volume_types.VolumeType)
|
||||
|
||||
def test_update(self):
|
||||
t = cs.volume_types.update('1', 'test_desc_1')
|
||||
cs.assert_called('PUT', '/types/1')
|
||||
t = cs.volume_types.update('1', 'test_type_1', 'test_desc_1')
|
||||
cs.assert_called('PUT',
|
||||
'/types/1',
|
||||
{'volume_type': {'name': 'test_type_1',
|
||||
'description': 'test_desc_1'}})
|
||||
self.assertIsInstance(t, volume_types.VolumeType)
|
||||
|
||||
def test_get(self):
|
||||
|
@ -752,13 +752,16 @@ def do_type_default(cs, args):
|
||||
@utils.arg('id',
|
||||
metavar='<id>',
|
||||
help="ID of the volume type.")
|
||||
@utils.arg('description',
|
||||
@utils.arg('--name',
|
||||
metavar='<name>',
|
||||
help="Name of the volume type.")
|
||||
@utils.arg('--description',
|
||||
metavar='<description>',
|
||||
help="Description of the volume type.")
|
||||
@utils.service_type('volumev2')
|
||||
def do_type_update(cs, args):
|
||||
"""Updates volume type description."""
|
||||
vtype = cs.volume_types.update(args.id, args.description)
|
||||
"""Updates volume type name and/or description."""
|
||||
vtype = cs.volume_types.update(args.id, args.name, args.description)
|
||||
_print_volume_type_list([vtype])
|
||||
|
||||
|
||||
|
@ -128,16 +128,18 @@ class VolumeTypeManager(base.ManagerWithFind):
|
||||
|
||||
return self._create("/types", body, "volume_type")
|
||||
|
||||
def update(self, volume_type, description):
|
||||
"""Update the description for a volume type.
|
||||
def update(self, volume_type, name=None, description=None):
|
||||
"""Update the name and/or description for a volume type.
|
||||
|
||||
:param volume_type: The ID of the :class:`VolumeType` to update.
|
||||
:param name: Descriptive name of the volume type.
|
||||
:param description: Description of the the volume type.
|
||||
:rtype: :class:`VolumeType`
|
||||
"""
|
||||
|
||||
body = {
|
||||
"volume_type": {
|
||||
"name": name,
|
||||
"description": description
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user