]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Ensure agent binding modules are loaded
authorKevin Benton <blak111@gmail.com>
Thu, 24 Dec 2015 08:29:08 +0000 (00:29 -0800)
committergaryk <gkotton@vmware.com>
Sun, 10 Jan 2016 14:09:38 +0000 (14:09 +0000)
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

neutron/db/l3_attrs_db.py
neutron/db/l3_db.py
neutron/db/models_v2.py

index 2f1b79a6ab80a9fde9d967e1f19d8a20bf3ea95d..258f39d3f8c137091fc20f03e6fa0eee7e77bec7 100644 (file)
@@ -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'))
 
index 5726a385c6b8a32ebf0357a3a2110f843664d606..c116da9b6acf53b7fd870382474ed44e569ca9cb 100644 (file)
@@ -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,
index f4e75a5d2cd77e66b273dd44596df9a1f7b3382f..03a3a82dc3f7cfc56bbe24960b3946204cbd61cc 100644 (file)
@@ -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__)