From 3754bba8068134b0c7be294efda02b8fa33341aa Mon Sep 17 00:00:00 2001 From: Ann Taraday Date: Mon, 8 Jun 2020 16:45:05 +0400 Subject: [PATCH] Validate that snat namespace exits in _create_dvr_gateway During rescheduling dvr router snat namespace may not be created due to race between router added and router updated updated notifications. Verify that snat namespace exits or create one. Partial-bug: 1881995 Change-Id: Ic28ce249d59264b0b882bd1cc3c9fb55854a6a47 --- neutron/agent/l3/dvr_edge_router.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/neutron/agent/l3/dvr_edge_router.py b/neutron/agent/l3/dvr_edge_router.py index b1ca09ecf7a..9efa7abf545 100644 --- a/neutron/agent/l3/dvr_edge_router.py +++ b/neutron/agent/l3/dvr_edge_router.py @@ -162,6 +162,13 @@ class DvrEdgeRouter(dvr_local_router.DvrLocalRouter): def _create_dvr_gateway(self, ex_gw_port, gw_interface_name): # connect snat_ports to br_int from SNAT namespace + + # NOTE(ataraday): Check if snat namespace exists, create if not - + # workaround for race between router_added and router_updated + # notifications https://launchpad.net/bugs/1881995 + if not self.snat_namespace.exists(): + self._create_snat_namespace() + for port in self.get_snat_interfaces(): self._plug_snat_port(port) self._external_gateway_added(ex_gw_port, gw_interface_name,