Big Switch: Stop watchdog on interval of 0

Corrects the behavior of the watchdog process
to exit if the user configures the polling interval
to be 0.

Also adds missing documentation to sample config.

Change-Id: I17b566867c21f42985cc4662f56d32db690f471f
Closes-Bug: #1332334
This commit is contained in:
Kevin Benton 2014-06-18 14:08:17 -07:00
parent c4181a370f
commit e18263fa0c
4 changed files with 19 additions and 1 deletions

View File

@ -12,6 +12,7 @@
# ssl_sticky : True | False (default: True)
# sync_data : True | False (default: False)
# auto_sync_on_failure : True | False (default: True)
# consistency_interval : <integer> (default: 60 seconds)
# server_timeout : <integer> (default: 10 seconds)
# neutron_id : <string> (default: neutron-<hostname>)
# add_meta_server_route : True | False (default: True)
@ -47,6 +48,10 @@ servers=localhost:8080
# synchronization to the controller.
# auto_sync_on_failure=True
# Time between verifications that the backend controller
# database is consistent with Neutron. (0 to disable)
# consistency_interval = 60
# Maximum number of seconds to wait for proxy request to connect and complete.
# server_timeout=10

View File

@ -63,7 +63,7 @@ restproxy_opts = [
"synchronization to the controller.")),
cfg.IntOpt('consistency_interval', default=60,
help=_("Time between verifications that the backend controller "
"database is consistent with Neutron")),
"database is consistent with Neutron. (0 to disable)")),
cfg.IntOpt('server_timeout', default=10,
help=_("Maximum number of seconds to wait for proxy request "
"to connect and complete.")),

View File

@ -550,6 +550,10 @@ class ServerPool(object):
LOG.warning(_("Backend server(s) do not support automated "
"consitency checks."))
return
if not polling_interval:
LOG.warning(_("Consistency watchdog disabled by polling interval "
"setting of %s."), polling_interval)
return
while True:
# If consistency is supported, all we have to do is make any
# rest call and the consistency header will be added. If it

View File

@ -74,6 +74,15 @@ class ServerManagerTests(test_rp.BigSwitchProxyPluginV2TestCase):
)
sslgetmock.assert_has_calls([mock.call(('example.org', 443))])
def test_consistency_watchdog_stops_with_0_polling_interval(self):
pl = manager.NeutronManager.get_plugin()
pl.servers.capabilities = ['consistency']
self.watch_p.stop()
with mock.patch('eventlet.sleep') as smock:
# should return immediately a polling interval of 0
pl.servers._consistency_watchdog(0)
self.assertFalse(smock.called)
def test_consistency_watchdog(self):
pl = manager.NeutronManager.get_plugin()
pl.servers.capabilities = []