Fix shared routers locks
binding/unbinding shared routers on edges should be done under a lock on the shared routers pool, since it affects edge selection for other routers. This patch adds the lock for some unbind actions where it was missing. Change-Id: Id0f42ae38ef4af5ff0d6fa1d24b4627166c446f7
This commit is contained in:
parent
2caa2dd076
commit
4aacaaad04
@ -99,7 +99,8 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
||||
self._notify_before_router_edge_association(context, router_db)
|
||||
with locking.LockManager.get_lock(str(edge_id)):
|
||||
self._remove_router_services_on_edge(context, router_id)
|
||||
self._unbind_router_on_edge(context, router_id)
|
||||
with locking.LockManager.get_lock('nsx-shared-router-pool'):
|
||||
self._unbind_router_on_edge(context, router_id)
|
||||
|
||||
def attach_router(self, context, router_id, router, appliance_size=None):
|
||||
# find the right place to add, and create a new one if necessary
|
||||
@ -335,7 +336,9 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
||||
self._notify_before_router_edge_association(context, router_db)
|
||||
with locking.LockManager.get_lock(str(edge_id)):
|
||||
self._remove_router_services_on_edge(context, router_id)
|
||||
self._unbind_router_on_edge(context, router_id)
|
||||
with locking.LockManager.get_lock(
|
||||
'nsx-shared-router-pool'):
|
||||
self._unbind_router_on_edge(context, router_id)
|
||||
self._bind_router_on_available_edge(
|
||||
context, router_id, router_db.admin_state_up)
|
||||
new_edge_id = edge_utils.get_router_edge_id(context,
|
||||
@ -714,7 +717,9 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
||||
if is_migrated:
|
||||
self._remove_router_services_on_edge(context,
|
||||
router_id)
|
||||
self._unbind_router_on_edge(context, router_id)
|
||||
with locking.LockManager.get_lock(
|
||||
'nsx-shared-router-pool'):
|
||||
self._unbind_router_on_edge(context, router_id)
|
||||
|
||||
if not is_migrated:
|
||||
ext_net_ids = self._get_ext_net_ids(context, router_ids)
|
||||
@ -724,7 +729,9 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
||||
# changed.
|
||||
self._remove_router_services_on_edge(context,
|
||||
router_id)
|
||||
self._unbind_router_on_edge(context, router_id)
|
||||
with locking.LockManager.get_lock(
|
||||
'nsx-shared-router-pool'):
|
||||
self._unbind_router_on_edge(context, router_id)
|
||||
is_migrated = True
|
||||
else:
|
||||
updated_routes = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user