Browse Source

use neutron-lib for _model_query

The model_query module is in neutron-lib and the CommonDBMixin will
eventually be removed. This patch swiches use of the _model_query
method over to query_with_hooks from neutron-lib.

This patch also bumps the neutron-lib version up to 1.20.0

Change-Id: Ie8e9123cb2c58b4bde717648f2cfff7664da434e
Boden R 5 months ago
parent
commit
3fff6bb5f3
3 changed files with 5 additions and 4 deletions
  1. 1
    1
      lower-constraints.txt
  2. 3
    2
      neutron_lbaas/db/loadbalancer/loadbalancer_dbv2.py
  3. 1
    1
      requirements.txt

+ 1
- 1
lower-constraints.txt View File

@@ -52,7 +52,7 @@ msgpack-python==0.4.0
52 52
 munch==2.1.0
53 53
 netaddr==0.7.18
54 54
 netifaces==0.10.4
55
-neutron-lib==1.18.0
55
+neutron-lib==1.20.0
56 56
 neutron==12.0.0
57 57
 openstackdocstheme==1.18.1
58 58
 openstacksdk==0.11.2

+ 3
- 2
neutron_lbaas/db/loadbalancer/loadbalancer_dbv2.py View File

@@ -23,6 +23,7 @@ from neutron_lib.callbacks import registry
23 23
 from neutron_lib.callbacks import resources
24 24
 from neutron_lib import constants as n_const
25 25
 from neutron_lib.db import api as db_api
26
+from neutron_lib.db import model_query
26 27
 from neutron_lib import exceptions as n_exc
27 28
 from neutron_lib.plugins import constants as pg_const
28 29
 from neutron_lib.plugins import directory
@@ -68,7 +69,7 @@ class LoadBalancerPluginDbv2(base_db.CommonDbMixin,
68 69
                 # To lock the instance for update, return a single
69 70
                 # instance, instead of an instance with LEFT OUTER
70 71
                 # JOINs that do not work in PostgreSQL
71
-                query = self._model_query(context, model).options(
72
+                query = model_query.query_with_hooks(context, model).options(
72 73
                     lazyload('*')
73 74
                 ).filter(
74 75
                     model.id == id).with_lockmode('update')
@@ -252,7 +253,7 @@ class LoadBalancerPluginDbv2(base_db.CommonDbMixin,
252 253
         with context.session.begin(subtransactions=True):
253 254
             if issubclass(model, models.LoadBalancer):
254 255
                 try:
255
-                    model_db = (self._model_query(context, model).
256
+                    model_db = (model_query.query_with_hooks(context, model).
256 257
                                 filter(model.id == id).
257 258
                                 options(orm.noload('vip_port')).
258 259
                                 one())

+ 1
- 1
requirements.txt View File

@@ -6,7 +6,7 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0
6 6
 eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT
7 7
 requests>=2.14.2 # Apache-2.0
8 8
 netaddr>=0.7.18 # BSD
9
-neutron-lib>=1.18.0 # Apache-2.0
9
+neutron-lib>=1.20.0 # Apache-2.0
10 10
 neutron>=12.0.0 # Apache-2.0
11 11
 SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT
12 12
 alembic>=0.8.10 # MIT

Loading…
Cancel
Save