summaryrefslogtreecommitdiff
path: root/trove/extensions
diff options
context:
space:
mode:
authorFan Zhang <zh.f@outlook.com>2017-11-03 16:07:26 +0800
committerFan Zhang <zh.f@outlook.com>2017-11-09 21:29:14 +0800
commit8229572c1d31d2bc686282eab48dd0465f023315 (patch)
treecffef1fa9bcf32d796107d84cbde174220d241b9 /trove/extensions
parent84af1645ac8b98389cea134f3d4c9e5df78cf61c (diff)
downloadtrove-8229572c1d31d2bc686282eab48dd0465f023315.tar.gz
Support -1 as unlimited quota restraint in Trove.
In other projects like nova and neutron, hard limit -1 often means unlimited quota restraint. But Trove dose not support that. This patch aims at two things: 1. Support -1, as unlimited quota restraint in check_quotas() 2. Add quota check to accept only -1, not -2 or other negative numbers when updating quotas. Change-Id: I028e6d7814ff240aa3f697e3d6ac8c7bac5bf3fd Closes-bug: #1729791 Signed-off-by: Fan Zhang <zh.f@outlook.com>
Diffstat (limited to 'trove/extensions')
-rw-r--r--trove/extensions/mgmt/quota/service.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/trove/extensions/mgmt/quota/service.py b/trove/extensions/mgmt/quota/service.py
index 1786160c..b61f4fb2 100644
--- a/trove/extensions/mgmt/quota/service.py
+++ b/trove/extensions/mgmt/quota/service.py
@@ -55,6 +55,9 @@ class QuotaController(wsgi.Controller):
for resource, limit in body['quotas'].items():
if limit is None:
continue
+ elif limit < -1:
+ raise exception.QuotaLimitTooSmall(limit=limit,
+ resource=resource)
if resource == "xmlns":
continue
if resource not in registered_resources: