diff --git a/vmware_nsx/db/extended_security_group.py b/vmware_nsx/db/extended_security_group.py index f6d9ae3ba6..2885863d08 100644 --- a/vmware_nsx/db/extended_security_group.py +++ b/vmware_nsx/db/extended_security_group.py @@ -55,7 +55,7 @@ class NsxExtendedSecurityGroupProperties(model_base.BASEV2): nullable=False) policy = sa.Column(sa.String(36)) security_group = orm.relationship( - 'neutron.db.models.securitygroup.SecurityGroup', + securitygroups_db.SecurityGroup, backref=orm.backref('ext_properties', lazy='joined', uselist=False, cascade='delete')) diff --git a/vmware_nsx/db/extended_security_group_rule.py b/vmware_nsx/db/extended_security_group_rule.py index 1b8d8b45fd..fc39dd209e 100644 --- a/vmware_nsx/db/extended_security_group_rule.py +++ b/vmware_nsx/db/extended_security_group_rule.py @@ -19,6 +19,7 @@ from sqlalchemy import orm from neutron.db import _resource_extend as resource_extend from neutron.db import api as db_api +from neutron.db.models import securitygroup from neutron.extensions import securitygroup as ext_sg from neutron_lib.api import validators from neutron_lib import exceptions as nexception @@ -46,7 +47,7 @@ class NsxExtendedSecurityGroupRuleProperties(model_base.BASEV2): local_ip_prefix = sa.Column(sa.String(255), nullable=False) rule = orm.relationship( - 'neutron.db.models.securitygroup.SecurityGroupRule', + securitygroup.SecurityGroupRule, backref=orm.backref('ext_properties', lazy='joined', uselist=False, cascade='delete')) diff --git a/vmware_nsx/db/nsx_models.py b/vmware_nsx/db/nsx_models.py index 8b422bc9db..82e7aacb66 100644 --- a/vmware_nsx/db/nsx_models.py +++ b/vmware_nsx/db/nsx_models.py @@ -261,7 +261,7 @@ class MacLearningState(model_base.BASEV2, models.TimestampMixin): # Add a relationship to the Port model using the backref attribute. # This will instruct SQLAlchemy to eagerly load this association. port = orm.relationship( - 'neutron.db.models_v2.Port', + models_v2.Port, backref=orm.backref("mac_learning_state", lazy='joined', uselist=False, cascade='delete')) @@ -318,7 +318,7 @@ class PortQueueMapping(model_base.BASEV2, models.TimestampMixin): # Add a relationship to the Port model adding a backref which will # allow SQLAlchemy for eagerly load the queue binding port = orm.relationship( - 'neutron.db.models_v2.Port', + models_v2.Port, backref=orm.backref("qos_queue", uselist=False, cascade='delete', lazy='joined')) @@ -334,7 +334,7 @@ class NetworkQueueMapping(model_base.BASEV2, models.TimestampMixin): # Add a relationship to the Network model adding a backref which will # allow SQLAlcremy for eagerly load the queue binding network = orm.relationship( - 'neutron.db.models_v2.Network', + models_v2.Network, backref=orm.backref("qos_queue", uselist=False, cascade='delete', lazy='joined')) diff --git a/vmware_nsx/db/nsxv_models.py b/vmware_nsx/db/nsxv_models.py index ff7df3e792..9b5ae70a14 100644 --- a/vmware_nsx/db/nsxv_models.py +++ b/vmware_nsx/db/nsxv_models.py @@ -19,6 +19,8 @@ from neutron_lib.db import model_base import sqlalchemy as sa from sqlalchemy import orm +from neutron.db.models import l3 as l3_db +from neutron.db import models_v2 from oslo_db.sqlalchemy import models from vmware_nsx.common import nsxv_constants @@ -162,7 +164,7 @@ class NsxvRouterExtAttributes(model_base.BASEV2, models.TimestampMixin): # Add a relationship to the Router model in order to instruct # SQLAlchemy to eagerly load this association router = orm.relationship( - 'neutron.db.models.l3.Router', + l3_db.Router, backref=orm.backref("nsx_attributes", lazy='joined', uselist=False, cascade='delete')) @@ -216,7 +218,7 @@ class NsxvPortIndexMapping(model_base.BASEV2, models.TimestampMixin): # Add a relationship to the Port model in order to instruct SQLAlchemy to # eagerly read port vnic-index port = orm.relationship( - 'neutron.db.models_v2.Port', + models_v2.Port, backref=orm.backref("vnic_index", lazy='joined', uselist=False, cascade='delete')) @@ -342,7 +344,7 @@ class NsxvSubnetExtAttributes(model_base.BASEV2, models.TimestampMixin): # Add a relationship to the Subnet model in order to instruct # SQLAlchemy to eagerly load this association subnet = orm.relationship( - 'neutron.db.models_v2.Subnet', + models_v2.Subnet, backref=orm.backref("nsxv_subnet_attributes", lazy='joined', uselist=False, cascade='delete')) @@ -361,7 +363,7 @@ class NsxvPortExtAttributes(model_base.BASEV2, models.TimestampMixin): # Add a relationship to the port model in order to instruct # SQLAlchemy to eagerly load this association port = orm.relationship( - 'neutron.db.models_v2.Port', + models_v2.Port, backref=orm.backref("nsx_port_attributes", lazy='joined', uselist=False, cascade='delete'))