Add config option to set max_volume_size_limit
There is a need to limit maximum size of a volume to levels that the storage infrastructure can handle. Setting a maximum limit on size of a volume also prevents a tenant from creating large volumes that have not been tested and certified to satisfy SLA objectives. This feature allows admin to set volume size limit for a tenant. Get default value for volume size limit via config. The defaults will either come from the default values set in the quota configuration option or via cinder.conf if the user has configured default values for quotas there. The per_volume_size_limit defaults to -1["No Limit"] always unless changed in cinder.conf by admin Change-Id: Ieb5c087ca7a33d22342470ea790a0c979a6244ea Implements: blueprint cinder-quota-define-per-volume
This commit is contained in:
@@ -69,7 +69,10 @@ quota_opts = [
|
||||
cfg.BoolOpt('use_default_quota_class',
|
||||
default=True,
|
||||
help='Enables or disables use of default quota class '
|
||||
'with default quota.'), ]
|
||||
'with default quota.'),
|
||||
cfg.IntOpt('per_volume_size_limit',
|
||||
default=-1,
|
||||
help='Max size allowed per volume, in gigabytes'), ]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(quota_opts)
|
||||
@@ -523,7 +526,8 @@ class ReservableResource(BaseResource):
|
||||
"""
|
||||
|
||||
super(ReservableResource, self).__init__(name, flag=flag)
|
||||
self.sync = sync
|
||||
if sync:
|
||||
self.sync = sync
|
||||
|
||||
|
||||
class AbsoluteResource(BaseResource):
|
||||
@@ -869,6 +873,7 @@ class VolumeTypeQuotaEngine(QuotaEngine):
|
||||
result = {}
|
||||
# Global quotas.
|
||||
argses = [('volumes', '_sync_volumes', 'quota_volumes'),
|
||||
('per_volume_gigabytes', None, 'per_volume_size_limit'),
|
||||
('snapshots', '_sync_snapshots', 'quota_snapshots'),
|
||||
('gigabytes', '_sync_gigabytes', 'quota_gigabytes'),
|
||||
('backups', '_sync_backups', 'quota_backups'),
|
||||
|
||||
Reference in New Issue
Block a user