diff --git a/neutron/agent/linux/interface.py b/neutron/agent/linux/interface.py index 62a7a50d212..745f280213e 100644 --- a/neutron/agent/linux/interface.py +++ b/neutron/agent/linux/interface.py @@ -356,7 +356,7 @@ def _add_device_to_namespace(self, ip_wrapper, device, namespace): namespace_obj = ip_wrapper.ensure_namespace(namespace) for i in range(9): try: - namespace_obj.add_device_to_namespace(device, is_ovs_port=True) + namespace_obj.add_device_to_namespace(device) break except ip_lib.NetworkInterfaceNotFound: # NOTE(slaweq): if the exception was NetworkInterfaceNotFound diff --git a/neutron/agent/linux/ip_lib.py b/neutron/agent/linux/ip_lib.py index 8007b0d0924..5a5ec63fa08 100644 --- a/neutron/agent/linux/ip_lib.py +++ b/neutron/agent/linux/ip_lib.py @@ -270,9 +270,9 @@ def garbage_collect_namespace(self): return True return False - def add_device_to_namespace(self, device, is_ovs_port=False): + def add_device_to_namespace(self, device): if self.namespace: - device.link.set_netns(self.namespace, is_ovs_port=is_ovs_port) + device.link.set_netns(self.namespace) def add_vlan(self, name, physical_interface, vlan_id): privileged.create_interface(name, @@ -462,15 +462,10 @@ def set_down(self): privileged.set_link_attribute( self.name, self._parent.namespace, state='down') - def set_netns(self, namespace, is_ovs_port=False): + def set_netns(self, namespace): privileged.set_link_attribute( self.name, self._parent.namespace, net_ns_fd=namespace) self._parent.namespace = namespace - if is_ovs_port: - # NOTE(slaweq): because of the "shy port" which may dissapear for - # short time after it's moved to the namespace we need to wait - # a bit before checking if port really exists in the namespace - time.sleep(1) common_utils.wait_until_true(lambda: self.exists, timeout=5, sleep=0.5) diff --git a/neutron/tests/unit/agent/linux/test_interface.py b/neutron/tests/unit/agent/linux/test_interface.py index aee39b8d983..93269a9c112 100644 --- a/neutron/tests/unit/agent/linux/test_interface.py +++ b/neutron/tests/unit/agent/linux/test_interface.py @@ -468,11 +468,11 @@ def device_exists(dev, namespace=None): expected.extend( [mock.call().ensure_namespace(namespace), mock.call().ensure_namespace().add_device_to_namespace( - mock.ANY, is_ovs_port=True), + mock.ANY), mock.call().ensure_namespace().add_device_to_namespace( - mock.ANY, is_ovs_port=True), + mock.ANY), mock.call().ensure_namespace().add_device_to_namespace( - mock.ANY, is_ovs_port=True)]) + mock.ANY)]) expected.extend([ mock.call(namespace=namespace), mock.call().device('tap0'), diff --git a/neutron/tests/unit/agent/linux/test_ip_lib.py b/neutron/tests/unit/agent/linux/test_ip_lib.py index 3207c613a30..c5ccf56acf2 100644 --- a/neutron/tests/unit/agent/linux/test_ip_lib.py +++ b/neutron/tests/unit/agent/linux/test_ip_lib.py @@ -506,8 +506,7 @@ def fake_create_interface(ifname, namespace, kind, **kwargs): def test_add_device_to_namespace(self): dev = mock.Mock() ip_lib.IPWrapper(namespace='ns').add_device_to_namespace(dev) - dev.assert_has_calls( - [mock.call.link.set_netns('ns', is_ovs_port=False)]) + dev.assert_has_calls([mock.call.link.set_netns('ns')]) def test_add_device_to_namespace_is_none(self): dev = mock.Mock()