summaryrefslogtreecommitdiff
path: root/nova/db/main/api.py
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2022-04-08 10:27:46 +0100
committerStephen Finucane <sfinucan@redhat.com>2022-04-08 15:56:59 +0100
commit287ef8d68973a50b611b443c97ed9c0d25226eb7 (patch)
tree1115d6e8eb661b7f774882cb2f2e5ed78607bf2b /nova/db/main/api.py
parent440fa6ab00994167b4e0b7643bf791e88f5c52d8 (diff)
downloadnova-287ef8d68973a50b611b443c97ed9c0d25226eb7.tar.gz
db: Remove inplicit coercion of SELECTs
Resolve the following RemovedIn20Warning warning: Implicit coercion of SELECT and textual SELECT constructs into FROM clauses is deprecated; please call .subquery() on any Core select or ORM Query object in order to produce a subquery object. This one was easy. Change-Id: Ifeab2aa8cef7ad151d5d5f92937e90ab34b96e8a Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'nova/db/main/api.py')
-rw-r--r--nova/db/main/api.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/nova/db/main/api.py b/nova/db/main/api.py
index 9ed9da6ccf..5ef693cbac 100644
--- a/nova/db/main/api.py
+++ b/nova/db/main/api.py
@@ -579,7 +579,7 @@ def _compute_node_select(context, filters=None, limit=None, marker=None):
if filters is None:
filters = {}
- cn_tbl = sa.alias(models.ComputeNode.__table__, name='cn')
+ cn_tbl = models.ComputeNode.__table__.alias('cn')
select = sa.select(cn_tbl)
if context.read_deleted == "no":
@@ -926,7 +926,7 @@ def compute_node_statistics(context):
engine = get_engine(context=context)
services_tbl = models.Service.__table__
- inner_sel = sa.alias(_compute_node_select(context), name='inner_sel')
+ inner_sel = _compute_node_select(context).alias('inner_sel')
# TODO(sbauza): Remove the service_id filter in a later release
# once we are sure that all compute nodes report the host field