diff --git a/cinder/tests/unit/volume/test_connection.py b/cinder/tests/unit/volume/test_connection.py index 3bbb03cfc95..4ca1a1568fd 100644 --- a/cinder/tests/unit/volume/test_connection.py +++ b/cinder/tests/unit/volume/test_connection.py @@ -259,6 +259,7 @@ class VolumeConnectionTestCase(base.BaseVolumeTestCase): 'read_iops_sec_per_gb': 7700, 'total_iops_sec_per_gb_min': 900000, 'total_iops_sec_per_gb': 300000, + 'total_iops_sec_max': 15000000, 'read_bytes_sec_per_gb_min': 30, 'read_bytes_sec_per_gb': 10, 'write_bytes_sec_per_gb_min': 120, @@ -326,6 +327,7 @@ class VolumeConnectionTestCase(base.BaseVolumeTestCase): 'read_iops_sec_per_gb': 7700, 'total_iops_sec_per_gb_min': 900000, 'total_iops_sec_per_gb': 300000, + 'total_iops_sec_max': 15000000, 'read_bytes_sec_per_gb_min': 30, 'read_bytes_sec_per_gb': 10, 'write_bytes_sec_per_gb_min': 120, @@ -343,7 +345,7 @@ class VolumeConnectionTestCase(base.BaseVolumeTestCase): mock_get_target.return_value = None qos_specs_expected = {'write_iops_sec': 3000, 'read_iops_sec': 770000, - 'total_iops_sec': 30000000, + 'total_iops_sec': 15000000, 'read_bytes_sec': 1000, 'write_bytes_sec': 4000, 'total_bytes_sec': 104857600} diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index eeb16595c58..8e4117999d8 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -1619,10 +1619,13 @@ class VolumeManager(manager.CleanableManager, for option in tune_opts: option_per_gb = '%s_per_gb' % option option_per_gb_min = '%s_per_gb_min' % option + option_max = '%s_max' % option if option_per_gb in specs: minimum_value = int(specs.pop(option_per_gb_min, 0)) value = int(specs[option_per_gb]) * volume_size - specs[option] = max(minimum_value, value) + per_gb_value = max(minimum_value, value) + max_value = int(specs.pop(option_max, per_gb_value)) + specs[option] = min(per_gb_value, max_value) specs.pop(option_per_gb) qos_spec = dict(qos_specs=specs) diff --git a/doc/source/admin/blockstorage-capacity-based-qos.rst b/doc/source/admin/blockstorage-capacity-based-qos.rst index 93a4469e592..4bd948951d3 100644 --- a/doc/source/admin/blockstorage-capacity-based-qos.rst +++ b/doc/source/admin/blockstorage-capacity-based-qos.rst @@ -42,6 +42,10 @@ is very small and ends up with an unusable volume because of performance. * `write_bytes_sec_per_gb_min` * `total_bytes_sec_per_gb_min` +Capacity based options might be used in conjunction with basic options, +like `*_sec_max`, in order to set upper limits for volumes. This may be useful +for large volumes, which may consume all storage performance. + For example, in order to create a QoS with 30 IOPs total writes per GB and a throughput of 1MB per GB, you might use the Cinder client in the following way: