From 7b67e63e97073196658166908336cdf1ab0a581a Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Tue, 13 Jun 2017 22:33:24 -0700 Subject: [PATCH] Retry ebtables lock acquisition failures It seems after the merge of https://bugs.launchpad.net/ubuntu/+source/ebtables/+bug/1645324 that ebtables can fail to acquire a lock and bail with an error 255. This adds some retry logic to retry it up to 10 times to work around this issue. Closes-Bug: #1697833 Change-Id: Ic9dcf4b236a93e8811413c6ce2c4b82602544c6d (cherry picked from commit 2e7b787f0e60d3707fe4dec7f8acbc90cf62ea29) --- .../plugins/ml2/drivers/linuxbridge/agent/arp_protect.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/neutron/plugins/ml2/drivers/linuxbridge/agent/arp_protect.py b/neutron/plugins/ml2/drivers/linuxbridge/agent/arp_protect.py index ec05b127f67..c5738486975 100644 --- a/neutron/plugins/ml2/drivers/linuxbridge/agent/arp_protect.py +++ b/neutron/plugins/ml2/drivers/linuxbridge/agent/arp_protect.py @@ -16,6 +16,7 @@ import netaddr from oslo_concurrency import lockutils from oslo_log import log as logging +import tenacity from neutron._i18n import _LI from neutron.agent.linux import ip_lib @@ -189,6 +190,11 @@ def _delete_mac_spoofing_protection(vifs, current_rules): NAMESPACE = None +@tenacity.retry( + wait=tenacity.wait_exponential(multiplier=0.01), + retry=tenacity.retry_if_exception(lambda e: e.returncode == 255), + reraise=True +) def ebtables(comm): execute = ip_lib.IPWrapper(NAMESPACE).netns.execute return execute(['ebtables', '--concurrent'] + comm, run_as_root=True)