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