Browse Source

Set "floatingip.fixed_port" as viewonly

Set "floatingip.fixed_port" attribute as
viewonly. According to [1], "the originating relationship for a
particular state change will not produce state changes within the
viewonly relationship". That means any change on any of those ports
won't change the backref and won't affect "floatingip" object.

Closes-Bug: #1930294

[1]https://docs.sqlalchemy.org/en/14/orm/relationship_api.html

Change-Id: I202a12f82f70b1094cdb986ba404f396d5e0e427
(cherry picked from commit a98fe51b83)
changes/39/801339/1
Rodolfo Alonso Hernandez 4 months ago
parent
commit
d8f1f1118d
  1. 6
      neutron/db/models/l3.py

6
neutron/db/models/l3.py

@ -88,11 +88,11 @@ class FloatingIP(standard_attr.HasStandardAttributes, model_base.BASEV2,
port = orm.relationship(models_v2.Port,
backref=orm.backref('floating_ips',
cascade='all,delete-orphan'),
foreign_keys='FloatingIP.floating_port_id')
foreign_keys=floating_port_id)
fixed_port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id'))
fixed_port = orm.relationship(models_v2.Port,
foreign_keys='FloatingIP.fixed_port_id',
lazy='joined')
foreign_keys=fixed_port_id,
lazy='joined', viewonly=True)
fixed_ip_address = sa.Column(sa.String(64))
router_id = sa.Column(sa.String(36), sa.ForeignKey('routers.id'))
# Additional attribute for keeping track of the router where the floating

Loading…
Cancel
Save