neutron/neutron/ipam
Pavel Bondar bf631b226d Always call ipam driver on subnet update
Backport contains two commits:
- 6ed8f45fdf had some negative impact on
  concurrency;
- 310074b2d4 fixes that negative impact;

COMMIT 1:
Previously ipam driver was not called on subnet update
if allocation_pools are not in request.
Changing it to call ipam driver each time subnet update is requested.
If subnet_update is called without allocation_pools, then old allocation
pools are passed to ipam driver.

Contains a bit of refactoring to make that happen:

- validate_allocation_pools is already called during update
subnet workflow in update_subnet method, so just removing it;

- reworked update_db_subnet workflow;

previous workflow was:
call driver allocation -> make local allocation -> rollback driver
allocation in except block if local allocation failed.

new workflow:
make local allocation -> call driver allocation.
By changing order of execution we eliminating need of rollback in this
method, since failure in local allocation is rolled back by database
transaction rollback.

- make a copy of incoming subnet dict;
_update_subnet_allocation_pools from ipam_backend_mixin removes
'allocation_pools' from subnet_dict, so create an unchanged copy to
pass it to ipam driver

COMMIT 2:
Check if pool update is needed in reference driver

Commit 6ed8f45fdf had some negative impact
on concurrent ip allocations. To make ipam driver aware of subnet
updates (mostly for thirdparty drivers) ipam driver is always called
with allocation pools even if pools are not changed.

Current way of handling that event is deleting old pools and creating
new pools. But on scale it may cause issues, because of this:
- deleting allocation pools removes availability ranges by foreign key;
- any ip allocation modifies availability range;
These events concurently modify availability range records causing
deadlocks.

This fix prevents deleting and recreating pools and availability ranges
in cases where allocation pools are not changed. So it eliminates
negative impact on concurency added by always calling ipam driver on
subnet update.
This fix aims to provide backportable solution to be used with
6ed8f45fdf.

Complete solution that eliminates concurrent modifications in
availability range table is expected to be devivered with
ticket #1543094, but it will not be backportable because of the scope of
the change.

Change-Id: Ie4bd85d2ff2ab39bf803c5ef6c6ead151dbb74d7
Closes-Bug: #1534625
Closes-Bug: #1572474
(cherry picked from commit 6ed8f45fdf)
(cherry picked from commit 7a586844ca4454c72876ec3084e4477ce521ece7)
2016-05-26 14:03:03 +00:00
..
drivers Always call ipam driver on subnet update 2016-05-26 14:03:03 +00:00
__init__.py Make IPAM more pythonic 2015-07-09 17:33:17 +00:00
driver.py Add Pluggable IPAM Backend Part 2 2015-07-24 10:31:39 +03:00
exceptions.py Change the exception type from ValueError to IpamValueInvalid 2016-02-26 14:19:43 +08:00
requests.py Change the exception type from ValueError to IpamValueInvalid 2016-02-26 14:19:43 +08:00
subnet_alloc.py Add a description field to all standard resources 2016-03-05 02:29:35 +00:00
utils.py Fix for adding gateway with IP outside subnet 2016-02-19 10:57:09 +05:30