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.
Conflicts:
neutron/plugins/ml2/drivers/linuxbridge/agent/arp_protect.py
Closes-Bug: #1697833
Change-Id: Ic9dcf4b236a93e8811413c6ce2c4b82602544c6d
(cherry picked from commit 2e7b787f0e
)
This commit is contained in:
parent
90c24e9d26
commit
b5b68b3752
|
@ -16,9 +16,11 @@
|
|||
import netaddr
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_log import log as logging
|
||||
import retrying
|
||||
|
||||
from neutron._i18n import _LI
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import utils as linux_utils
|
||||
from neutron.common import utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -189,6 +191,17 @@ def _delete_mac_spoofing_protection(vifs, current_rules):
|
|||
NAMESPACE = None
|
||||
|
||||
|
||||
def _retry_on_returncode_255(e):
|
||||
if isinstance(e, linux_utils.ProcessExecutionError):
|
||||
return e.returncode == 255
|
||||
return False
|
||||
|
||||
|
||||
@retrying.retry(
|
||||
stop_max_attempt_number=10,
|
||||
wait_exponential_multiplier=0.01,
|
||||
retry_on_exception=_retry_on_returncode_255
|
||||
)
|
||||
def ebtables(comm):
|
||||
execute = ip_lib.IPWrapper(NAMESPACE).netns.execute
|
||||
return execute(['ebtables', '--concurrent'] + comm, run_as_root=True)
|
||||
|
|
Loading…
Reference in New Issue