Ensure agent binding modules are loaded
This patch ensures that models_v2 and the router db module import the agent binding modules so their models are defined in the sqlalchemy metadata. Otherwise, using an agentless core/L3 plugin may result in a failure to initialize if nothing imported the agent module. Change-Id: I77240462b618d6e95c7c5862441d6d179e371f4f Closes-Bug: #1529022
This commit is contained in:
@@ -16,7 +16,6 @@ import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
|
||||
from neutron.db import db_base_plugin_v2
|
||||
from neutron.db import l3_db
|
||||
from neutron.db import model_base
|
||||
from neutron.extensions import l3
|
||||
|
||||
@@ -48,7 +47,7 @@ class RouterExtraAttributes(model_base.BASEV2):
|
||||
availability_zone_hints = sa.Column(sa.String(255))
|
||||
|
||||
router = orm.relationship(
|
||||
l3_db.Router,
|
||||
'Router',
|
||||
backref=orm.backref("extra_attributes", lazy='joined',
|
||||
uselist=False, cascade='delete'))
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ from neutron.common import exceptions as n_exc
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.common import rpc as n_rpc
|
||||
from neutron.common import utils
|
||||
from neutron.db import l3_agentschedulers_db as l3_agt
|
||||
from neutron.db import model_base
|
||||
from neutron.db import models_v2
|
||||
from neutron.extensions import external_net
|
||||
@@ -92,8 +93,9 @@ class Router(model_base.HasStandardAttributes, model_base.BASEV2,
|
||||
RouterPort,
|
||||
backref='router',
|
||||
lazy='dynamic')
|
||||
l3_agents = orm.relationship('Agent', lazy='joined', viewonly=True,
|
||||
secondary='routerl3agentbindings')
|
||||
l3_agents = orm.relationship(
|
||||
'Agent', lazy='joined', viewonly=True,
|
||||
secondary=l3_agt.RouterL3AgentBinding.__table__)
|
||||
|
||||
|
||||
class FloatingIP(model_base.HasStandardAttributes, model_base.BASEV2,
|
||||
|
||||
@@ -18,6 +18,7 @@ from sqlalchemy import orm
|
||||
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.common import constants
|
||||
from neutron.db import agentschedulers_db as agt
|
||||
from neutron.db import model_base
|
||||
from neutron.db import rbac_db_models
|
||||
|
||||
@@ -267,5 +268,6 @@ class Network(model_base.HasStandardAttributes, model_base.BASEV2,
|
||||
backref='network', lazy='joined',
|
||||
cascade='all, delete, delete-orphan')
|
||||
availability_zone_hints = sa.Column(sa.String(255))
|
||||
dhcp_agents = orm.relationship('Agent', lazy='joined', viewonly=True,
|
||||
secondary='networkdhcpagentbindings')
|
||||
dhcp_agents = orm.relationship(
|
||||
'Agent', lazy='joined', viewonly=True,
|
||||
secondary=agt.NetworkDhcpAgentBinding.__table__)
|
||||
|
||||
Reference in New Issue
Block a user