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",
|
"type": "integer",
|
||||||
"minimum": 1
|
"minimum": 1
|
||||||
},
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"volumes_per_tenant": {
|
"volumes_per_tenant": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"minimum": 1
|
"minimum": 1
|
||||||
@ -52,6 +55,7 @@ class VolumeGenerator(context.Context):
|
|||||||
@logging.log_task_wrapper(LOG.info, _("Enter context: `Volumes`"))
|
@logging.log_task_wrapper(LOG.info, _("Enter context: `Volumes`"))
|
||||||
def setup(self):
|
def setup(self):
|
||||||
size = self.config["size"]
|
size = self.config["size"]
|
||||||
|
volume_type = self.config.get("type", None)
|
||||||
volumes_per_tenant = self.config["volumes_per_tenant"]
|
volumes_per_tenant = self.config["volumes_per_tenant"]
|
||||||
|
|
||||||
for user, tenant_id in rutils.iterate_per_tenants(
|
for user, tenant_id in rutils.iterate_per_tenants(
|
||||||
@ -62,7 +66,7 @@ class VolumeGenerator(context.Context):
|
|||||||
"task": self.context["task"],
|
"task": self.context["task"],
|
||||||
"config": self.context["config"]})
|
"config": self.context["config"]})
|
||||||
for i in range(volumes_per_tenant):
|
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)
|
self.context["tenants"][tenant_id]["volumes"].append(vol._info)
|
||||||
|
|
||||||
@logging.log_task_wrapper(LOG.info, _("Exit context: `Volumes`"))
|
@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": {
|
"volumes": {
|
||||||
"size": 1,
|
"size": 1,
|
||||||
|
"type": "volume_type",
|
||||||
"volumes_per_tenant": 5,
|
"volumes_per_tenant": 5,
|
||||||
},
|
},
|
||||||
"api_versions": api_version
|
"api_versions": api_version
|
||||||
|
Loading…
x
Reference in New Issue
Block a user