Set OVS inactivity_probe to vsctl_timeout when adding manager
If the vsctl_timeout > OVS's inactivity probe interval and a transaction execution time exceeds the probe interval, OVS will disconnect and the transaction will return TRY_AGAIN and most likely repeat failing until the vsctl_timeout is reached. This change ensures that the "failsafe" creation of the manager also sets the inactivity probe to the vsctl_timeout value. Currently the patch doesn't override the probe_interval on an existing Manager since it is possible that connection is used by outside applications and it theoretically should be handled at deployment. Related-Bug: #1627106 Change-Id: I76fa0a0cf04a166edf062086fceb2fd90960ad6b
This commit is contained in:
parent
dfd55bebc9
commit
920c0c1117
@ -12,8 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _connection_to_manager_uri(conn_uri):
|
||||
proto, addr = conn_uri.split(':', 1)
|
||||
@ -26,10 +29,13 @@ def _connection_to_manager_uri(conn_uri):
|
||||
|
||||
def enable_connection_uri(conn_uri, execute=None, **kwargs):
|
||||
timeout = kwargs.get('timeout', 5)
|
||||
man_uri = 'target="%s"' % _connection_to_manager_uri(conn_uri)
|
||||
cmd = ['ovs-vsctl', '--timeout=%d' % timeout, '--id=@manager', 'create',
|
||||
'Manager', man_uri, '--', 'add', 'Open_vSwitch', '.',
|
||||
'manager_options', '@manager']
|
||||
probe = timeout if kwargs.get('set_timeout') else None
|
||||
man_uri = _connection_to_manager_uri(conn_uri)
|
||||
cmd = ['ovs-vsctl', '--timeout=%d' % timeout, '--id=@manager',
|
||||
'--', 'create', 'Manager', 'target="%s"' % man_uri,
|
||||
'--', 'add', 'Open_vSwitch', '.', 'manager_options', '@manager']
|
||||
if probe:
|
||||
cmd += ['--', 'set', 'Manager', man_uri, 'inactivity_probe=%s' % probe]
|
||||
if execute:
|
||||
return execute(cmd, **kwargs).rstrip()
|
||||
else:
|
||||
@ -38,4 +44,6 @@ def enable_connection_uri(conn_uri, execute=None, **kwargs):
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, err = obj.communicate()
|
||||
if err:
|
||||
LOG.debug(err) # will fail if target already exists
|
||||
return out.rstrip()
|
||||
|
Loading…
x
Reference in New Issue
Block a user