diff --git a/rally-jobs/cinder.yaml b/rally-jobs/cinder.yaml index 523fe0eb..cabfb281 100755 --- a/rally-jobs/cinder.yaml +++ b/rally-jobs/cinder.yaml @@ -869,7 +869,8 @@ CinderVolumeTypes.create_and_get_volume_type: - - args: {} + args: + description: "rally tests creating types" runner: type: "constant" times: 5 @@ -884,7 +885,8 @@ CinderVolumeTypes.create_and_delete_volume_type: - - args: {} + args: + description: "rally tests creating types" runner: type: "constant" times: 5 @@ -965,6 +967,7 @@ CinderVolumeTypes.create_volume_type_and_encryption_type: - args: + description: "rally tests creating types" provider: "LuksEncryptor" cipher: "aes-xts-plain64" key_size: 512 @@ -1051,6 +1054,7 @@ CinderVolumeTypes.create_and_set_volume_type_keys: - args: + description: "rally tests creating types" volume_type_key: volume_backend_name: "LVM_iSCSI" runner: diff --git a/rally/plugins/openstack/scenarios/cinder/volume_types.py b/rally/plugins/openstack/scenarios/cinder/volume_types.py index 19073cfd..2d495d28 100644 --- a/rally/plugins/openstack/scenarios/cinder/volume_types.py +++ b/rally/plugins/openstack/scenarios/cinder/volume_types.py @@ -27,36 +27,38 @@ LOG = logging.getLogger(__name__) @validation.add("required_services", services=[consts.Service.CINDER]) -@validation.add("restricted_parameters", param_names="name") @validation.add("required_platform", platform="openstack", admin=True) @scenario.configure(context={"admin_cleanup": ["cinder"]}, name="CinderVolumeTypes.create_and_delete_volume_type") class CreateAndDeleteVolumeType(cinder_utils.CinderBasic): - def run(self, **kwargs): + def run(self, description=None, is_public=True): """Create and delete a volume Type. - :param kwargs: Optional parameters used during volume - type creation. + :param description: Description of the volume type + :param is_public: Volume type visibility """ - volume_type = self.admin_cinder.create_volume_type(**kwargs) + volume_type = self.admin_cinder.create_volume_type( + description=description, + is_public=is_public) self.admin_cinder.delete_volume_type(volume_type) @validation.add("required_services", services=[consts.Service.CINDER]) -@validation.add("restricted_parameters", param_names="name") @validation.add("required_platform", platform="openstack", admin=True) @scenario.configure(context={"admin_cleanup": ["cinder"]}, name="CinderVolumeTypes.create_and_get_volume_type") class CreateAndGetVolumeType(cinder_utils.CinderBasic): - def run(self, **kwargs): + def run(self, description=None, is_public=True): """Create a volume Type, then get the details of the type. - :param kwargs: Optional parameters used during volume - type creation. + :param description: Description of the volume type + :param is_public: Volume type visibility """ - volume_type = self.admin_cinder.create_volume_type(**kwargs) + volume_type = self.admin_cinder.create_volume_type( + description=description, + is_public=is_public) self.admin_cinder.get_volume_type(volume_type) @@ -118,7 +120,6 @@ class CreateAndListVolumeTypes(cinder_utils.CinderBasic): err_msg=msg) -@validation.add("restricted_parameters", param_names="name") @validation.add("required_params", params=[("create_specs", "provider")]) @validation.add("required_services", services=[consts.Service.CINDER]) @validation.add("required_platform", platform="openstack", admin=True) @@ -128,7 +129,8 @@ class CreateAndListVolumeTypes(cinder_utils.CinderBasic): class CreateVolumeTypeAndEncryptionType(cinder_utils.CinderBasic): def run(self, create_specs=None, provider=None, cipher=None, - key_size=None, control_location="front-end", **kwargs): + key_size=None, control_location="front-end", description=None, + is_public=True): """Create encryption type This scenario first creates a volume type, then creates an encryption @@ -143,10 +145,12 @@ class CreateVolumeTypeAndEncryptionType(cinder_utils.CinderBasic): :param control_location: Notional service where encryption is performed. Valid values are "front-end" or "back-end." - :param kwargs: Optional parameters used during volume - type creation. + :param description: Description of the volume type + :param is_public: Volume type visibility """ - volume_type = self.admin_cinder.create_volume_type(**kwargs) + volume_type = self.admin_cinder.create_volume_type( + description=description, + is_public=is_public) if create_specs is None: specs = { "provider": provider, @@ -210,20 +214,21 @@ class CreateAndListEncryptionType(cinder_utils.CinderBasic): @validation.add("required_services", services=[consts.Service.CINDER]) -@validation.add("restricted_parameters", param_names="name") @validation.add("required_platform", platform="openstack", admin=True) @scenario.configure(context={"admin_cleanup": ["cinder"]}, name="CinderVolumeTypes.create_and_set_volume_type_keys") class CreateAndSetVolumeTypeKeys(cinder_utils.CinderBasic): - def run(self, volume_type_key, **kwargs): + def run(self, volume_type_key, description=None, is_public=True): """Create and set a volume type's extra specs. :param volume_type_key: A dict of key/value pairs to be set - :param kwargs: Optional parameters used during volume - type creation. + :param description: Description of the volume type + :param is_public: Volume type visibility """ - volume_type = self.admin_cinder.create_volume_type(**kwargs) + volume_type = self.admin_cinder.create_volume_type( + description=description, + is_public=is_public) self.admin_cinder.set_volume_type_keys(volume_type, metadata=volume_type_key) diff --git a/samples/tasks/scenarios/cinder/create-and-delete-volume-type.json b/samples/tasks/scenarios/cinder/create-and-delete-volume-type.json index 7d45f2aa..7514b7c8 100644 --- a/samples/tasks/scenarios/cinder/create-and-delete-volume-type.json +++ b/samples/tasks/scenarios/cinder/create-and-delete-volume-type.json @@ -1,7 +1,9 @@ { "CinderVolumeTypes.create_and_delete_volume_type": [ { - "args": {}, + "args": { + "description": "rally tests creating types" + }, "runner": { "type": "constant", "times": 5, diff --git a/samples/tasks/scenarios/cinder/create-and-delete-volume-type.yaml b/samples/tasks/scenarios/cinder/create-and-delete-volume-type.yaml index 0dff7c51..225a7c9d 100644 --- a/samples/tasks/scenarios/cinder/create-and-delete-volume-type.yaml +++ b/samples/tasks/scenarios/cinder/create-and-delete-volume-type.yaml @@ -1,7 +1,8 @@ --- CinderVolumeTypes.create_and_delete_volume_type: - - args: {} + args: + description: "rally tests creating types" runner: type: "constant" times: 5 diff --git a/samples/tasks/scenarios/cinder/create-and-get-volume-type.json b/samples/tasks/scenarios/cinder/create-and-get-volume-type.json index 6ce2599e..269023f2 100644 --- a/samples/tasks/scenarios/cinder/create-and-get-volume-type.json +++ b/samples/tasks/scenarios/cinder/create-and-get-volume-type.json @@ -1,7 +1,9 @@ { "CinderVolumeTypes.create_and_get_volume_type": [ { - "args": {}, + "args": { + "description": "rally tests creating types" + }, "runner": { "type": "constant", "times": 5, diff --git a/samples/tasks/scenarios/cinder/create-and-get-volume-type.yaml b/samples/tasks/scenarios/cinder/create-and-get-volume-type.yaml index a940d49e..8aad5bcc 100644 --- a/samples/tasks/scenarios/cinder/create-and-get-volume-type.yaml +++ b/samples/tasks/scenarios/cinder/create-and-get-volume-type.yaml @@ -1,7 +1,8 @@ --- CinderVolumeTypes.create_and_get_volume_type: - - args: {} + args: + description: "rally tests creating types" runner: type: "constant" times: 5 diff --git a/samples/tasks/scenarios/cinder/create-and-set-volume-type-keys.json b/samples/tasks/scenarios/cinder/create-and-set-volume-type-keys.json index a7ae21c9..b99b051b 100644 --- a/samples/tasks/scenarios/cinder/create-and-set-volume-type-keys.json +++ b/samples/tasks/scenarios/cinder/create-and-set-volume-type-keys.json @@ -2,6 +2,7 @@ "CinderVolumeTypes.create_and_set_volume_type_keys": [ { "args": { + "description": "rally tests creating types", "volume_type_key": { "volume_backend_name": "LVM_iSCSI" } diff --git a/samples/tasks/scenarios/cinder/create-and-set-volume-type-keys.yaml b/samples/tasks/scenarios/cinder/create-and-set-volume-type-keys.yaml index 4a9d2ed7..a95e3d62 100644 --- a/samples/tasks/scenarios/cinder/create-and-set-volume-type-keys.yaml +++ b/samples/tasks/scenarios/cinder/create-and-set-volume-type-keys.yaml @@ -2,6 +2,7 @@ CinderVolumeTypes.create_and_set_volume_type_keys: - args: + description: "rally tests creating types" volume_type_key: volume_backend_name: "LVM_iSCSI" runner: diff --git a/samples/tasks/scenarios/cinder/create-encryption-type.json b/samples/tasks/scenarios/cinder/create-encryption-type.json index 647f2d75..a32f7c7f 100644 --- a/samples/tasks/scenarios/cinder/create-encryption-type.json +++ b/samples/tasks/scenarios/cinder/create-encryption-type.json @@ -2,6 +2,7 @@ "CinderVolumeTypes.create_volume_type_and_encryption_type": [ { "args": { + "description": "rally tests creating types", "provider": "LuksEncryptor", "cipher": "aes-xts-plain64", "key_size": 512, diff --git a/samples/tasks/scenarios/cinder/create-encryption-type.yaml b/samples/tasks/scenarios/cinder/create-encryption-type.yaml index 75ddc5f2..5898817f 100644 --- a/samples/tasks/scenarios/cinder/create-encryption-type.yaml +++ b/samples/tasks/scenarios/cinder/create-encryption-type.yaml @@ -2,6 +2,7 @@ CinderVolumeTypes.create_volume_type_and_encryption_type: - args: + description: "rally tests creating types" provider: "LuksEncryptor" cipher: "aes-xts-plain64" key_size: 512 diff --git a/tests/unit/plugins/openstack/scenarios/cinder/test_volume_types.py b/tests/unit/plugins/openstack/scenarios/cinder/test_volume_types.py index 30b9eb7a..f2de0aeb 100644 --- a/tests/unit/plugins/openstack/scenarios/cinder/test_volume_types.py +++ b/tests/unit/plugins/openstack/scenarios/cinder/test_volume_types.py @@ -46,17 +46,22 @@ class CinderVolumeTypesTestCase(test.ScenarioTestCase): def test_create_and_get_volume_type(self): mock_service = self.mock_cinder.return_value scenario = volume_types.CreateAndGetVolumeType(self._get_context()) - scenario.run(fakeargs="f") - mock_service.create_volume_type.assert_called_once_with(fakeargs="f") + description = "rally tests creating types" + is_public = False + scenario.run(description=description, is_public=is_public) + mock_service.create_volume_type.assert_called_once_with( + description=description, is_public=is_public) mock_service.get_volume_type.assert_called_once_with( mock_service.create_volume_type.return_value) def test_create_and_delete_volume_type(self): mock_service = self.mock_cinder.return_value scenario = volume_types.CreateAndDeleteVolumeType(self._get_context()) - scenario.run(fakeargs="fakeargs") + description = "rally tests creating types" + is_public = False + scenario.run(description=description, is_public=is_public) mock_service.create_volume_type.assert_called_once_with( - fakeargs="fakeargs") + description=description, is_public=is_public) mock_service.delete_volume_type.assert_called_once_with( mock_service.create_volume_type.return_value) @@ -176,7 +181,8 @@ class CinderVolumeTypesTestCase(test.ScenarioTestCase): mock_service = self.mock_cinder.return_value scenario = volume_types.CreateVolumeTypeAndEncryptionType( self._get_context()) - + description = "rally tests creating types" + is_public = False # case: create_specs is None specs = { "provider": "prov", @@ -185,18 +191,19 @@ class CinderVolumeTypesTestCase(test.ScenarioTestCase): "control_location": "cl" } scenario.run(create_specs=None, provider="prov", cipher="cip", - key_size="ks", control_location="cl", fakeargs="fakeargs") + key_size="ks", control_location="cl", + description=description, is_public=is_public) mock_service.create_volume_type.assert_called_once_with( - fakeargs="fakeargs") + description=description, is_public=is_public) mock_service.create_encryption_type.assert_called_once_with( mock_service.create_volume_type.return_value, specs=specs) # case: create_specs is not None scenario.run(create_specs="fakecreatespecs", provider="prov", cipher="cip", key_size="ks", control_location="cl", - fakeargs="fakeargs") + description=description, is_public=is_public) mock_service.create_volume_type.assert_called_with( - fakeargs="fakeargs") + description=description, is_public=is_public) mock_service.create_encryption_type.assert_called_with( mock_service.create_volume_type.return_value, specs="fakecreatespecs") @@ -238,12 +245,15 @@ class CinderVolumeTypesTestCase(test.ScenarioTestCase): def test_create_and_set_volume_type_keys(self): mock_service = self.mock_cinder.return_value volume_type_key = {"volume_backend_name": "LVM_iSCSI"} + description = "rally tests creating types" + is_public = False scenario = volume_types.CreateAndSetVolumeTypeKeys( self._get_context()) - scenario.run(volume_type_key, fakeargs="fakeargs") + scenario.run(volume_type_key, description=description, + is_public=is_public) mock_service.create_volume_type.assert_called_once_with( - fakeargs="fakeargs") + description=description, is_public=is_public) mock_service.set_volume_type_keys.assert_called_once_with( mock_service.create_volume_type.return_value, metadata=volume_type_key)