Merge "Make sure we always get all limits"
This commit is contained in:
commit
12d7d0bc72
@ -99,7 +99,7 @@ class UsageViewTests(test.BaseAdminViewTests):
|
||||
now.month,
|
||||
now.day, 23, 59, 59, 0)) \
|
||||
.AndReturn(usage_list)
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||
.AndReturn(self.limits['absolute'])
|
||||
api.neutron.is_extension_supported(IsA(http.HttpRequest),
|
||||
'security-group').AndReturn(True)
|
||||
@ -195,7 +195,7 @@ class UsageViewTests(test.BaseAdminViewTests):
|
||||
now.month,
|
||||
now.day, 23, 59, 59, 0)) \
|
||||
.AndReturn(usage_obj)
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest))\
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True)\
|
||||
.AndReturn(self.limits['absolute'])
|
||||
api.neutron.is_extension_supported(IsA(http.HttpRequest),
|
||||
'security-group').AndReturn(True)
|
||||
|
@ -1576,7 +1576,7 @@ class UsageViewTests(test.BaseAdminViewTests):
|
||||
api.nova.usage_get(IsA(http.HttpRequest),
|
||||
self.tenant.id,
|
||||
start, end).AndReturn(usage_obj)
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest))\
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True)\
|
||||
.AndReturn(self.limits['absolute'])
|
||||
api.cinder.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.cinder_limits['absolute'])
|
||||
|
@ -1573,7 +1573,7 @@ class InstanceTests(helpers.TestCase):
|
||||
'ServerGroups', IsA(http.HttpRequest)).AndReturn(True)
|
||||
api.nova.server_group_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.server_groups.list())
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest))\
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True)\
|
||||
.AndReturn(self.limits['absolute'])
|
||||
api.nova.flavor_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.flavors.list())
|
||||
@ -1823,7 +1823,7 @@ class InstanceTests(helpers.TestCase):
|
||||
'ServerGroups', IsA(http.HttpRequest)).AndReturn(True)
|
||||
api.nova.server_group_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.server_groups.list())
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest))\
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True)\
|
||||
.AndReturn(self.limits['absolute'])
|
||||
api.nova.flavor_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.flavors.list())
|
||||
@ -2566,7 +2566,7 @@ class InstanceTests(helpers.TestCase):
|
||||
.AndReturn(True)
|
||||
api.nova.flavor_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.flavors.list())
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||
.AndReturn(self.limits['absolute'])
|
||||
api.glance.image_list_detailed(IsA(http.HttpRequest),
|
||||
filters={'is_public': True,
|
||||
@ -2985,7 +2985,7 @@ class InstanceTests(helpers.TestCase):
|
||||
IsA(http.HttpRequest)).AndReturn(True)
|
||||
api.nova.extension_supported('ServerGroups',
|
||||
IsA(http.HttpRequest)).AndReturn(False)
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||
.AndReturn(self.limits['absolute'])
|
||||
api.nova.flavor_list(IsA(http.HttpRequest)) \
|
||||
.AndRaise(self.exceptions.nova)
|
||||
@ -3249,7 +3249,7 @@ class InstanceTests(helpers.TestCase):
|
||||
|
||||
api.nova.flavor_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.flavors.list())
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||
.AndReturn(self.limits['absolute'])
|
||||
quotas.tenant_quota_usages(IsA(http.HttpRequest)) \
|
||||
.AndReturn(quota_usages)
|
||||
@ -3373,7 +3373,7 @@ class InstanceTests(helpers.TestCase):
|
||||
|
||||
api.nova.flavor_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.flavors.list())
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||
.AndReturn(self.limits['absolute'])
|
||||
quotas.tenant_quota_usages(IsA(http.HttpRequest)) \
|
||||
.AndReturn(quota_usages)
|
||||
@ -3512,7 +3512,7 @@ class InstanceTests(helpers.TestCase):
|
||||
|
||||
api.nova.flavor_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.flavors.list())
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||
.AndReturn(self.limits['absolute'])
|
||||
quotas.tenant_quota_usages(IsA(http.HttpRequest)) \
|
||||
.AndReturn(quota_usages)
|
||||
@ -3662,7 +3662,8 @@ class InstanceTests(helpers.TestCase):
|
||||
api.nova.flavor_list(
|
||||
IsA(http.HttpRequest)).AndReturn(self.flavors.list())
|
||||
api.nova.tenant_absolute_limits(
|
||||
IsA(http.HttpRequest)).AndReturn(self.limits['absolute'])
|
||||
IsA(http.HttpRequest), reserved=True
|
||||
).AndReturn(self.limits['absolute'])
|
||||
quotas.tenant_quota_usages(
|
||||
IsA(http.HttpRequest)).AndReturn(quota_usages)
|
||||
api.nova.flavor_list(
|
||||
@ -3806,7 +3807,7 @@ class InstanceTests(helpers.TestCase):
|
||||
|
||||
api.nova.flavor_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.flavors.list())
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||
.AndReturn(self.limits['absolute'])
|
||||
quotas.tenant_quota_usages(IsA(http.HttpRequest)) \
|
||||
.AndReturn(quota_usages)
|
||||
@ -4189,7 +4190,7 @@ class InstanceTests(helpers.TestCase):
|
||||
policy_profiles = self.policy_profiles.list()
|
||||
api.neutron.profile_list(IsA(http.HttpRequest),
|
||||
'policy').AndReturn(policy_profiles)
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||
.AndReturn(self.limits['absolute'])
|
||||
api.nova.extension_supported('BlockDeviceMappingV2Boot',
|
||||
IsA(http.HttpRequest)) \
|
||||
@ -4308,7 +4309,7 @@ class InstanceTests(helpers.TestCase):
|
||||
.AndReturn(self.flavors.list())
|
||||
api.nova.flavor_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.flavors.list())
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||
.AndReturn(self.limits['absolute'])
|
||||
api.nova.extension_supported('DiskConfig',
|
||||
IsA(http.HttpRequest)) \
|
||||
@ -4382,7 +4383,7 @@ class InstanceTests(helpers.TestCase):
|
||||
.AndReturn([])
|
||||
api.nova.flavor_get(IsA(http.HttpRequest), server.flavor['id']) \
|
||||
.AndRaise(self.exceptions.nova)
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||
.AndReturn(self.limits['absolute'])
|
||||
api.nova.extension_supported('DiskConfig',
|
||||
IsA(http.HttpRequest)) \
|
||||
|
@ -394,7 +394,8 @@ class SetInstanceDetailsAction(workflows.Action):
|
||||
def get_help_text(self, extra_context=None):
|
||||
extra = {} if extra_context is None else dict(extra_context)
|
||||
try:
|
||||
extra['usages'] = api.nova.tenant_absolute_limits(self.request)
|
||||
extra['usages'] = api.nova.tenant_absolute_limits(self.request,
|
||||
reserved=True)
|
||||
extra['usages_json'] = json.dumps(extra['usages'])
|
||||
flavors = json.dumps([f._info for f in
|
||||
instance_utils.flavor_list(self.request)])
|
||||
|
@ -61,7 +61,8 @@ class SetFlavorChoiceAction(workflows.Action):
|
||||
def get_help_text(self, extra_context=None):
|
||||
extra = {} if extra_context is None else dict(extra_context)
|
||||
try:
|
||||
extra['usages'] = api.nova.tenant_absolute_limits(self.request)
|
||||
extra['usages'] = api.nova.tenant_absolute_limits(self.request,
|
||||
reserved=True)
|
||||
extra['usages_json'] = json.dumps(extra['usages'])
|
||||
flavors = json.dumps([f._info for f in
|
||||
instance_utils.flavor_list(self.request)])
|
||||
|
@ -52,10 +52,10 @@ class UsageViewTests(test.TestCase):
|
||||
.AndReturn(nova_stu_enabled)
|
||||
|
||||
if tenant_limits_exception:
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest))\
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True)\
|
||||
.AndRaise(tenant_limits_exception)
|
||||
else:
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest), reserved=True) \
|
||||
.AndReturn(self.limits['absolute'])
|
||||
|
||||
if nova_stu_enabled:
|
||||
|
@ -317,7 +317,8 @@ class QuotaTests(test.APITestCase):
|
||||
api.cinder.is_volume_service_enabled(
|
||||
IsA(http.HttpRequest)
|
||||
).AndReturn(True)
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)).AndReturn({})
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest),
|
||||
reserved=True).AndReturn({})
|
||||
api.cinder.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
.AndRaise(cinder.cinder_exception.ClientException('test'))
|
||||
exceptions.handle(IsA(http.HttpRequest),
|
||||
|
@ -199,7 +199,8 @@ class BaseUsage(object):
|
||||
|
||||
def get_limits(self):
|
||||
try:
|
||||
self.limits = api.nova.tenant_absolute_limits(self.request)
|
||||
self.limits = api.nova.tenant_absolute_limits(self.request,
|
||||
reserved=True)
|
||||
except Exception:
|
||||
exceptions.handle(self.request,
|
||||
_("Unable to retrieve limit information."))
|
||||
|
@ -385,7 +385,7 @@ def tenant_limit_usages(request):
|
||||
limits = {}
|
||||
|
||||
try:
|
||||
limits.update(nova.tenant_absolute_limits(request))
|
||||
limits.update(nova.tenant_absolute_limits(request, reserved=True))
|
||||
except Exception:
|
||||
msg = _("Unable to retrieve compute limit information.")
|
||||
exceptions.handle(request, msg)
|
||||
|
Loading…
Reference in New Issue
Block a user