port usage tracking not reliable anymore

Bug #1497459 reported by Salvatore Orlando
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Salvatore Orlando

Bug Description

Patch https://review.openstack.org/#/c/188883/23 modified neutron.db.ipam_backend in order to ensure a sqlalchemy event is triggered when deleting a port. This caused an issue when transaction isolation level is below repeatable read as the sqlalchemy ORM mapper throws an exception if the record is deleted by another transaction.
Patch https://review.openstack.org/#/c/224289/ fixed this but reinstated query.delete which does not trigger the sqlalchemy event.

It might be worth considering just handling the sqlalchemy orm exception in this case; alternatively usage tracking for ports might be disabled.

A related question is why the logic for deleting a port resides in the ipam module, but probably it should not be answered here.

Revision history for this message
Salvatore Orlando (salvatore-orlando) wrote :

the impact of this bug is not really serious anyway.
After a delete the quota tracker is not marked as dirty, and therefore it reports an incorrect, but higher usage data.
As a result a tenant might not be allowed to use all of its quota (but just total - 1). This would however be fixed by the next get operation.

I'm therefore downgrading the severity to medium.

Changed in neutron:
importance: High → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
status: New → In Progress
Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

Another related question is why didn't we catch this with a test?

Kyle Mestery (mestery)
Changed in neutron:
importance: Medium → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/225349
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=0cf620bdf945527077f9875a1849e71ec0d1c6b2
Submitter: Jenkins
Branch: master

commit 0cf620bdf945527077f9875a1849e71ec0d1c6b2
Author: Salvatore Orlando <email address hidden>
Date: Fri Sep 18 14:57:21 2015 -0700

    delete_port: ensure quota usage is marked as dirty

    To this aim the ORM session mapper must be used.
    This patch simply uses context.session.delete rather than
    query.delete, and handles UnmappedInstanceError to safely
    complete the operation when the record is deleted by
    another transaction.

    Change-Id: I55c701fc1e2fda4461501aae532bbe11cce45b75
    Closes-Bug: #1497459

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: liberty-rc1 → 7.0.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.