Don't try to delete non-existent namespace

The namespace in the DHCP agent may already have been
deleted by a previous event when _destroy_namespace_and_port
is called (e.g. all subnets deleted from network and then network
is deleted). To avoid log errors every time this happens, check
for the existence of the namespace before trying to delete it.

Closes-Bug: #1627691
Change-Id: I204ba7a0de056f13af505541d67f0acdd70fd54d
This commit is contained in:
Kevin Benton 2016-09-24 01:53:38 -07:00
parent e17d8eca22
commit 98de72e9f3
1 changed files with 3 additions and 0 deletions

View File

@ -238,6 +238,9 @@ class DhcpLocalProcess(DhcpBase):
self.interface_name)
ns_ip = ip_lib.IPWrapper(namespace=self.network.namespace)
if not ns_ip.netns.exists(self.network.namespace):
LOG.debug("Namespace already deleted: %s", self.network.namespace)
return
try:
ns_ip.netns.delete(self.network.namespace)
except RuntimeError: