Remove unnecessary 'context' param from quotas reserve method call

context' parameter was removed from quota-related method signatures in patch [1].
In patch [2] use of 'context' parameter was removed from quota-related method calls.

Still at some places 'context' parameter was passed to quota reserve method call.

Removed use of 'context' parameter from those places and passed 'context' as kwargs
while creating object of nova.objects.Quotas type.

[1] https://review.openstack.org/#/c/164268/
[2] https://review.openstack.org/#/c/160499/

Change-Id: I20ea77bd20f093ce1be7169c0647cdc7ff62117c
Closes-Bug: 1494653
This commit is contained in:
Rajesh Tailor 2015-09-10 23:15:46 -07:00
parent e70ff282f8
commit 4031272fe9
2 changed files with 6 additions and 7 deletions

View File

@ -396,7 +396,7 @@ class API(base.Base):
# Check the quota
try:
quotas = objects.Quotas(context)
quotas = objects.Quotas(context=context)
quotas.reserve(instances=max_count,
cores=req_cores, ram=req_ram)
except exception.OverQuota as exc:
@ -1771,7 +1771,7 @@ class API(base.Base):
instance_vcpus, instance_memory_mb = get_inst_attrs(migration,
instance)
quotas = objects.Quotas(context)
quotas = objects.Quotas(context=context)
quotas.reserve(project_id=project_id,
user_id=user_id,
instances=-1,
@ -3888,7 +3888,7 @@ class SecurityGroupAPI(base.Base, security_group_base.SecurityGroupBase):
self.db.security_group_ensure_default(context)
def create_security_group(self, context, name, description):
quotas = objects.Quotas(context)
quotas = objects.Quotas(context=context)
try:
quotas.reserve(security_groups=1)
except exception.OverQuota:

View File

@ -881,12 +881,11 @@ class ComputeManager(manager.Manager):
instance.destroy()
bdms = objects.BlockDeviceMappingList.get_by_instance_uuid(
context, instance.uuid)
quotas = objects.Quotas(context)
quotas = objects.Quotas(context=context)
project_id, user_id = objects.quotas.ids_from_instance(context,
instance)
quotas.reserve(context, project_id=project_id, user_id=user_id,
instances=-1, cores=-instance.vcpus,
ram=-instance.memory_mb)
quotas.reserve(project_id=project_id, user_id=user_id, instances=-1,
cores=-instance.vcpus, ram=-instance.memory_mb)
self._complete_deletion(context,
instance,
bdms,