diff --git a/neutron/agent/linux/ip_lib.py b/neutron/agent/linux/ip_lib.py index 0e3d04bcb57..4166a868413 100644 --- a/neutron/agent/linux/ip_lib.py +++ b/neutron/agent/linux/ip_lib.py @@ -86,6 +86,8 @@ DEVICE_NAME_PATTERN = re.compile(r"(\d+?): (\S+?):.*") IP_ROUTE_METRIC_DEFAULT = {constants.IP_VERSION_4: 0, constants.IP_VERSION_6: 1024} +ARPING_SLEEP = 2 + def remove_interface_suffix(interface): """Remove a possible "@" suffix from an interface' name. @@ -1060,7 +1062,7 @@ def _arping(ns_name, iface_name, address, count, log_exception): for i in range(count): if not first: # hopefully enough for kernel to get out of locktime loop - time.sleep(2) + time.sleep(ARPING_SLEEP) # On the second (and subsequent) arping calls, we can get a # "bind: Cannot assign requested address" error since # the IP address might have been deleted concurrently. diff --git a/neutron/tests/unit/agent/linux/test_ip_lib.py b/neutron/tests/unit/agent/linux/test_ip_lib.py index 6078d9a2490..435a0a0610a 100644 --- a/neutron/tests/unit/agent/linux/test_ip_lib.py +++ b/neutron/tests/unit/agent/linux/test_ip_lib.py @@ -1078,6 +1078,7 @@ class TestIpNeighCommand(TestIPCmdBase): class TestArpPing(TestIPCmdBase): + @mock.patch.object(ip_lib, 'ARPING_SLEEP', 0) @mock.patch.object(ip_lib, 'IPWrapper') @mock.patch('eventlet.spawn_n') def test_send_ipv4_addr_adv_notif(self, spawn_n, mIPWrapper):