neutron/neutron
Ihar Hrachyshka 78e3dbc475 ipam: don't commit IPAllocation while IpamAllocation is rolled back
Don't mix old and new session management styles. Mixing them is not
guaranteed to work. The method is not switched to new enginefacade yet,
so stick to the old style. Since OVO create() method already opens a
nested transaction, do nothing in IPAM layer.

This change fixes an issue where sometimes, whenever
add_auto_addrs_on_network_ports raises a retriable exception like
StaleDataError, corresponding IPAllocation is still persisted in the
database without being rolled back and without the corresponding
IpamAllocation model persisted. Later, this situation may break port and
network deletion for resources affected by the issue, failing with the
following error:

Unable to find IP address 2003::f816:3eff:fed2:5006 on subnet
eed623f4-cbad-488c-b230-7f4a8b1514eb

It happens because whenever writer.using context manager exits, and it's
top level manager, it commits the changes to database. Since
writer.using doesn't know that it's being executed in scope of the old
facade .begin() call, it doesn't postpone commitment as needed.

The bug was introduced in Pike as part of the switch to the new
enginefacade (that was never fully completed), specifically by:
I50be115ea69f805b48b02aebe4259ec2c839830e

For existing setups that already have IPAllocation objects without
IpamAllocation counterparts, the solution is to remove those
dangling IPAllocations manually from the database. (That's of course
assuming they use Neutron DB IPAM plugin in the first place.)

Note: If we ever decide to remove nested transactions from OVO base
layer, we may need to revisit this code to keep ignore-on-failure
semantics.

Change-Id: Ic9e146f51d9a120011892828d3a67b0630f4c5ce
Closes-Bug: #1706750
(cherry picked from commit d4c4107164)
2017-12-21 07:21:40 -08:00
..
agent [Qos] ingress bandwidth limit by ovs is not accurate 2017-12-14 11:47:51 +00:00
api Stop logging versions on every agent update 2017-08-25 17:37:32 +00:00
callbacks Merge "service: add callback AFTER_SPAWN" 2017-05-20 09:09:12 +00:00
cmd Make use of -w argument for iptables calls 2017-09-06 15:28:11 +00:00
common DVR: Always initialize floating IP host 2017-10-04 20:24:20 +00:00
conf DVR: Provide options for DVR North/South routing centralized 2017-08-18 22:09:37 +00:00
core_extensions Fix default qos policy when creating network 2017-08-24 14:35:38 +00:00
db ipam: don't commit IPAllocation while IpamAllocation is rolled back 2017-12-21 07:21:40 -08:00
debug Make code follow log translation guideline 2017-08-14 10:53:33 -07:00
extensions Merge "Make code follow log translation guideline" into stable/pike 2017-08-18 23:56:26 +00:00
hacking hacking: Remove dead code 2017-07-19 13:43:44 +02:00
ipam Make code follow log translation guideline 2017-08-14 10:53:33 -07:00
locale Imported Translations from Zanata 2017-07-18 08:36:04 +00:00
notifiers Make code follow log translation guideline 2017-08-14 10:53:33 -07:00
objects Allow to set/modify network mtu 2017-08-11 00:57:34 +00:00
pecan_wsgi Dont log about skipping notification in normal case 2017-09-23 20:14:57 +00:00
plugins [Qos] Fix residues of ovs in ingress bw limit 2017-12-06 15:37:43 +08:00
privileged Make code follow log translation guideline 2017-08-14 10:53:33 -07:00
quota CountableResource: try count/get functions for all plugins 2017-09-12 16:23:22 +00:00
scheduler Avoid redundant HA port creation during migration 2017-09-11 19:56:19 +00:00
server Make code follow log translation guideline 2017-08-14 10:53:33 -07:00
services Move segment deletion back to PRECOMMIT_DELETE 2017-12-06 15:46:04 +00:00
tests Merge "Move segment deletion back to PRECOMMIT_DELETE" into stable/pike 2017-12-14 02:41:01 +00:00
__init__.py Hacking rule to check i18n usage 2016-03-30 21:28:37 -04:00
_i18n.py Make code follow log translation guideline 2017-08-14 10:53:33 -07:00
auth.py Use oslo.context class method to construct context object 2017-03-23 09:02:46 +00:00
manager.py Do not load default service plugins if core plugin is not DB based 2017-11-20 15:36:35 +00:00
neutron_plugin_base_v2.py Do not load default service plugins if core plugin is not DB based 2017-11-20 15:36:35 +00:00
opts.py fix missing l2pop config option docs 2017-10-23 17:40:00 +02:00
policy.py Log policy filters in one line 2017-08-23 21:23:01 +00:00
service.py Make code follow log translation guideline 2017-08-14 10:53:33 -07:00
version.py
worker.py replace WorkerSupportServiceMixin with neutron-lib's WorkerBase 2017-06-14 06:56:48 -06:00
wsgi.py Make code follow log translation guideline 2017-08-14 10:53:33 -07:00