At present there is no clear way to distinguish when the snat_namespace
object is initialized and when the actual namespace is created.
There is no way to check if the namespace already existed. The
code was only checking at the snat_namespace object instead of its
existence.
This patch addresses the issue by adding in an exists method to the
namespace object to identify the existence of the namespace in the
given agent.
This would allow us to check for the existence of the namespace,
and also allow us to identify the stale snat namespace and
delete the namespace when the gateway is cleared as the agent restarts.
This also applies for conditions when the router is manually moved
from one agent to another agent while the agent is dead. When the
agent wakes up it would clean up the stale snat namespace.
Closes-Bug: #1557909
(cherry picked from commit acd04d668b)
Conflicts:
neutron/agent/l3/agent.py
neutron/agent/l3/dvr_edge_ha_router.py
neutron/agent/l3/dvr_edge_router.py
neutron/tests/functional/agent/l3/test_dvr_router.py
Change-Id: Icb00297208813436c2a9e9a003275462293ad643