summaryrefslogtreecommitdiff
path: root/keystone/limit
diff options
context:
space:
mode:
authorwangxiyuan <wangxiyuan@huawei.com>2018-08-03 15:33:44 +0800
committerwangxiyuan <wangxiyuan@huawei.com>2018-08-03 15:33:44 +0800
commitbf3a8c09a095c2b037f114ba4770b59d6351c73b (patch)
tree1a25612be3adbe1026bc35cf3fa02cc5822f1458 /keystone/limit
parentea774f78e05b37567ada8a0cb6956f9482d24f0a (diff)
downloadkeystone-bf3a8c09a095c2b037f114ba4770b59d6351c73b.tar.gz
Do not allow create limits for domain
Keystone now doesn't support domain-level limits. When creating limits, if the input project_id is a domain id, it should not be allowed. Change-Id: Ifafd96113499d533341870960f294dd5fada477d Closes-Bug: #1785164
Diffstat (limited to 'keystone/limit')
-rw-r--r--keystone/limit/core.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/keystone/limit/core.py b/keystone/limit/core.py
index c21a53d39..d3b4cdbbf 100644
--- a/keystone/limit/core.py
+++ b/keystone/limit/core.py
@@ -54,7 +54,11 @@ class Manager(manager.Manager):
PROVIDERS.catalog_api.get_region(region_id)
project_id = unified_limit.get('project_id')
if project_id is not None:
- PROVIDERS.resource_api.get_project(project_id)
+ project = PROVIDERS.resource_api.get_project(project_id)
+ # Keystone now does not support domain-level limits. This
+ # check can be removed if it'll be supported in the future.
+ if project['is_domain']:
+ raise exception.ProjectNotFound(project_id=project_id)
except exception.ServiceNotFound:
raise exception.ValidationError(attribute='service_id',
target=target)