Allow kwargs in create_volume_type
As a part of the scenario/manager.py stabilization tracked by
the below BP the patch adds kwargs argument for create_volume_type
method so that the consumers are able to pass additional parameters
if needed.
Implements: blueprint tempest-scenario-manager-stable
Change-Id: I4d8236f4b2222c6a07aaafc502c3b660d49d663c
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index ff860d5..64537c4 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -454,7 +454,8 @@
admin_volumes_client.wait_for_resource_deletion(volume['id'])
admin_volume_type_client.delete_volume_type(volume_type['id'])
- def create_volume_type(self, client=None, name=None, backend_name=None):
+ def create_volume_type(self, client=None, name=None, backend_name=None,
+ **kwargs):
"""Creates volume type
In a multiple-storage back-end configuration,
@@ -481,12 +482,14 @@
LOG.debug("Creating a volume type: %s on backend %s",
randomized_name, backend_name)
- extra_specs = {}
+ extra_specs = kwargs.pop("extra_specs", {})
if backend_name:
- extra_specs = {"volume_backend_name": backend_name}
+ extra_specs.update({"volume_backend_name": backend_name})
- volume_type = client.create_volume_type(
- name=randomized_name, extra_specs=extra_specs)['volume_type']
+ volume_type_resp = client.create_volume_type(
+ name=randomized_name, extra_specs=extra_specs, **kwargs)
+ volume_type = volume_type_resp['volume_type']
+
self.assertIn('id', volume_type)
self.addCleanup(self._cleanup_volume_type, volume_type)
return volume_type