summaryrefslogtreecommitdiffstats
path: root/nova/quota.py
diff options
context:
space:
mode:
authorChris Behrens <cbehrens@codestud.com>2013-03-11 00:20:23 -0700
committerChris Behrens <cbehrens@codestud.com>2013-03-11 19:26:49 -0700
commit652a487ed9daba9ae97f7df77ae35720322d1af3 (patch)
treed21de2ac493af0334aa7f4942e2893e141861006 /nova/quota.py
parentf543f347c84e7f5de2c584ca55363e4dee5b0a3d (diff)
downloadnova-652a487ed9daba9ae97f7df77ae35720322d1af3.tar.gz
nova-652a487ed9daba9ae97f7df77ae35720322d1af3.tar.xz
nova-652a487ed9daba9ae97f7df77ae35720322d1af3.zip
Fix quota issues with instance deletes.
In order to keep quotas in sync as much as possible, only commit quota changes for delete when: 1) An instance's vm_state is updated to be SOFT_DELETED. 2) The DB record is marked as deleted (and the instance's vm_state is not SOFT_DELETED) If a host is down and we delete the instance in the API, this means quotas are committed within the API. Otherwise, quotas are committed on the manager side. Fixes bug 1098380 Also needed for proper testing: Fixed compute cells tests so that pseudo child cells use NoopQuotaDriver. This uncovered inconsistencies in the NoopQuotaDriver wrt the DBQuotaDriver. Those issues were fixed as well. Change-Id: Ib72de1a457f0c5056d55a5c7dd4d8d7c69708996
Diffstat (limited to 'nova/quota.py')
-rw-r--r--nova/quota.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/nova/quota.py b/nova/quota.py
index 3361154dd..2bd36b2a6 100644
--- a/nova/quota.py
+++ b/nova/quota.py
@@ -508,7 +508,7 @@ class NoopQuotaDriver(object):
quotas[resource.name] = -1
return quotas
- def limit_check(self, context, resources, values):
+ def limit_check(self, context, resources, values, project_id=None):
"""Check simple quota limits.
For limits--those quotas for which there is no usage
@@ -528,10 +528,14 @@ class NoopQuotaDriver(object):
:param resources: A dictionary of the registered resources.
:param values: A dictionary of the values to check against the
quota.
+ :param project_id: Specify the project_id if current context
+ is admin and admin wants to impact on
+ common user's tenant.
"""
pass
- def reserve(self, context, resources, deltas, expire=None):
+ def reserve(self, context, resources, deltas, expire=None,
+ project_id=None):
"""Check quotas and reserve resources.
For counting quotas--those quotas for which there is a usage
@@ -561,24 +565,33 @@ class NoopQuotaDriver(object):
default expiration time set by
--default-reservation-expire will be used (this
value will be treated as a number of seconds).
+ :param project_id: Specify the project_id if current context
+ is admin and admin wants to impact on
+ common user's tenant.
"""
return []
- def commit(self, context, reservations):
+ def commit(self, context, reservations, project_id=None):
"""Commit reservations.
:param context: The request context, for access checks.
:param reservations: A list of the reservation UUIDs, as
returned by the reserve() method.
+ :param project_id: Specify the project_id if current context
+ is admin and admin wants to impact on
+ common user's tenant.
"""
pass
- def rollback(self, context, reservations):
+ def rollback(self, context, reservations, project_id=None):
"""Roll back reservations.
:param context: The request context, for access checks.
:param reservations: A list of the reservation UUIDs, as
returned by the reserve() method.
+ :param project_id: Specify the project_id if current context
+ is admin and admin wants to impact on
+ common user's tenant.
"""
pass