Revert "use str names rather than classes for orm relationships"

This reverts commit dec28f6d2b.

We needed to revert this as it broke the nsx cleanup utility
for NSX|V. This broke the CI.

Change-Id: Iffb05ab0c0bcb8c8184a0c821dece1e88cdd3fb3
changes/50/554050/2
garyk 5 years ago
parent dec28f6d2b
commit ec9ff32ac6
  1. 2
      vmware_nsx/db/extended_security_group.py
  2. 3
      vmware_nsx/db/extended_security_group_rule.py
  3. 6
      vmware_nsx/db/nsx_models.py
  4. 10
      vmware_nsx/db/nsxv_models.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'))

@ -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'))

@ -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'))

@ -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'))

Loading…
Cancel
Save