NSX|v: Fix shared router clear gateway

When a shared router is the only router on an edge, and the gateway
is cleared, we should remove the static routes and default gateway
before removing the interface, or else the backend will fail because
the default gateway is illegal.

Change-Id: I7d1ff6e30d3e51f84d76292b76e550792c19315a
This commit is contained in:
Adit Sarfaty 2016-09-26 11:31:55 +03:00
parent 9959d18f44
commit cd5e0823c9

View File

@ -691,8 +691,18 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
self._unbind_router_on_edge(context, router_id)
is_migrated = True
else:
updated_routes = False
# Update external vnic if addr or mask is changed
if orgaddr != newaddr or orgmask != newmask:
# If external gateway is removed, the default
# gateway should be cleared before updating the
# interface, or else the backend will fail.
if (new_ext_net_id != org_ext_net_id and
new_ext_net_id is None):
self._update_routes_on_routers(
context, router_id, router_ids)
updated_routes = True
self._update_external_interface_on_routers(
context, router_id, router_ids)
@ -711,9 +721,10 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
context, router_id, router_ids,
allow_external=True)
# Update static routes in all.
self._update_routes_on_routers(
context, router_id, router_ids)
# Update static routes in all (if not updated yet).
if not updated_routes:
self._update_routes_on_routers(
context, router_id, router_ids)
if is_migrated:
self._bind_router_on_available_edge(
context, router_id, router.admin_state_up)