diff options
| author | Kevin L. Mitchell <kevin.mitchell@rackspace.com> | 2012-05-11 15:30:14 -0500 |
|---|---|---|
| committer | Kevin L. Mitchell <kevin.mitchell@rackspace.com> | 2012-05-23 10:17:41 -0500 |
| commit | b7f0946bbd071bc76809eca440ab7d21a03eb1a3 (patch) | |
| tree | 4f46ad3896cb89c8747bdf09e3f33a476eccbf16 /nova/db | |
| parent | 7e15d4e28f98e13f0ea7399787c50839139d8492 (diff) | |
Finish quota refactor.
Finishes quota refactoring by making use of the new quota infrastructure.
Partially implements blueprint quota-refactor (the final piece is to
remove the old quota architecture).
This change is fairly substantial. To make it easier to review, it has been
broken up into 3 parts. This is the second part.
Change-Id: I1c8b43198f0d44e9e13a45575361aa043fd0639e
Diffstat (limited to 'nova/db')
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index c555c73c8..56a25ad71 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -2543,6 +2543,10 @@ def quota_reserve(context, resources, quotas, deltas, expire, session=session, save=False) refresh = True + elif usages[resource].in_use < 0: + # Negative in_use count indicates a desync, so try to + # heal from that... + refresh = True elif usages[resource].until_refresh is not None: usages[resource].until_refresh -= 1 if usages[resource].until_refresh <= 0: @@ -2607,7 +2611,7 @@ def quota_reserve(context, resources, quotas, deltas, expire, # they're not invalidated by being over-quota. # Create the reservations - if not unders and not overs: + if not overs: reservations = [] for resource, delta in deltas.items(): reservation = reservation_create(elevated, @@ -2638,7 +2642,8 @@ def quota_reserve(context, resources, quotas, deltas, expire, usage_ref.save(session=session) if unders: - raise exception.InvalidQuotaValue(unders=sorted(unders)) + LOG.warning(_("Change will make usage less than 0 for the following " + "resources: %(unders)s") % locals()) if overs: usages = dict((k, dict(in_use=v['in_use'], reserved=v['reserved'])) for k, v in usages.items()) |
