Fix race condition updating routes

Generic driver updates routes on host according to the tap
interfaces created for use by share servers. That code
should be within a lock to prevent a thread failing to delete
a route previously listed and already deleted by another thread.

This change moves an existing lock to the function that
performs route changes while also covering the function
that had the lock before.

Closes-bug: #1617461

Change-Id: I798e5d9b0bc9ebefc8661d0ade720c60303cf484
This commit is contained in:
Rodrigo Barbieri 2016-08-26 18:13:00 -03:00
parent 7a16eb685b
commit 3e96712c47
2 changed files with 6 additions and 2 deletions

View File

@ -948,6 +948,8 @@ class NeutronNetworkHelper(BaseNetworkhelper):
device.route.clear_outdated_routes(subnet['cidr'])
self._plug_interface_in_host(interface_name, device, port)
@utils.synchronized("service_instance_plug_interface_in_host",
external=True)
def _plug_interface_in_host(self, interface_name, device, port):
self.vif_driver.plug(interface_name, port['id'], port['mac_address'])
@ -966,8 +968,6 @@ class NeutronNetworkHelper(BaseNetworkhelper):
# here we are checking for garbage devices from removed service port
self._remove_outdated_interfaces(device)
@utils.synchronized(
"service_instance_remove_outdated_interfaces", external=True)
def _remove_outdated_interfaces(self, device):
"""Finds and removes unused network device."""
device_cidr_set = self._get_set_of_device_cidrs(device)

View File

@ -0,0 +1,4 @@
---
fixes:
- Fixed race-condition in generic driver while updating
network routes in host.