Skip to content

Commit 7179025

Browse files
authored
Merge pull request #118 from stackhpc/upstream/yoga-2024-01-29
Synchronise yoga with upstream
2 parents 0f76472 + 34e9794 commit 7179025

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
@@ -356,7 +356,7 @@ def _add_device_to_namespace(self, ip_wrapper, device, namespace):
356356
namespace_obj = ip_wrapper.ensure_namespace(namespace)
357357
for i in range(9):
358358
try:
359-
namespace_obj.add_device_to_namespace(device, is_ovs_port=True)
359+
namespace_obj.add_device_to_namespace(device)
360360
break
361361
except ip_lib.NetworkInterfaceNotFound:
362362
# 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
@@ -468,11 +468,11 @@ def device_exists(dev, namespace=None):
468468
expected.extend(
469469
[mock.call().ensure_namespace(namespace),
470470
mock.call().ensure_namespace().add_device_to_namespace(
471-
mock.ANY, is_ovs_port=True),
471+
mock.ANY),
472472
mock.call().ensure_namespace().add_device_to_namespace(
473-
mock.ANY, is_ovs_port=True),
473+
mock.ANY),
474474
mock.call().ensure_namespace().add_device_to_namespace(
475-
mock.ANY, is_ovs_port=True)])
475+
mock.ANY)])
476476
expected.extend([
477477
mock.call(namespace=namespace),
478478
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
@@ -506,8 +506,7 @@ def fake_create_interface(ifname, namespace, kind, **kwargs):
506506
def test_add_device_to_namespace(self):
507507
dev = mock.Mock()
508508
ip_lib.IPWrapper(namespace='ns').add_device_to_namespace(dev)
509-
dev.assert_has_calls(
510-
[mock.call.link.set_netns('ns', is_ovs_port=False)])
509+
dev.assert_has_calls([mock.call.link.set_netns('ns')])
511510

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

0 commit comments

Comments
 (0)