Merge "Add volume type argument in volume context"

This commit is contained in:
Jenkins 2016-07-07 15:19:44 +00:00 committed by Gerrit Code Review
commit e4d43a412c
2 changed files with 6 additions and 1 deletions

6
rally/plugins/openstack/context/cinder/volumes.py Normal file → Executable file
View 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`"))

View File

@ -164,6 +164,7 @@ class VolumeGeneratorTestCase(test.ScenarioTestCase):
},
"volumes": {
"size": 1,
"type": "volume_type",
"volumes_per_tenant": 5,
},
"api_versions": api_version