]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Avoid race condition for reserved DHCP ports
authorEugene Nikanorov <enikanorov@mirantis.com>
Mon, 19 Oct 2015 13:41:32 +0000 (17:41 +0400)
committerEugene Nikanorov <enikanorov@mirantis.com>
Mon, 16 Nov 2015 13:16:51 +0000 (17:16 +0400)
commitf76ef76f2516dad794818ce56fb15d16437f7314
tree52f43e106138ef60d87a69111f192bd9f27fdefb
parent948316190dd445ec387b391cd89b87c19d19b91b
Avoid race condition for reserved DHCP ports

This patch introduces mechanism similar to compare-and-swap
for updating reserved DHCP port.

This addresses a case when two DHCP agents that start nearly at
the same time are assigned to one network and there is a reserved
DHCP port in the network. Then each of agents will try to use it
because agents don't check if reserved port is still available.
Reserved DHCP port can be acquired by different agent between calls to
get_active_networks and update_port, so this patch adds a check for
this case.

Change-Id: I0277ab537ff9d3a664c03ea291b9ec2b0e784dbb
Closes-Bug: #1425402
neutron/agent/linux/dhcp.py
neutron/api/rpc/handlers/dhcp_rpc.py
neutron/common/exceptions.py
neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py