neutron/neutron/api
Kailun Qin b2418bc248 Block port update from unbound DHCP agent
Current DHCP port management in Neutron makes the server to clear the
device_id while the agent is responsible for setting it.

This may cause a potential race condition, for example during network
rescheduling. The server aims to clear the device_id on a DHCP port and
assign the network to another agent while the old agent might just be
taking possession of the port. If the DHCP agent takes possession of the
port (i.e., update port...set the device_id) before the server clears
it, then there is no issue. However, if this happens after the clear
operation by server then the DHCP port would be updated/marked to be
owned by the old agent.

When the new agent takes over the network scheduled to it, it won't be
able to find a port to reuse so that an extra port might need to be
created. This leads to two issues:
1) an extra port is created and never deleted;
2) the extra port creation may fail if there are no available IP
addresses.

This patch proposes a validation check to prevent an agent from updating
a DHCP port unless the network is bound to that agent.

Co-authored-by: Allain Legacy <Allain.legacy@windriver.com>

Conflicts:
	neutron/api/rpc/handlers/dhcp_rpc.py

Note(elod.illes): Conflict caused by missing patch (that consumes
constants from neutron_lib), which should not be backported:
Ie4bcffccf626a6e1de84af01f3487feb825f8b65

Closes-Bug: #1795126
Story: 2003919
Change-Id: Ie619516c07fb3dc9d025f64c0e1e59d5d808cb6f
(cherry picked from commit b70ee4df88)
(cherry picked from commit b9f9c021c9)
2019-02-05 13:39:00 +01:00
..
rpc Block port update from unbound DHCP agent 2019-02-05 13:39:00 +01:00
v2 Make code follow log translation guideline 2017-08-14 10:53:33 -07:00
views Add a new configuration variable for api links. 2017-04-18 15:16:41 +00:00
__init__.py Added API extensions to detect sorting/pagination features 2016-08-01 22:57:15 +02:00
api_common.py Make code follow log translation guideline 2017-08-14 10:53:33 -07:00
extensions.py Make code follow log translation guideline 2017-08-14 10:53:33 -07:00
versions.py Pecan: Get loaded by paste deploy 2017-02-17 14:54:27 -06:00