network fetched from DB has deleted subnets in it during db-retry of subnet_create

Bug #1699500 reported by Wim De Clercq
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
New
Undecided
Unassigned

Bug Description

Only seen in Newton
Possibly related bug: https://bugs.launchpad.net/neutron/+bug/1596075

When a retriable database error occurs in a mechanism driver's subnet_create_postcommit, you get the error saying subnet overlaps with another subnet.

What's happening is:

1) mech driver's DB error is caught. Subnet that is created previously gets deleted in ml2plugin.
2) retry wrapper retries the create_subnet method
3) in db_base_plugin_v2#_create_subnet(self, context, subnet, subnetpool_id) method the network is fetched:

    network = self._get_network(context, s["network_id"])

4) This network contains the subnet that was deleted in step 1.

It is related to the backref present in Newton:
https://github.com/openstack/neutron/blob/stable/newton/neutron/db/models_v2.py#L245

which is not present in Ocata onwards. And more specifically, the lazy='subquery' is causing it'. Leaving the lazy parameter out avoids this issue as well.

As it currently is, the DB-retry can't work when DB errors happen in postcommit.

Tags: newton
Anusha K (anusha25)
Changed in neutron:
assignee: nobody → Anusha K (anusha25)
Anusha K (anusha25)
Changed in neutron:
assignee: Anusha K (anusha25) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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