Merge "fix use cinder "update_volume_type() got an unexpected keyword argument 'name' ""
This commit is contained in:
commit
1c470d56f4
@ -20,8 +20,7 @@
|
|||||||
- rally_openstack/task/cleanup/resources.py
|
- rally_openstack/task/cleanup/resources.py
|
||||||
- rally_openstack/task/scenarios/barbican
|
- rally_openstack/task/scenarios/barbican
|
||||||
- tests/ci/playbooks
|
- tests/ci/playbooks
|
||||||
- rally-task-cinder:
|
- rally-task-cinder
|
||||||
voting: false
|
|
||||||
- rally-task-designate:
|
- rally-task-designate:
|
||||||
files:
|
files:
|
||||||
- .zuul.d/zuul.yaml
|
- .zuul.d/zuul.yaml
|
||||||
@ -103,6 +102,7 @@
|
|||||||
- rally_openstack/task/cleanup/resources.py
|
- rally_openstack/task/cleanup/resources.py
|
||||||
- rally_openstack/task/scenarios/barbican
|
- rally_openstack/task/scenarios/barbican
|
||||||
- tests/ci/playbooks
|
- tests/ci/playbooks
|
||||||
|
- rally-task-cinder
|
||||||
#- rally-task-heat
|
#- rally-task-heat
|
||||||
- rally-task-ironic
|
- rally-task-ironic
|
||||||
- rally-task-keystone-glance-swift
|
- rally-task-keystone-glance-swift
|
||||||
|
@ -377,10 +377,10 @@ class BlockStorage(service.UnifiedService):
|
|||||||
|
|
||||||
:param volume_type: Volume type name or ID to add access for the given
|
:param volume_type: Volume type name or ID to add access for the given
|
||||||
project
|
project
|
||||||
:project: Project ID to add volume type access for
|
:param project: Project ID to add volume type access for
|
||||||
:return: An instance of cinderclient.apiclient.base.TupleWithMeta
|
:return: An instance of cinderclient.apiclient.base.TupleWithMeta
|
||||||
"""
|
"""
|
||||||
return self._impl.update_volume_type(
|
return self._impl.add_type_access(
|
||||||
volume_type=volume_type, project=project
|
volume_type=volume_type, project=project
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ class BlockStorage(service.UnifiedService):
|
|||||||
:param volume_type: Filter results by volume type name or ID
|
:param volume_type: Filter results by volume type name or ID
|
||||||
:return: VolumeTypeAccess of specific project
|
:return: VolumeTypeAccess of specific project
|
||||||
"""
|
"""
|
||||||
return self._impl.volume_type_access.list(volume_type)
|
return self._impl.list_type_access(volume_type)
|
||||||
|
|
||||||
@service.should_be_overridden
|
@service.should_be_overridden
|
||||||
def get_volume_type(self, volume_type):
|
def get_volume_type(self, volume_type):
|
||||||
|
@ -182,12 +182,11 @@ class CinderV2Service(service.Service, cinder_common.CinderMixin):
|
|||||||
|
|
||||||
:param volume_type: The ID or an instance of the :class:`VolumeType`
|
:param volume_type: The ID or an instance of the :class:`VolumeType`
|
||||||
to update.
|
to update.
|
||||||
:param name: if None, updates name by generating random name.
|
:param name: if None, name cannot be updated.
|
||||||
else updates name with provided name
|
else updates name with provided name
|
||||||
:param description: Description of the volume type.
|
:param description: Description of the volume type.
|
||||||
:rtype: :class:`VolumeType`
|
:rtype: :class:`VolumeType`
|
||||||
"""
|
"""
|
||||||
name = name or self.generate_random_name()
|
|
||||||
|
|
||||||
return self._get_client().volume_types.update(volume_type, name,
|
return self._get_client().volume_types.update(volume_type, name,
|
||||||
description, is_public)
|
description, is_public)
|
||||||
|
@ -178,20 +178,19 @@ class CinderV3Service(service.Service, cinder_common.CinderMixin):
|
|||||||
return self._get_client().volume_types.create(**kwargs)
|
return self._get_client().volume_types.create(**kwargs)
|
||||||
|
|
||||||
@atomic.action_timer("cinder_v3.update_volume_type")
|
@atomic.action_timer("cinder_v3.update_volume_type")
|
||||||
def update_volume_type(self, volume_type, update_name=False,
|
def update_volume_type(self, volume_type, name=None,
|
||||||
description=None, is_public=None):
|
description=None, is_public=None):
|
||||||
"""Update the name and/or description for a volume type.
|
"""Update the name and/or description for a volume type.
|
||||||
|
|
||||||
:param volume_type: The ID or a instance of the :class:`VolumeType`
|
:param volume_type: The ID or a instance of the :class:`VolumeType`
|
||||||
to update.
|
to update.
|
||||||
:param update_name: if True, can update name by generating random name.
|
:param name: if None, name cannot be updated.
|
||||||
if False, don't update name.
|
else updates name with provided name
|
||||||
:param description: Description of the volume type.
|
:param description: Description of the volume type.
|
||||||
|
:param is_public:
|
||||||
:rtype: :class:`VolumeType`
|
:rtype: :class:`VolumeType`
|
||||||
"""
|
"""
|
||||||
name = None
|
|
||||||
if update_name:
|
|
||||||
name = self.generate_random_name()
|
|
||||||
return self._get_client().volume_types.update(
|
return self._get_client().volume_types.update(
|
||||||
volume_type=volume_type, name=name, description=description,
|
volume_type=volume_type, name=name, description=description,
|
||||||
is_public=is_public)
|
is_public=is_public)
|
||||||
@ -202,7 +201,7 @@ class CinderV3Service(service.Service, cinder_common.CinderMixin):
|
|||||||
|
|
||||||
:param volume_type: Volume type name or ID to add access for the given
|
:param volume_type: Volume type name or ID to add access for the given
|
||||||
project
|
project
|
||||||
:project: Project ID to add volume type access for
|
:param project: Project ID to add volume type access for
|
||||||
:return: An instance of cinderclient.apiclient.base.TupleWithMeta
|
:return: An instance of cinderclient.apiclient.base.TupleWithMeta
|
||||||
"""
|
"""
|
||||||
return self._get_client().volume_type_access.add_project_access(
|
return self._get_client().volume_type_access.add_project_access(
|
||||||
|
@ -81,18 +81,26 @@ class CreateAndUpdateVolumeType(cinder_utils.CinderBasic):
|
|||||||
:param is_public: Volume type visibility
|
:param is_public: Volume type visibility
|
||||||
:param update_name: if True, can update name by generating random name.
|
:param update_name: if True, can update name by generating random name.
|
||||||
if False, don't update name.
|
if False, don't update name.
|
||||||
:param update_description: update Description of the volume type
|
:param update_description: a description to set while update
|
||||||
:param update_is_public: update Volume type visibility
|
:param update_is_public: update Volume type visibility
|
||||||
"""
|
"""
|
||||||
volume_type = self.admin_cinder.create_volume_type(
|
volume_type = self.admin_cinder.create_volume_type(
|
||||||
description=description,
|
description=description,
|
||||||
is_public=is_public)
|
is_public=is_public)
|
||||||
|
|
||||||
|
updated_name = self.generate_random_name() if update_name else None
|
||||||
|
if not update_name and not update_description and not update_is_public:
|
||||||
|
LOG.warning("Something should be updated.")
|
||||||
|
# transmit at least some value to update api call
|
||||||
|
updated_name = volume_type.name
|
||||||
|
|
||||||
|
updated_is_public = not is_public if update_is_public else None
|
||||||
|
|
||||||
self.admin_cinder.update_volume_type(
|
self.admin_cinder.update_volume_type(
|
||||||
volume_type,
|
volume_type,
|
||||||
name=volume_type.name if not update_name else False,
|
name=updated_name,
|
||||||
description=update_description,
|
description=update_description,
|
||||||
is_public=update_is_public)
|
is_public=updated_is_public)
|
||||||
|
|
||||||
|
|
||||||
@validation.add("required_services", services=[consts.Service.CINDER])
|
@validation.add("required_services", services=[consts.Service.CINDER])
|
||||||
|
@ -235,10 +235,12 @@ class CinderV2ServiceTestCase(test.ScenarioTestCase):
|
|||||||
return_value=name)
|
return_value=name)
|
||||||
description = "test update"
|
description = "test update"
|
||||||
|
|
||||||
result = self.service.update_volume_type(volume_type,
|
result = self.service.update_volume_type(
|
||||||
description=description,
|
volume_type,
|
||||||
name=None,
|
description=description,
|
||||||
is_public=None)
|
name=self.service.generate_random_name(),
|
||||||
|
is_public=None
|
||||||
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.cinder.volume_types.update.return_value,
|
self.cinder.volume_types.update.return_value,
|
||||||
result)
|
result)
|
||||||
|
@ -240,10 +240,12 @@ class CinderV3ServiceTestCase(test.ScenarioTestCase):
|
|||||||
return_value=name)
|
return_value=name)
|
||||||
description = "test update"
|
description = "test update"
|
||||||
|
|
||||||
result = self.service.update_volume_type(volume_type,
|
result = self.service.update_volume_type(
|
||||||
description=description,
|
volume_type,
|
||||||
update_name=True,
|
description=description,
|
||||||
is_public=None)
|
name=self.service.generate_random_name(),
|
||||||
|
is_public=None
|
||||||
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.cinder.volume_types.update.return_value,
|
self.cinder.volume_types.update.return_value,
|
||||||
result)
|
result)
|
||||||
|
@ -169,9 +169,12 @@ class CinderVolumeTypesTestCase(test.ScenarioTestCase):
|
|||||||
description=create_description,
|
description=create_description,
|
||||||
is_public=True)
|
is_public=True)
|
||||||
mock_service.update_volume_type.assert_called_once_with(
|
mock_service.update_volume_type.assert_called_once_with(
|
||||||
fake_type, name="any",
|
fake_type,
|
||||||
description=update_description,
|
description=update_description,
|
||||||
is_public=None)
|
# update_is_public and update_name are not specified, so should
|
||||||
|
# not be used
|
||||||
|
is_public=None, name=None
|
||||||
|
)
|
||||||
|
|
||||||
def test_create_volume_type_and_encryption_type(self):
|
def test_create_volume_type_and_encryption_type(self):
|
||||||
mock_service = self.mock_cinder.return_value
|
mock_service = self.mock_cinder.return_value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user