diff --git a/rally-jobs/rally-neutron.yaml b/rally-jobs/rally-neutron.yaml index 01cda77f87..0ba4b29e7a 100644 --- a/rally-jobs/rally-neutron.yaml +++ b/rally-jobs/rally-neutron.yaml @@ -560,6 +560,22 @@ sla: failure_rate: max: 0 + - + args: + size: + min: 1 + max: 3 + runner: + type: "constant" + times: 3 + concurrency: 3 + context: + users: + tenants: 2 + users_per_tenant: 2 + sla: + failure_rate: + max: 0 CinderVolumes.create_and_list_volume: - @@ -577,6 +593,23 @@ sla: failure_rate: max: 0 + - + args: + size: + min: 1 + max: 3 + detailed: True + runner: + type: "constant" + times: 3 + concurrency: 3 + context: + users: + tenants: 1 + users_per_tenant: 1 + sla: + failure_rate: + max: 0 - args: size: 1 @@ -629,6 +662,22 @@ sla: failure_rate: max: 0 + - + args: + size: + min: 1 + max: 3 + runner: + type: "constant" + times: 2 + concurrency: 2 + context: + users: + tenants: 2 + users_per_tenant: 2 + sla: + failure_rate: + max: 0 - args: size: 1 @@ -662,6 +711,25 @@ sla: failure_rate: max: 0 + - + args: + size: + min: 1 + max: 2 + new_size: + min: 3 + max: 4 + runner: + type: "constant" + times: 2 + concurrency: 2 + context: + users: + tenants: 1 + users_per_tenant: 1 + sla: + failure_rate: + max: 0 CinderVolumes.create_from_volume_and_delete_volume: - @@ -680,6 +748,24 @@ sla: failure_rate: max: 0 + - + args: + size: + min: 1 + max: 2 + runner: + type: "constant" + times: 2 + concurrency: 2 + context: + users: + tenants: 1 + users_per_tenant: 1 + volumes: + size: 1 + sla: + failure_rate: + max: 0 CinderVolumes.create_and_delete_snapshot: - diff --git a/rally/benchmark/scenarios/cinder/utils.py b/rally/benchmark/scenarios/cinder/utils.py index b28f55133f..d474f5519c 100644 --- a/rally/benchmark/scenarios/cinder/utils.py +++ b/rally/benchmark/scenarios/cinder/utils.py @@ -72,12 +72,19 @@ def _create_volume(self, size, **kwargs): Returns when the volume is actually created and is in the "Available" state. - :param size: int be size of volume in GB + :param size: int be size of volume in GB, or + dictionary, must contain two values: + min - minimum size volumes will be created as; + max - maximum size volumes will be created as. :param kwargs: Other optional parameters to initialize the volume :returns: Created volume object """ kwargs["display_name"] = kwargs.get("display_name", self._generate_random_name()) + + if isinstance(size, dict): + size = random.randint(size["min"], size["max"]) + volume = self.clients("cinder").volumes.create(size, **kwargs) # NOTE(msdubov): It is reasonable to wait 5 secs before starting to # check whether the volume is ready => less API calls. @@ -114,8 +121,16 @@ def _extend_volume(self, volume, new_size): Returns when the volume is actually extended. :param volume: volume object - :param new_size: new volume size in GB + :param new_size: new volume size in GB, or + dictionary, must contain two values: + min - minimum size volumes will be created as; + max - maximum size volumes will be created as. + Notice: should be bigger volume size """ + + if isinstance(new_size, dict): + new_size = random.randint(new_size["min"], new_size["max"]) + volume.extend(volume, new_size) volume = bench_utils.wait_for( volume, diff --git a/rally/benchmark/scenarios/cinder/volumes.py b/rally/benchmark/scenarios/cinder/volumes.py index 0595cc4788..b312ac5c5e 100755 --- a/rally/benchmark/scenarios/cinder/volumes.py +++ b/rally/benchmark/scenarios/cinder/volumes.py @@ -49,7 +49,10 @@ def create_and_list_volume(self, size, detailed=True, performance of the "cinder volume-list" command depending on the number of images owned by users. - :param size: volume size (in GB) + :param size: volume size (integer, in GB) or + dictionary, must contain two values: + min - minimum size volumes will be created as; + max - maximum size volumes will be created as. :param detailed: determines whether the volume listing should contain detailed information about all of them :param image: image to be used to create volume @@ -91,7 +94,10 @@ def create_and_delete_volume(self, size, image=None, between volume creation and deletion (of random duration from [min_sleep, max_sleep]). - :param size: volume size (in GB) + :param size: volume size (integer, in GB) or + dictionary, must contain two values: + min - minimum size volumes will be created as; + max - maximum size volumes will be created as. :param image: image to be used to create volume :param min_sleep: minimum sleep time between volume creation and deletion (in seconds) @@ -117,7 +123,10 @@ def create_volume(self, size, image=None, **kwargs): Good test to check how influence amount of active volumes on performance of creating new. - :param size: volume size (in GB) + :param size: volume size (integer, in GB) or + dictionary, must contain two values: + min - minimum size volumes will be created as; + max - maximum size volumes will be created as. :param image: image to be used to create volume :param kwargs: optional args to create a volume """ @@ -134,8 +143,16 @@ def create_and_extend_volume(self, size, new_size, min_sleep=0, """Create and extend a volume and then delete it. - :param size: volume size (in GB) - :param new_size: volume new size (in GB) to extend + :param size: volume size (in GB) or + dictionary, must contain two values: + min - minimum size volumes will be created as; + max - maximum size volumes will be created as. + :param new_size: volume new size (in GB) or + dictionary, must contain two values: + min - minimum size volumes will be created as; + max - maximum size volumes will be created as. + to extend. + Notice: should be bigger volume size :param min_sleep: minimum sleep time between volume extension and deletion (in seconds) :param max_sleep: maximum sleep time between volume extension and @@ -159,8 +176,12 @@ def create_from_volume_and_delete_volume(self, size, min_sleep=0, parameters allow the scenario to simulate a pause between volume creation and deletion (of random duration from [min_sleep, max_sleep]). - :param size: volume size (in GB). Should be equal or bigger - source volume size + :param size: volume size (in GB), or + dictionary, must contain two values: + min - minimum size volumes will be created as; + max - maximum size volumes will be created as. + Should be equal or bigger source volume size + :param min_sleep: minimum sleep time between volume creation and deletion (in seconds) :param max_sleep: maximum sleep time between volume creation and @@ -210,7 +231,10 @@ def create_and_attach_volume(self, size, image, flavor, **kwargs): Simple test to create a VM and attach a volume, then detach the volume and delete volume/VM. - :param size: volume size (in GB) + :param size: volume size (integer, in GB) or + dictionary, must contain two values: + min - minimum size volumes will be created as; + max - maximum size volumes will be created as. :param image: Glance image name to use for the VM :param flavor: VM flavor name :param kwargs: optional arguments for VM creation @@ -268,8 +292,6 @@ def create_snapshot_and_attach_volume(self, volume_type=False, volume_types.append(s.name) selected_type = random.choice(volume_types) - size = random.randint(size["min"], size["max"]) - volume = self._create_volume(size, volume_type=selected_type) snapshot = self._create_snapshot(volume.id, False, **kwargs) @@ -320,7 +342,6 @@ def create_nested_snapshots_and_attach_volume(self, if nested_level is None: nested_level = {"min": 5, "max": 10} - size = random.randint(size["min"], size["max"]) nested_level = random.randint(nested_level["min"], nested_level["max"]) source_vol = self._create_volume(size) @@ -373,7 +394,10 @@ def create_and_upload_volume_to_image(self, size, force=False, **kwargs): """Create and upload a volume to image. - :param size: volume size (integers, in GB) + :param size: volume size (integers, in GB), or + dictionary, must contain two values: + min - minimum size volumes will be created as; + max - maximum size volumes will be created as. :param force: when set to True volume that is attached to an instance could be uploaded to image :param container_format: image container format diff --git a/samples/tasks/scenarios/cinder/create-and-attach-volume.json b/samples/tasks/scenarios/cinder/create-and-attach-volume.json index b7049f346a..b30cc7a158 100644 --- a/samples/tasks/scenarios/cinder/create-and-attach-volume.json +++ b/samples/tasks/scenarios/cinder/create-and-attach-volume.json @@ -21,6 +21,28 @@ "users_per_tenant": 2 } } + }, + { + "args": { + "size": { + "min": 1, + "max": 5 + }, + "flavor": { + "name": "m1.nano" + } + }, + "runner": { + "type": "constant", + "times": 5, + "concurrency": 1 + }, + "context": { + "users": { + "tenants": 2, + "users_per_tenant": 2 + } + } } ] } diff --git a/samples/tasks/scenarios/cinder/create-and-attach-volume.yaml b/samples/tasks/scenarios/cinder/create-and-attach-volume.yaml index 62410e3186..aa4fe20c0e 100644 --- a/samples/tasks/scenarios/cinder/create-and-attach-volume.yaml +++ b/samples/tasks/scenarios/cinder/create-and-attach-volume.yaml @@ -15,3 +15,18 @@ users: tenants: 2 users_per_tenant: 2 + - + args: + size: + min: 1 + max: 5 + flavor: + name: "m1.nano" + runner: + type: "constant" + times: 5 + concurrency: 1 + context: + users: + tenants: 2 + users_per_tenant: 2 \ No newline at end of file diff --git a/samples/tasks/scenarios/cinder/create-and-delete-volume.json b/samples/tasks/scenarios/cinder/create-and-delete-volume.json index 28f7eec49b..9c096aacee 100644 --- a/samples/tasks/scenarios/cinder/create-and-delete-volume.json +++ b/samples/tasks/scenarios/cinder/create-and-delete-volume.json @@ -15,6 +15,25 @@ "users_per_tenant": 2 } } + }, + { + "args": { + "size": { + "min": 1, + "max": 5 + } + }, + "runner": { + "type": "constant", + "times": 3, + "concurrency": 2 + }, + "context": { + "users": { + "tenants": 2, + "users_per_tenant": 2 + } + } } ] } diff --git a/samples/tasks/scenarios/cinder/create-and-delete-volume.yaml b/samples/tasks/scenarios/cinder/create-and-delete-volume.yaml index 9e68e8c20c..957c86b5bf 100644 --- a/samples/tasks/scenarios/cinder/create-and-delete-volume.yaml +++ b/samples/tasks/scenarios/cinder/create-and-delete-volume.yaml @@ -11,3 +11,16 @@ users: tenants: 2 users_per_tenant: 2 + - + args: + size: + min: 1 + max: 5 + runner: + type: "constant" + times: 3 + concurrency: 2 + context: + users: + tenants: 2 + users_per_tenant: 2 \ No newline at end of file diff --git a/samples/tasks/scenarios/cinder/create-and-extend-volume.json b/samples/tasks/scenarios/cinder/create-and-extend-volume.json index 4794c96e28..18231757c1 100644 --- a/samples/tasks/scenarios/cinder/create-and-extend-volume.json +++ b/samples/tasks/scenarios/cinder/create-and-extend-volume.json @@ -16,6 +16,29 @@ "users_per_tenant": 1 } } + }, + { + "args": { + "size": { + "min": 1, + "max": 5 + }, + "new_size": { + "min": 6, + "max": 10 + } + }, + "runner": { + "type": "constant", + "times": 2, + "concurrency": 2 + }, + "context": { + "users": { + "tenants": 1, + "users_per_tenant": 1 + } + } } ] } diff --git a/samples/tasks/scenarios/cinder/create-and-extend-volume.yaml b/samples/tasks/scenarios/cinder/create-and-extend-volume.yaml index 781e692f0f..1caa2a3427 100644 --- a/samples/tasks/scenarios/cinder/create-and-extend-volume.yaml +++ b/samples/tasks/scenarios/cinder/create-and-extend-volume.yaml @@ -12,3 +12,19 @@ users: tenants: 1 users_per_tenant: 1 + - + args: + size: + min: 1 + max: 5 + new_size: + min: 6 + max: 10 + runner: + type: "constant" + times: 2 + concurrency: 2 + context: + users: + tenants: 1 + users_per_tenant: 1 \ No newline at end of file diff --git a/samples/tasks/scenarios/cinder/create-and-list-volume.json b/samples/tasks/scenarios/cinder/create-and-list-volume.json index 4a3cb6adbe..baacf7c239 100644 --- a/samples/tasks/scenarios/cinder/create-and-list-volume.json +++ b/samples/tasks/scenarios/cinder/create-and-list-volume.json @@ -16,6 +16,26 @@ "users_per_tenant": 1 } } + }, + { + "args": { + "size": { + "min": 1, + "max": 5 + }, + "detailed": true + }, + "runner": { + "type": "constant", + "times": 3, + "concurrency": 1 + }, + "context": { + "users": { + "tenants": 1, + "users_per_tenant": 1 + } + } } ] } diff --git a/samples/tasks/scenarios/cinder/create-and-list-volume.yaml b/samples/tasks/scenarios/cinder/create-and-list-volume.yaml index 3ff7193c85..e209baa347 100644 --- a/samples/tasks/scenarios/cinder/create-and-list-volume.yaml +++ b/samples/tasks/scenarios/cinder/create-and-list-volume.yaml @@ -12,3 +12,17 @@ users: tenants: 1 users_per_tenant: 1 + - + args: + size: + min: 1 + max: 5 + detailed: True + runner: + type: "constant" + times: 3 + concurrency: 1 + context: + users: + tenants: 1 + users_per_tenant: 1 \ No newline at end of file diff --git a/samples/tasks/scenarios/cinder/create-and-upload-volume-to-image.json b/samples/tasks/scenarios/cinder/create-and-upload-volume-to-image.json index ee9344a97d..a721bdf259 100644 --- a/samples/tasks/scenarios/cinder/create-and-upload-volume-to-image.json +++ b/samples/tasks/scenarios/cinder/create-and-upload-volume-to-image.json @@ -19,6 +19,29 @@ "users_per_tenant": 2 } } + }, + { + "args": { + "size": { + "min": 1, + "max": 5 + }, + "force": false, + "container_format": "bare", + "disk_format": "raw", + "do_delete": true + }, + "runner": { + "type": "constant", + "times": 3, + "concurrency": 2 + }, + "context": { + "users": { + "tenants": 2, + "users_per_tenant": 2 + } + } } ] } diff --git a/samples/tasks/scenarios/cinder/create-and-upload-volume-to-image.yaml b/samples/tasks/scenarios/cinder/create-and-upload-volume-to-image.yaml index 42f631e741..07b9348749 100644 --- a/samples/tasks/scenarios/cinder/create-and-upload-volume-to-image.yaml +++ b/samples/tasks/scenarios/cinder/create-and-upload-volume-to-image.yaml @@ -15,3 +15,20 @@ users: tenants: 2 users_per_tenant: 2 + - + args: + size: + min: 1 + max: 5 + force: false + container_format: "bare" + disk_format: "raw" + do_delete: true + runner: + type: "constant" + times: 3 + concurrency: 2 + context: + users: + tenants: 2 + users_per_tenant: 2 \ No newline at end of file diff --git a/samples/tasks/scenarios/cinder/create-from-volume-and-delete-volume.json b/samples/tasks/scenarios/cinder/create-from-volume-and-delete-volume.json index becd52db46..43a439c703 100644 --- a/samples/tasks/scenarios/cinder/create-from-volume-and-delete-volume.json +++ b/samples/tasks/scenarios/cinder/create-from-volume-and-delete-volume.json @@ -18,6 +18,28 @@ "size": 1 } } + }, + { + "args": { + "size": { + "min": 1, + "max": 5 + } + }, + "runner": { + "type": "constant", + "times": 2, + "concurrency": 2 + }, + "context": { + "users": { + "tenants": 1, + "users_per_tenant": 1 + }, + "volumes": { + "size": 1 + } + } } ] } \ No newline at end of file diff --git a/samples/tasks/scenarios/cinder/create-from-volume-and-delete-volume.yaml b/samples/tasks/scenarios/cinder/create-from-volume-and-delete-volume.yaml index 78285b15e3..7af1f22e29 100644 --- a/samples/tasks/scenarios/cinder/create-from-volume-and-delete-volume.yaml +++ b/samples/tasks/scenarios/cinder/create-from-volume-and-delete-volume.yaml @@ -7,6 +7,21 @@ type: "constant" times: 2 concurrency: 2 + context: + users: + tenants: 1 + users_per_tenant: 1 + volumes: + size: 1 + - + args: + size: + min: 1 + max: 5 + runner: + type: "constant" + times: 2 + concurrency: 2 context: users: tenants: 1 diff --git a/samples/tasks/scenarios/cinder/create-volume.json b/samples/tasks/scenarios/cinder/create-volume.json index 41dfd23385..fb897d4284 100644 --- a/samples/tasks/scenarios/cinder/create-volume.json +++ b/samples/tasks/scenarios/cinder/create-volume.json @@ -15,6 +15,25 @@ "users_per_tenant": 2 } } + }, + { + "args": { + "size": { + "min": 1, + "max": 5 + } + }, + "runner": { + "type": "constant", + "times": 3, + "concurrency": 2 + }, + "context": { + "users": { + "tenants": 2, + "users_per_tenant": 2 + } + } } ] } diff --git a/samples/tasks/scenarios/cinder/create-volume.yaml b/samples/tasks/scenarios/cinder/create-volume.yaml index 319877296e..e63c10fcb3 100644 --- a/samples/tasks/scenarios/cinder/create-volume.yaml +++ b/samples/tasks/scenarios/cinder/create-volume.yaml @@ -11,3 +11,16 @@ users: tenants: 2 users_per_tenant: 2 + - + args: + size: + min: 1 + max: 5 + runner: + type: "constant" + times: 3 + concurrency: 2 + context: + users: + tenants: 2 + users_per_tenant: 2 \ No newline at end of file diff --git a/tests/unit/benchmark/scenarios/cinder/test_utils.py b/tests/unit/benchmark/scenarios/cinder/test_utils.py index 1cbbd72474..747a94aa13 100644 --- a/tests/unit/benchmark/scenarios/cinder/test_utils.py +++ b/tests/unit/benchmark/scenarios/cinder/test_utils.py @@ -77,6 +77,33 @@ def test__create_volume(self, mock_clients): self._test_atomic_action_timer(self.scenario.atomic_actions(), "cinder.create_volume") + @mock.patch("rally.benchmark.scenarios.cinder.utils.random") + @mock.patch(CINDER_UTILS + ".CinderScenario.clients") + def test__create_volume_with_size_range(self, mock_clients, mock_random): + CONF = cfg.CONF + volume = mock.Mock() + mock_clients("cinder").volumes.create.return_value = volume + mock_random.randint.return_value = 3 + + return_volume = self.scenario._create_volume( + size={"min": 1, "max": 5}, + display_name="TestVolume") + + mock_clients("cinder").volumes.create.assert_called_once_with( + 3, display_name="TestVolume") + + self.wait_for.mock.assert_called_once_with( + volume, + is_ready=self.res_is.mock(), + update_resource=self.gfm(), + timeout=CONF.benchmark.cinder_volume_create_timeout, + check_interval=CONF.benchmark.cinder_volume_create_poll_interval + ) + self.res_is.mock.assert_has_calls([mock.call("available")]) + self.assertEqual(self.wait_for.mock(), return_volume) + self._test_atomic_action_timer(self.scenario.atomic_actions(), + "cinder.create_volume") + def test__delete_volume(self): cinder = mock.Mock() self.scenario._delete_volume(cinder) @@ -90,6 +117,28 @@ def test__delete_volume(self): self._test_atomic_action_timer(self.scenario.atomic_actions(), "cinder.delete_volume") + @mock.patch("rally.benchmark.scenarios.cinder.utils.random") + @mock.patch(CINDER_UTILS + ".CinderScenario.clients") + def test__extend_volume_with_size_range(self, mock_clients, mock_random): + CONF = cfg.CONF + volume = mock.Mock() + mock_random.randint.return_value = 3 + mock_clients("cinder").volumes.extend.return_value = volume + + self.scenario._extend_volume(volume, new_size={"min": 1, "max": 5}) + + volume.extend.assert_called_once_with(volume, 3) + self.wait_for.mock.assert_called_once_with( + volume, + is_ready=self.res_is.mock(), + update_resource=self.gfm(), + timeout=CONF.benchmark.cinder_volume_create_timeout, + check_interval=CONF.benchmark.cinder_volume_create_poll_interval + ) + self.res_is.mock.assert_has_calls([mock.call("available")]) + self._test_atomic_action_timer(self.scenario.atomic_actions(), + "cinder.extend_volume") + @mock.patch(CINDER_UTILS + ".CinderScenario.clients") def test__extend_volume(self, mock_clients): CONF = cfg.CONF