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,6 +99,7 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
|||||||
self._notify_before_router_edge_association(context, router_db)
|
self._notify_before_router_edge_association(context, router_db)
|
||||||
with locking.LockManager.get_lock(str(edge_id)):
|
with locking.LockManager.get_lock(str(edge_id)):
|
||||||
self._remove_router_services_on_edge(context, router_id)
|
self._remove_router_services_on_edge(context, router_id)
|
||||||
|
with locking.LockManager.get_lock('nsx-shared-router-pool'):
|
||||||
self._unbind_router_on_edge(context, router_id)
|
self._unbind_router_on_edge(context, router_id)
|
||||||
|
|
||||||
def attach_router(self, context, router_id, router, appliance_size=None):
|
def attach_router(self, context, router_id, router, appliance_size=None):
|
||||||
@ -335,6 +336,8 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
|||||||
self._notify_before_router_edge_association(context, router_db)
|
self._notify_before_router_edge_association(context, router_db)
|
||||||
with locking.LockManager.get_lock(str(edge_id)):
|
with locking.LockManager.get_lock(str(edge_id)):
|
||||||
self._remove_router_services_on_edge(context, router_id)
|
self._remove_router_services_on_edge(context, router_id)
|
||||||
|
with locking.LockManager.get_lock(
|
||||||
|
'nsx-shared-router-pool'):
|
||||||
self._unbind_router_on_edge(context, router_id)
|
self._unbind_router_on_edge(context, router_id)
|
||||||
self._bind_router_on_available_edge(
|
self._bind_router_on_available_edge(
|
||||||
context, router_id, router_db.admin_state_up)
|
context, router_id, router_db.admin_state_up)
|
||||||
@ -714,6 +717,8 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
|||||||
if is_migrated:
|
if is_migrated:
|
||||||
self._remove_router_services_on_edge(context,
|
self._remove_router_services_on_edge(context,
|
||||||
router_id)
|
router_id)
|
||||||
|
with locking.LockManager.get_lock(
|
||||||
|
'nsx-shared-router-pool'):
|
||||||
self._unbind_router_on_edge(context, router_id)
|
self._unbind_router_on_edge(context, router_id)
|
||||||
|
|
||||||
if not is_migrated:
|
if not is_migrated:
|
||||||
@ -724,6 +729,8 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
|||||||
# changed.
|
# changed.
|
||||||
self._remove_router_services_on_edge(context,
|
self._remove_router_services_on_edge(context,
|
||||||
router_id)
|
router_id)
|
||||||
|
with locking.LockManager.get_lock(
|
||||||
|
'nsx-shared-router-pool'):
|
||||||
self._unbind_router_on_edge(context, router_id)
|
self._unbind_router_on_edge(context, router_id)
|
||||||
is_migrated = True
|
is_migrated = True
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user