Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion neutron/agent/linux/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,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
Expand Down
11 changes: 3 additions & 8 deletions neutron/agent/linux/ip_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions neutron/conf/agent/database/agents_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
from neutron.common import _constants

AGENT_OPTS = [
# The agent_down_time value can only be a max of INT_MAX (as defined in C),
# where int is usually 32 bits. The agent_down_time will be passed to
# eventlet in milliseconds and any number higher will produce an OverFlow
# error. More details here: https://bugs.launchpad.net/neutron/+bug/2028724
cfg.IntOpt('agent_down_time', default=75,
max=((2**32 / 2 - 1) // 1000),
help=_("Seconds to regard the agent is down; should be at "
"least twice report_interval, to be sure the "
"agent is down for good.")),
Expand Down
6 changes: 3 additions & 3 deletions neutron/tests/unit/agent/linux/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,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'),
Expand Down
3 changes: 1 addition & 2 deletions neutron/tests/unit/agent/linux/test_ip_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,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()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
The config option ``agent_down_time`` is now limited to a maximum value of
`2147483`, as neutron-server will fail to start if it is configured higher.
See bug `2028724 <https://bugs.launchpad.net/neutron/+bug/2028724>`_ for more information.