Browse Source

Merge "stop using common db mixin"

Zuul 1 month ago
parent
commit
0c8a451a9d

+ 5
- 7
neutron_lbaas/db/loadbalancer/loadbalancer_dbv2.py View File

@@ -17,7 +17,6 @@ import re
17 17
 
18 18
 import netaddr
19 19
 from neutron.common import ipv6_utils
20
-from neutron.db import common_db_mixin as base_db
21 20
 from neutron_lib.callbacks import events
22 21
 from neutron_lib.callbacks import registry
23 22
 from neutron_lib.callbacks import resources
@@ -50,8 +49,7 @@ from neutron_lbaas.services.loadbalancer import data_models
50 49
 LOG = logging.getLogger(__name__)
51 50
 
52 51
 
53
-class LoadBalancerPluginDbv2(base_db.CommonDbMixin,
54
-                             agent_scheduler.LbaasAgentSchedulerDbMixin):
52
+class LoadBalancerPluginDbv2(agent_scheduler.LbaasAgentSchedulerDbMixin):
55 53
     """Wraps loadbalancer with SQLAlchemy models.
56 54
 
57 55
     A class that wraps the implementation of the Neutron loadbalancer
@@ -75,7 +73,7 @@ class LoadBalancerPluginDbv2(base_db.CommonDbMixin,
75 73
                     model.id == id).with_lockmode('update')
76 74
                 resource = query.one()
77 75
             else:
78
-                resource = self._get_by_id(context, model, id)
76
+                resource = model_query.get_by_id(context, model, id)
79 77
         except exc.NoResultFound:
80 78
             with excutils.save_and_reraise_exception(reraise=False) as ctx:
81 79
                 if issubclass(model, (models.LoadBalancer, models.Listener,
@@ -90,14 +88,14 @@ class LoadBalancerPluginDbv2(base_db.CommonDbMixin,
90 88
 
91 89
     def _resource_exists(self, context, model, id):
92 90
         try:
93
-            self._get_by_id(context, model, id)
91
+            model_query.get_by_id(context, model, id)
94 92
         except exc.NoResultFound:
95 93
             return False
96 94
         return True
97 95
 
98 96
     def _get_resources(self, context, model, filters=None, options=None):
99
-        query = self._get_collection_query(context, model,
100
-                                           filters=filters)
97
+        query = model_query.get_collection_query(context, model,
98
+                                                 filters=filters)
101 99
         if options:
102 100
             query = query.options(options)
103 101
         return [model_instance for model_instance in query]

+ 1
- 3
neutron_lbaas/drivers/common/agent_driver_base.py View File

@@ -13,7 +13,6 @@
13 13
 #    under the License.
14 14
 
15 15
 from neutron.db import agents_db
16
-from neutron.db import common_db_mixin
17 16
 from neutron.services import provider_configuration as provconf
18 17
 from neutron_lib import exceptions as n_exc
19 18
 from neutron_lib import rpc as n_rpc
@@ -163,8 +162,7 @@ class LoadBalancerAgentApi(object):
163 162
 
164 163
 
165 164
 class LoadBalancerManager(driver_base.BaseLoadBalancerManager,
166
-                          agent_scheduler_v2.LbaasAgentSchedulerDbMixin,
167
-                          common_db_mixin.CommonDbMixin):
165
+                          agent_scheduler_v2.LbaasAgentSchedulerDbMixin):
168 166
     def __init__(self, driver):
169 167
         super(LoadBalancerManager, self).__init__(driver)
170 168
         self.db = ldbv2.LoadBalancerPluginDbv2()

Loading…
Cancel
Save