From cc9ce5189db4f3300c38b36dd28a98d64ca7a1fe Mon Sep 17 00:00:00 2001 From: Arun Sriraman Date: Thu, 5 May 2016 22:18:24 +0000 Subject: [PATCH] Changing arping command execute to accept 1 as extra OK code Connecting any network to a router causes l3-agent to send out gratuitous ARP packets that do not require a response. On Ubuntu 14.04 sometimes this command returns 1, which causes it to falsely report arping command failure. This is now added to the extra OK codes. Change-Id: I6299e936d4e4e7fd7497d23224e7abf605a99c15 Closes-bug: #1578842 --- neutron/agent/linux/ip_lib.py | 5 ++++- neutron/tests/unit/agent/linux/test_ip_lib.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/neutron/agent/linux/ip_lib.py b/neutron/agent/linux/ip_lib.py index ebb3b372563..2a091edadd0 100644 --- a/neutron/agent/linux/ip_lib.py +++ b/neutron/agent/linux/ip_lib.py @@ -1023,7 +1023,10 @@ def _arping(ns_name, iface_name, address, count, log_exception): '-w', 1.5 * count, address] try: ip_wrapper = IPWrapper(namespace=ns_name) - ip_wrapper.netns.execute(arping_cmd, check_exit_code=True) + # Since arping is used to send gratuitous ARP, a response is not + # expected. In some cases (no response) and with some platforms + # (>=Ubuntu 14.04), arping exit code can be 1. + ip_wrapper.netns.execute(arping_cmd, extra_ok_codes=[1]) except Exception as exc: msg = _("Failed sending gratuitous ARP " "to %(addr)s on %(iface)s in namespace %(ns)s: %(err)s") diff --git a/neutron/tests/unit/agent/linux/test_ip_lib.py b/neutron/tests/unit/agent/linux/test_ip_lib.py index bfdadc72122..6de960a5773 100644 --- a/neutron/tests/unit/agent/linux/test_ip_lib.py +++ b/neutron/tests/unit/agent/linux/test_ip_lib.py @@ -1357,7 +1357,7 @@ class TestArpPing(TestIPCmdBase): '-w', mock.ANY, address] ip_wrapper.netns.execute.assert_any_call(arping_cmd, - check_exit_code=True) + extra_ok_codes=[1]) @mock.patch('eventlet.spawn_n') def test_no_ipv6_addr_notif(self, spawn_n):