Allow to use _max qos option together with per_gb

With this patch it'll become possible to limit max performance of volume
even when qos is set per_gb. As a result operator will be able to set
min and max options, with per gb increment, until the max value.

Change-Id: I3c6c9e1c50100cfa56dcadf6445729484cdd616d
This commit is contained in:
Dmitriy Rabotjagov 2018-12-13 19:12:32 +02:00 committed by Dmitriy Rabotjagov (noonedeadpunk)
parent b9b260a0a8
commit 8ff9154ffc
3 changed files with 11 additions and 2 deletions

View File

@ -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}

View File

@ -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)

View File

@ -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: