uselist should be True to DVRPortBinding orm.relationship

Bug #1540259 reported by ZongKai LI on 2016-02-01
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Low
ZongKai LI

Bug Description

In DVR scenario, after a router interface has been bound to multiple hosts, when we remove this interface from router, in neutron server log, SQL warning will raise:
  SAWarning: Multiple rows returned with uselist=False for eagerly-loaded attribute 'Port.dvr_port_binding'

it's caused by https://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/models.py#L130, uselist is set to False. But indeed, table ml2_dvr_port_bindings stores all bindings for router_interface_distributed ports, and for a that kind of port, it could have multiple bindings. So it's not a one-to-one relationship, we should remove "uselist=False" in DVRPortBinding port orm.relationship.

ZongKai LI (zongkai) on 2016-02-01
Changed in neutron:
assignee: nobody → ZongKai LI (lzklibj)

Fix proposed to branch: master
Review: https://review.openstack.org/274550

Changed in neutron:
status: New → In Progress
Changed in neutron:
importance: Undecided → Low
Miguel Lavalle (minsel) on 2016-02-01
tags: added: l3-dvr-backlog

Reviewed: https://review.openstack.org/274550
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=951dd5e015cbd102aed80a6808f623b4626e727d
Submitter: Jenkins
Branch: master

commit 951dd5e015cbd102aed80a6808f623b4626e727d
Author: lzklibj <email address hidden>
Date: Mon Feb 1 16:39:54 2016 +0800

    Fix port relationship for DVRPortBinding

    uselist=False is used for one to one relationship, but for
    DVRPortBinding, a router_interface_distributed port can have
    multiple bindings. That causes SAWarning:
    Multiple rows returned with uselist=False for lazily-loaded attribute
    'Port.dvr_port_binding'.

    "uselist=False" is misused in DVRPortBinding port relationship,
    this patch will fix this.

    Change-Id: I2b00d96aaa445e0977bc3d4957d35a28d44dd953
    Closes-Bug: #1540259

Changed in neutron:
status: In Progress → Fix Released

This issue was fixed in the openstack/neutron 8.0.0.0b3 development milestone.

Reviewed: https://review.openstack.org/285385
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=0bce029749d931d19926504478aec1dfea9b52d5
Submitter: Jenkins
Branch: stable/liberty

commit 0bce029749d931d19926504478aec1dfea9b52d5
Author: lzklibj <email address hidden>
Date: Mon Feb 1 16:39:54 2016 +0800

    Fix port relationship for DVRPortBinding

    uselist=False is used for one to one relationship, but for
    DVRPortBinding, a router_interface_distributed port can have
    multiple bindings. That causes SAWarning:
    Multiple rows returned with uselist=False for lazily-loaded attribute
    'Port.dvr_port_binding'.

    "uselist=False" is misused in DVRPortBinding port relationship,
    this patch will fix this.

    Change-Id: I2b00d96aaa445e0977bc3d4957d35a28d44dd953
    Closes-Bug: #1540259
    (cherry picked from commit 951dd5e015cbd102aed80a6808f623b4626e727d)

tags: added: in-stable-liberty

This issue was fixed in the openstack/neutron 7.1.0 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers