Skip to content

Commit 0ae1d93

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Revert "Add sleep before checking if ovs port is in the namespace"" into stable/zed
2 parents 71ee6db + 0396b33 commit 0ae1d93

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

neutron/agent/linux/interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def _add_device_to_namespace(self, ip_wrapper, device, namespace):
355355
namespace_obj = ip_wrapper.ensure_namespace(namespace)
356356
for i in range(9):
357357
try:
358-
namespace_obj.add_device_to_namespace(device, is_ovs_port=True)
358+
namespace_obj.add_device_to_namespace(device)
359359
break
360360
except ip_lib.NetworkInterfaceNotFound:
361361
# NOTE(slaweq): if the exception was NetworkInterfaceNotFound

neutron/agent/linux/ip_lib.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ def garbage_collect_namespace(self):
270270
return True
271271
return False
272272

273-
def add_device_to_namespace(self, device, is_ovs_port=False):
273+
def add_device_to_namespace(self, device):
274274
if self.namespace:
275-
device.link.set_netns(self.namespace, is_ovs_port=is_ovs_port)
275+
device.link.set_netns(self.namespace)
276276

277277
def add_vlan(self, name, physical_interface, vlan_id):
278278
privileged.create_interface(name,
@@ -462,15 +462,10 @@ def set_down(self):
462462
privileged.set_link_attribute(
463463
self.name, self._parent.namespace, state='down')
464464

465-
def set_netns(self, namespace, is_ovs_port=False):
465+
def set_netns(self, namespace):
466466
privileged.set_link_attribute(
467467
self.name, self._parent.namespace, net_ns_fd=namespace)
468468
self._parent.namespace = namespace
469-
if is_ovs_port:
470-
# NOTE(slaweq): because of the "shy port" which may dissapear for
471-
# short time after it's moved to the namespace we need to wait
472-
# a bit before checking if port really exists in the namespace
473-
time.sleep(1)
474469
common_utils.wait_until_true(lambda: self.exists, timeout=5,
475470
sleep=0.5)
476471

neutron/tests/unit/agent/linux/test_interface.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,11 @@ def device_exists(dev, namespace=None):
467467
expected.extend(
468468
[mock.call().ensure_namespace(namespace),
469469
mock.call().ensure_namespace().add_device_to_namespace(
470-
mock.ANY, is_ovs_port=True),
470+
mock.ANY),
471471
mock.call().ensure_namespace().add_device_to_namespace(
472-
mock.ANY, is_ovs_port=True),
472+
mock.ANY),
473473
mock.call().ensure_namespace().add_device_to_namespace(
474-
mock.ANY, is_ovs_port=True)])
474+
mock.ANY)])
475475
expected.extend([
476476
mock.call(namespace=namespace),
477477
mock.call().device('tap0'),

neutron/tests/unit/agent/linux/test_ip_lib.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,7 @@ def fake_create_interface(ifname, namespace, kind, **kwargs):
507507
def test_add_device_to_namespace(self):
508508
dev = mock.Mock()
509509
ip_lib.IPWrapper(namespace='ns').add_device_to_namespace(dev)
510-
dev.assert_has_calls(
511-
[mock.call.link.set_netns('ns', is_ovs_port=False)])
510+
dev.assert_has_calls([mock.call.link.set_netns('ns')])
512511

513512
def test_add_device_to_namespace_is_none(self):
514513
dev = mock.Mock()

0 commit comments

Comments
 (0)