[CI] Fix Cinder update volume type scenario & service
Now it's required to provide name (non backward compatible change from Cinder team) this patch address the problem and unblocks our gate Change-Id: I71874c7789c55d655262f131ace4c8eacc835bd8
This commit is contained in:
parent
a3d120e5c1
commit
c2b57d6a63
@ -93,7 +93,7 @@ class CreateAndUpdateVolumeType(scenario.OpenStackScenario):
|
||||
|
||||
service.update_volume_type(
|
||||
volume_type,
|
||||
update_name=update_name,
|
||||
name=volume_type.name if not update_name else False,
|
||||
description=update_description,
|
||||
is_public=update_is_public)
|
||||
|
||||
@ -127,10 +127,10 @@ class CreateAndListVolumeTypes(cinder_utils.CinderBasic):
|
||||
@validation.add("required_params", params=[("create_specs", "provider")])
|
||||
@validation.add("required_services", services=[consts.Service.CINDER])
|
||||
@validation.add("required_platform", platform="openstack", admin=True)
|
||||
@scenario.configure(context={"admin_cleanup@openstack": ["cinder"]},
|
||||
name="CinderVolumeTypes.create_volume_type"
|
||||
"_and_encryption_type",
|
||||
platform="openstack")
|
||||
@scenario.configure(
|
||||
context={"admin_cleanup@openstack": ["cinder"]},
|
||||
name="CinderVolumeTypes.create_volume_type_and_encryption_type",
|
||||
platform="openstack")
|
||||
class CreateVolumeTypeAndEncryptionType(cinder_utils.CinderBasic):
|
||||
|
||||
def run(self, create_specs=None, provider=None, cipher=None,
|
||||
@ -175,10 +175,10 @@ class CreateVolumeTypeAndEncryptionType(cinder_utils.CinderBasic):
|
||||
@validation.add("required_params", params=[("create_specs", "provider")])
|
||||
@validation.add("required_services", services=[consts.Service.CINDER])
|
||||
@validation.add("required_platform", platform="openstack", admin=True)
|
||||
@scenario.configure(context={"admin_cleanup@openstack": ["cinder"]},
|
||||
name="CinderVolumeTypes.create_and_list_"
|
||||
"encryption_type",
|
||||
platform="openstack")
|
||||
@scenario.configure(
|
||||
context={"admin_cleanup@openstack": ["cinder"]},
|
||||
name="CinderVolumeTypes.create_and_list_encryption_type",
|
||||
platform="openstack")
|
||||
class CreateAndListEncryptionType(cinder_utils.CinderBasic):
|
||||
|
||||
def run(self, create_specs=None, provider=None, cipher=None,
|
||||
@ -243,10 +243,10 @@ class CreateAndSetVolumeTypeKeys(cinder_utils.CinderBasic):
|
||||
@validation.add("required_services", services=[consts.Service.CINDER])
|
||||
@validation.add("required_contexts", contexts="volume_types")
|
||||
@validation.add("required_platform", platform="openstack", admin=True)
|
||||
@scenario.configure(context={"admin_cleanup@openstack": ["cinder"]},
|
||||
name="CinderVolumeTypes.create_get_and_delete_"
|
||||
"encryption_type",
|
||||
platform="openstack")
|
||||
@scenario.configure(
|
||||
context={"admin_cleanup@openstack": ["cinder"]},
|
||||
name="CinderVolumeTypes.create_get_and_delete_encryption_type",
|
||||
platform="openstack")
|
||||
class CreateGetAndDeleteEncryptionType(cinder_utils.CinderBasic):
|
||||
|
||||
def run(self, provider=None, cipher=None,
|
||||
@ -284,10 +284,10 @@ class CreateGetAndDeleteEncryptionType(cinder_utils.CinderBasic):
|
||||
@validation.add("required_contexts", contexts="volume_types")
|
||||
@validation.add("required_params", params=[("create_specs", "provider")])
|
||||
@validation.add("required_platform", platform="openstack", admin=True)
|
||||
@scenario.configure(context={"admin_cleanup@openstack": ["cinder"]},
|
||||
name="CinderVolumeTypes.create_and_delete_"
|
||||
"encryption_type",
|
||||
platform="openstack")
|
||||
@scenario.configure(
|
||||
context={"admin_cleanup@openstack": ["cinder"]},
|
||||
name="CinderVolumeTypes.create_and_delete_encryption_type",
|
||||
platform="openstack")
|
||||
class CreateAndDeleteEncryptionType(cinder_utils.CinderBasic):
|
||||
|
||||
def run(self, create_specs=None, provider=None, cipher=None,
|
||||
@ -381,10 +381,10 @@ class CreateAndUpdateEncryptionType(cinder_utils.CinderBasic):
|
||||
@validation.add("required_platform", platform="openstack", admin=True)
|
||||
@validation.add("required_api_versions", component="cinder", versions=["2"])
|
||||
@validation.add("required_services", services=consts.Service.CINDER)
|
||||
@scenario.configure(context={"admin_cleanup@openstack": ["cinder"]},
|
||||
name="CinderVolumeTypes.create_volume_type_"
|
||||
"add_and_list_type_access",
|
||||
platform="openstack")
|
||||
@scenario.configure(
|
||||
context={"admin_cleanup@openstack": ["cinder"]},
|
||||
name="CinderVolumeTypes.create_volume_type_add_and_list_type_access",
|
||||
platform="openstack")
|
||||
class CreateVolumeTypeAddAndListTypeAccess(scenario.OpenStackScenario):
|
||||
|
||||
def run(self, description=None, is_public=False):
|
||||
|
@ -176,20 +176,18 @@ class CinderV2Service(service.Service, cinder_common.CinderMixin):
|
||||
return self._get_client().volume_types.create(**kwargs)
|
||||
|
||||
@atomic.action_timer("cinder_v2.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):
|
||||
"""Update the name and/or description for a volume type.
|
||||
|
||||
:param volume_type: The ID or a instance of the :class:`VolumeType`
|
||||
to update.
|
||||
:param update_name: if True, can update name by generating random name.
|
||||
if False, don't update name.
|
||||
:param name: if None, updates name by generating random name.
|
||||
else updates name with provided name
|
||||
:param description: Description of the the volume type.
|
||||
:rtype: :class:`VolumeType`
|
||||
"""
|
||||
name = None
|
||||
if update_name:
|
||||
name = self.generate_random_name()
|
||||
name = name or self.generate_random_name()
|
||||
|
||||
return self._get_client().volume_types.update(volume_type, name,
|
||||
description, is_public)
|
||||
|
@ -162,7 +162,8 @@ class CinderVolumeTypesTestCase(test.ScenarioTestCase):
|
||||
def test_create_and_update_volume_type(self, mock_update_volume_type,
|
||||
mock_create_volume_type):
|
||||
scenario = volume_types.CreateAndUpdateVolumeType(self._get_context())
|
||||
fake_type = mock.Mock()
|
||||
fake_type = mock.MagicMock()
|
||||
fake_type.name = "any"
|
||||
create_description = "test create"
|
||||
update_description = "test update"
|
||||
mock_create_volume_type.return_value = fake_type
|
||||
@ -173,7 +174,7 @@ class CinderVolumeTypesTestCase(test.ScenarioTestCase):
|
||||
description=create_description,
|
||||
is_public=True)
|
||||
mock_update_volume_type.assert_called_once_with(
|
||||
fake_type, update_name=False,
|
||||
fake_type, name="any",
|
||||
description=update_description,
|
||||
is_public=None)
|
||||
|
||||
|
@ -231,7 +231,7 @@ class CinderV2ServiceTestCase(test.ScenarioTestCase):
|
||||
|
||||
result = self.service.update_volume_type(volume_type,
|
||||
description=description,
|
||||
update_name=True,
|
||||
name=None,
|
||||
is_public=None)
|
||||
self.assertEqual(
|
||||
self.cinder.volume_types.update.return_value,
|
||||
|
Loading…
Reference in New Issue
Block a user