Retry ovs-appctl command

The ovs-appctl command may fail when setting an interface as a
slave interface in a bond and the primary has not come up yet
from a preceding ifup call.  Retry the ovs-appctl and log an
error if the command still fails.

Change-Id: I3f04a5d6c3a6dc324a2978fdecd2a77df0bf1ba0
Closes-Bug: 1797955
(cherry picked from commit 25c70ea076)
(cherry picked from commit e78d45f368)
This commit is contained in:
Bob Fournier 2018-10-15 15:36:01 -04:00
parent d3a0291e39
commit 22ca42f79c
2 changed files with 21 additions and 1 deletions

View File

@ -334,5 +334,19 @@ class NetConfig(object):
'link', 'set', 'dev', newname, 'up')
def ovs_appctl(self, action, *parameters):
"""Run 'ovs-appctl' with the specified action
Its possible the command may fail due to timing if, for example,
the command affects an interface and it the prior ifup command
has not completed. So retry the command and if a failures still
occurs save the error for later handling.
:param action: The ovs-appctl action.
:param parameters: Parameters to pass to ovs-appctl.
"""
msg = 'Running ovs-appctl %s %s' % (action, parameters)
self.execute(msg, '/bin/ovs-appctl', action, *parameters)
try:
self.execute(msg, '/bin/ovs-appctl', action, *parameters,
delay_on_retry=True, attempts=5)
except processutils.ProcessExecutionError as e:
self.errors.append(e)

View File

@ -0,0 +1,6 @@
---
fixes:
- The ovs-appctl command may fail, particularly when setting an
interface as a slave in a bond if the primary interface is not
yet up. Retry the ovs-appctl command and log a failure if the
command still fails.