summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-15 03:50:18 +0000
committerGerrit Code Review <review@openstack.org>2017-06-15 03:50:18 +0000
commit7b44b00b9ec2f0ec15e7bb1b179277043aaaaeb4 (patch)
treedfb225942fa1497b4e76020257d6fef3a34aeec2
parent8275f13dd73e836be0b9055b107aa75488552df9 (diff)
parentb744172fb8b96e6779ebc286d55d650788390a20 (diff)
Merge "Ignore gre devices in namespaces when cleaning up devices" into stable/ocata
-rw-r--r--neutron/agent/l3/dvr_edge_router.py3
-rw-r--r--neutron/agent/l3/dvr_fip_ns.py3
-rw-r--r--neutron/agent/l3/dvr_snat_ns.py3
-rw-r--r--neutron/agent/l3/namespaces.py3
-rw-r--r--neutron/agent/l3/router_info.py3
-rw-r--r--neutron/agent/linux/dhcp.py3
-rw-r--r--neutron/cmd/netns_cleanup.py3
-rw-r--r--neutron/tests/unit/cmd/test_netns_cleanup.py3
8 files changed, 16 insertions, 8 deletions
diff --git a/neutron/agent/l3/dvr_edge_router.py b/neutron/agent/l3/dvr_edge_router.py
index c4416d7..11f31bc 100644
--- a/neutron/agent/l3/dvr_edge_router.py
+++ b/neutron/agent/l3/dvr_edge_router.py
@@ -251,7 +251,8 @@ class DvrEdgeRouter(dvr_local_router.DvrLocalRouter):
251 return 251 return
252 252
253 ns_ip = ip_lib.IPWrapper(namespace=self.snat_namespace.name) 253 ns_ip = ip_lib.IPWrapper(namespace=self.snat_namespace.name)
254 for d in ns_ip.get_devices(exclude_loopback=True): 254 for d in ns_ip.get_devices(exclude_loopback=True,
255 exclude_gre_devices=True):
255 if (d.name.startswith(router.EXTERNAL_DEV_PREFIX) and 256 if (d.name.startswith(router.EXTERNAL_DEV_PREFIX) and
256 d.name != interface_name): 257 d.name != interface_name):
257 LOG.debug('Deleting stale external router device: %s', d.name) 258 LOG.debug('Deleting stale external router device: %s', d.name)
diff --git a/neutron/agent/l3/dvr_fip_ns.py b/neutron/agent/l3/dvr_fip_ns.py
index 9bae5c6..8d22b02 100644
--- a/neutron/agent/l3/dvr_fip_ns.py
+++ b/neutron/agent/l3/dvr_fip_ns.py
@@ -207,7 +207,8 @@ class FipNamespace(namespaces.Namespace):
207 @namespaces.check_ns_existence 207 @namespaces.check_ns_existence
208 def _delete(self): 208 def _delete(self):
209 ip_wrapper = ip_lib.IPWrapper(namespace=self.name) 209 ip_wrapper = ip_lib.IPWrapper(namespace=self.name)
210 for d in ip_wrapper.get_devices(exclude_loopback=True): 210 for d in ip_wrapper.get_devices(exclude_loopback=True,
211 exclude_gre_devices=True):
211 if d.name.startswith(FIP_2_ROUTER_DEV_PREFIX): 212 if d.name.startswith(FIP_2_ROUTER_DEV_PREFIX):
212 # internal link between IRs and FIP NS 213 # internal link between IRs and FIP NS
213 ip_wrapper.del_veth(d.name) 214 ip_wrapper.del_veth(d.name)
diff --git a/neutron/agent/l3/dvr_snat_ns.py b/neutron/agent/l3/dvr_snat_ns.py
index f22e717..085dc5c 100644
--- a/neutron/agent/l3/dvr_snat_ns.py
+++ b/neutron/agent/l3/dvr_snat_ns.py
@@ -41,7 +41,8 @@ class SnatNamespace(namespaces.Namespace):
41 @namespaces.check_ns_existence 41 @namespaces.check_ns_existence
42 def delete(self): 42 def delete(self):
43 ns_ip = ip_lib.IPWrapper(namespace=self.name) 43 ns_ip = ip_lib.IPWrapper(namespace=self.name)
44 for d in ns_ip.get_devices(exclude_loopback=True): 44 for d in ns_ip.get_devices(exclude_loopback=True,
45 exclude_gre_devices=True):
45 if d.name.startswith(constants.SNAT_INT_DEV_PREFIX): 46 if d.name.startswith(constants.SNAT_INT_DEV_PREFIX):
46 LOG.debug('Unplugging DVR device %s', d.name) 47 LOG.debug('Unplugging DVR device %s', d.name)
47 self.driver.unplug(d.name, namespace=self.name, 48 self.driver.unplug(d.name, namespace=self.name,
diff --git a/neutron/agent/l3/namespaces.py b/neutron/agent/l3/namespaces.py
index e70d7bb..f65c706 100644
--- a/neutron/agent/l3/namespaces.py
+++ b/neutron/agent/l3/namespaces.py
@@ -123,7 +123,8 @@ class RouterNamespace(Namespace):
123 @check_ns_existence 123 @check_ns_existence
124 def delete(self): 124 def delete(self):
125 ns_ip = ip_lib.IPWrapper(namespace=self.name) 125 ns_ip = ip_lib.IPWrapper(namespace=self.name)
126 for d in ns_ip.get_devices(exclude_loopback=True): 126 for d in ns_ip.get_devices(exclude_loopback=True,
127 exclude_gre_devices=True):
127 if d.name.startswith(INTERNAL_DEV_PREFIX): 128 if d.name.startswith(INTERNAL_DEV_PREFIX):
128 # device is on default bridge 129 # device is on default bridge
129 self.driver.unplug(d.name, namespace=self.name, 130 self.driver.unplug(d.name, namespace=self.name,
diff --git a/neutron/agent/l3/router_info.py b/neutron/agent/l3/router_info.py
index 3cf77a0..121aa5c 100644
--- a/neutron/agent/l3/router_info.py
+++ b/neutron/agent/l3/router_info.py
@@ -465,7 +465,8 @@ class RouterInfo(object):
465 465
466 def _get_existing_devices(self): 466 def _get_existing_devices(self):
467 ip_wrapper = ip_lib.IPWrapper(namespace=self.ns_name) 467 ip_wrapper = ip_lib.IPWrapper(namespace=self.ns_name)
468 ip_devs = ip_wrapper.get_devices(exclude_loopback=True) 468 ip_devs = ip_wrapper.get_devices(exclude_loopback=True,
469 exclude_gre_devices=True)
469 return [ip_dev.name for ip_dev in ip_devs] 470 return [ip_dev.name for ip_dev in ip_devs]
470 471
471 @staticmethod 472 @staticmethod
diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py
index 52b4bd3..8d4d90a 100644
--- a/neutron/agent/linux/dhcp.py
+++ b/neutron/agent/linux/dhcp.py
@@ -1337,7 +1337,8 @@ class DeviceManager(object):
1337 ns_ip = ip_lib.IPWrapper(namespace=network.namespace) 1337 ns_ip = ip_lib.IPWrapper(namespace=network.namespace)
1338 if not ns_ip.netns.exists(network.namespace): 1338 if not ns_ip.netns.exists(network.namespace):
1339 return 1339 return
1340 for d in ns_ip.get_devices(exclude_loopback=True): 1340 for d in ns_ip.get_devices(exclude_loopback=True,
1341 exclude_gre_devices=True):
1341 # delete all devices except current active DHCP port device 1342 # delete all devices except current active DHCP port device
1342 if d.name != skip_dev_name: 1343 if d.name != skip_dev_name:
1343 LOG.debug("Found stale device %s, deleting", d.name) 1344 LOG.debug("Found stale device %s, deleting", d.name)
diff --git a/neutron/cmd/netns_cleanup.py b/neutron/cmd/netns_cleanup.py
index 1dd391c..dbf1388 100644
--- a/neutron/cmd/netns_cleanup.py
+++ b/neutron/cmd/netns_cleanup.py
@@ -248,7 +248,8 @@ def destroy_namespace(conf, namespace, force=False):
248 # the error and continue with the cleanup 248 # the error and continue with the cleanup
249 LOG.error(_LE('Not all processes were killed in %s'), 249 LOG.error(_LE('Not all processes were killed in %s'),
250 namespace) 250 namespace)
251 for device in ip.get_devices(exclude_loopback=True): 251 for device in ip.get_devices(exclude_loopback=True,
252 exclude_gre_devices=True):
252 unplug_device(conf, device) 253 unplug_device(conf, device)
253 254
254 ip.garbage_collect_namespace() 255 ip.garbage_collect_namespace()
diff --git a/neutron/tests/unit/cmd/test_netns_cleanup.py b/neutron/tests/unit/cmd/test_netns_cleanup.py
index 56af8ea..cbf030d 100644
--- a/neutron/tests/unit/cmd/test_netns_cleanup.py
+++ b/neutron/tests/unit/cmd/test_netns_cleanup.py
@@ -336,7 +336,8 @@ class TestNetnsCleanup(base.BaseTestCase):
336 expected.extend([ 336 expected.extend([
337 mock.call().netns.exists(ns), 337 mock.call().netns.exists(ns),
338 mock.call().get_devices( 338 mock.call().get_devices(
339 exclude_loopback=True)]) 339 exclude_loopback=True,
340 exclude_gre_devices=True)])
340 self.assertTrue(kill_dhcp.called) 341 self.assertTrue(kill_dhcp.called)
341 unplug.assert_has_calls( 342 unplug.assert_has_calls(
342 [mock.call(conf, d) for d in 343 [mock.call(conf, d) for d in