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 2e7b787f0e)
This commit is contained in:
Kevin Benton 2017-06-13 22:33:24 -07:00 committed by Brian Haley
parent 633b452e28
commit 7b67e63e97
1 changed files with 6 additions and 0 deletions

View File

@ -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)