Merge "Merge v20 view builder for limit API"

This commit is contained in:
Jenkins 2016-12-14 20:58:49 +00:00 committed by Gerrit Code Review
commit 0415ee80b5
2 changed files with 3 additions and 13 deletions

View File

@ -61,13 +61,10 @@ class LimitsController(wsgi.Controller):
usages=False)
abs_limits = {k: v['limit'] for k, v in quotas.items()}
builder = self._get_view_builder(req)
builder = limits_views.ViewBuilder()
return builder.build(abs_limits, filter_result=filter_result,
max_image_meta=max_image_meta)
def _get_view_builder(self, req):
return limits_views.ViewBuilderV21()
class Limits(extensions.V21APIExtensionBase):
"""Limits support."""

View File

@ -39,6 +39,8 @@ class ViewBuilder(object):
"injected_file_content_bytes": ["maxPersonalitySize"],
"security_groups": ["maxSecurityGroups"],
"security_group_rules": ["maxSecurityGroupRules"],
"server_groups": ["maxServerGroups"],
"server_group_members": ["maxServerGroupMembers"]
}
def build(self, absolute_limits, filter_result=False, max_image_meta=True):
@ -75,12 +77,3 @@ class ViewBuilder(object):
continue
limits[limit_name] = value
return limits
class ViewBuilderV21(ViewBuilder):
def __init__(self):
super(ViewBuilderV21, self).__init__()
# NOTE In v2.0 these are added by a specific extension
self.limit_names["server_groups"] = ["maxServerGroups"]
self.limit_names["server_group_members"] = ["maxServerGroupMembers"]