Merge "stop using common db mixin"
This commit is contained in:
commit
0c8a451a9d
|
@ -17,7 +17,6 @@ import re
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
from neutron.common import ipv6_utils
|
from neutron.common import ipv6_utils
|
||||||
from neutron.db import common_db_mixin as base_db
|
|
||||||
from neutron_lib.callbacks import events
|
from neutron_lib.callbacks import events
|
||||||
from neutron_lib.callbacks import registry
|
from neutron_lib.callbacks import registry
|
||||||
from neutron_lib.callbacks import resources
|
from neutron_lib.callbacks import resources
|
||||||
|
@ -50,8 +49,7 @@ from neutron_lbaas.services.loadbalancer import data_models
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class LoadBalancerPluginDbv2(base_db.CommonDbMixin,
|
class LoadBalancerPluginDbv2(agent_scheduler.LbaasAgentSchedulerDbMixin):
|
||||||
agent_scheduler.LbaasAgentSchedulerDbMixin):
|
|
||||||
"""Wraps loadbalancer with SQLAlchemy models.
|
"""Wraps loadbalancer with SQLAlchemy models.
|
||||||
|
|
||||||
A class that wraps the implementation of the Neutron loadbalancer
|
A class that wraps the implementation of the Neutron loadbalancer
|
||||||
|
@ -75,7 +73,7 @@ class LoadBalancerPluginDbv2(base_db.CommonDbMixin,
|
||||||
model.id == id).with_lockmode('update')
|
model.id == id).with_lockmode('update')
|
||||||
resource = query.one()
|
resource = query.one()
|
||||||
else:
|
else:
|
||||||
resource = self._get_by_id(context, model, id)
|
resource = model_query.get_by_id(context, model, id)
|
||||||
except exc.NoResultFound:
|
except exc.NoResultFound:
|
||||||
with excutils.save_and_reraise_exception(reraise=False) as ctx:
|
with excutils.save_and_reraise_exception(reraise=False) as ctx:
|
||||||
if issubclass(model, (models.LoadBalancer, models.Listener,
|
if issubclass(model, (models.LoadBalancer, models.Listener,
|
||||||
|
@ -90,14 +88,14 @@ class LoadBalancerPluginDbv2(base_db.CommonDbMixin,
|
||||||
|
|
||||||
def _resource_exists(self, context, model, id):
|
def _resource_exists(self, context, model, id):
|
||||||
try:
|
try:
|
||||||
self._get_by_id(context, model, id)
|
model_query.get_by_id(context, model, id)
|
||||||
except exc.NoResultFound:
|
except exc.NoResultFound:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _get_resources(self, context, model, filters=None, options=None):
|
def _get_resources(self, context, model, filters=None, options=None):
|
||||||
query = self._get_collection_query(context, model,
|
query = model_query.get_collection_query(context, model,
|
||||||
filters=filters)
|
filters=filters)
|
||||||
if options:
|
if options:
|
||||||
query = query.options(options)
|
query = query.options(options)
|
||||||
return [model_instance for model_instance in query]
|
return [model_instance for model_instance in query]
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron.db import agents_db
|
from neutron.db import agents_db
|
||||||
from neutron.db import common_db_mixin
|
|
||||||
from neutron.services import provider_configuration as provconf
|
from neutron.services import provider_configuration as provconf
|
||||||
from neutron_lib import exceptions as n_exc
|
from neutron_lib import exceptions as n_exc
|
||||||
from neutron_lib import rpc as n_rpc
|
from neutron_lib import rpc as n_rpc
|
||||||
|
@ -163,8 +162,7 @@ class LoadBalancerAgentApi(object):
|
||||||
|
|
||||||
|
|
||||||
class LoadBalancerManager(driver_base.BaseLoadBalancerManager,
|
class LoadBalancerManager(driver_base.BaseLoadBalancerManager,
|
||||||
agent_scheduler_v2.LbaasAgentSchedulerDbMixin,
|
agent_scheduler_v2.LbaasAgentSchedulerDbMixin):
|
||||||
common_db_mixin.CommonDbMixin):
|
|
||||||
def __init__(self, driver):
|
def __init__(self, driver):
|
||||||
super(LoadBalancerManager, self).__init__(driver)
|
super(LoadBalancerManager, self).__init__(driver)
|
||||||
self.db = ldbv2.LoadBalancerPluginDbv2()
|
self.db = ldbv2.LoadBalancerPluginDbv2()
|
||||||
|
|
Loading…
Reference in New Issue