Merge "Add volume type argument in volume context"
This commit is contained in:
commit
e4d43a412c
6
rally/plugins/openstack/context/cinder/volumes.py
Normal file → Executable file
6
rally/plugins/openstack/context/cinder/volumes.py
Normal file → Executable file
@ -36,6 +36,9 @@ class VolumeGenerator(context.Context):
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"volumes_per_tenant": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
@ -52,6 +55,7 @@ class VolumeGenerator(context.Context):
|
||||
@logging.log_task_wrapper(LOG.info, _("Enter context: `Volumes`"))
|
||||
def setup(self):
|
||||
size = self.config["size"]
|
||||
volume_type = self.config.get("type", None)
|
||||
volumes_per_tenant = self.config["volumes_per_tenant"]
|
||||
|
||||
for user, tenant_id in rutils.iterate_per_tenants(
|
||||
@ -62,7 +66,7 @@ class VolumeGenerator(context.Context):
|
||||
"task": self.context["task"],
|
||||
"config": self.context["config"]})
|
||||
for i in range(volumes_per_tenant):
|
||||
vol = cinder_util._create_volume(size)
|
||||
vol = cinder_util._create_volume(size, volume_type=volume_type)
|
||||
self.context["tenants"][tenant_id]["volumes"].append(vol._info)
|
||||
|
||||
@logging.log_task_wrapper(LOG.info, _("Exit context: `Volumes`"))
|
||||
|
1
tests/unit/plugins/openstack/context/cinder/test_volumes.py
Normal file → Executable file
1
tests/unit/plugins/openstack/context/cinder/test_volumes.py
Normal file → Executable file
@ -164,6 +164,7 @@ class VolumeGeneratorTestCase(test.ScenarioTestCase):
|
||||
},
|
||||
"volumes": {
|
||||
"size": 1,
|
||||
"type": "volume_type",
|
||||
"volumes_per_tenant": 5,
|
||||
},
|
||||
"api_versions": api_version
|
||||
|
Loading…
x
Reference in New Issue
Block a user