summaryrefslogtreecommitdiff
path: root/nova/quota.py
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2021-04-01 12:14:33 +0100
committerStephen Finucane <stephenfin@redhat.com>2021-08-09 15:34:40 +0100
commit43b253cd60bd68bce108969d6b3adc0565b8f95e (patch)
tree6c48061cfdbf27a0ae8aa23b1953c797fd95a7eb /nova/quota.py
parentbf8b5fc7d05e0a66031a03e50e8f6bb76a921046 (diff)
downloadnova-43b253cd60bd68bce108969d6b3adc0565b8f95e.tar.gz
db: Post reshuffle cleanup
Introduce a new 'nova.db.api.api' module to hold API database-specific helpers, plus a generic 'nova.db.utils' module to hold code suitable for both main and API databases. This highlights a level of complexity around connection management that is present for the main database but not for the API database. This is because we need to handle the complexity of cells for the former but not the latter. Change-Id: Ia5304c552ce552ae3c5223a2bfb3a9cd543ec57c Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Diffstat (limited to 'nova/quota.py')
-rw-r--r--nova/quota.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/nova/quota.py b/nova/quota.py
index e3950e9d99..a311ecc87f 100644
--- a/nova/quota.py
+++ b/nova/quota.py
@@ -24,8 +24,9 @@ from sqlalchemy import sql
import nova.conf
from nova import context as nova_context
+from nova.db.api import api as api_db_api
from nova.db.api import models as api_models
-from nova.db.main import api as db
+from nova.db.main import api as main_db_api
from nova import exception
from nova import objects
from nova.scheduler.client import report
@@ -177,7 +178,10 @@ class DbQuotaDriver(object):
# displaying used limits. They are always zero.
usages[resource.name] = {'in_use': 0}
else:
- if resource.name in db.quota_get_per_project_resources():
+ if (
+ resource.name in
+ main_db_api.quota_get_per_project_resources()
+ ):
count = resource.count_as_dict(context, project_id)
key = 'project'
else:
@@ -1045,7 +1049,7 @@ class QuotaEngine(object):
return 0
-@db.api_context_manager.reader
+@api_db_api.context_manager.reader
def _user_id_queued_for_delete_populated(context, project_id=None):
"""Determine whether user_id and queued_for_delete are set.