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:
@@ -12,6 +12,7 @@
|
|||||||
# ssl_sticky : True | False (default: True)
|
# ssl_sticky : True | False (default: True)
|
||||||
# sync_data : True | False (default: False)
|
# sync_data : True | False (default: False)
|
||||||
# auto_sync_on_failure : True | False (default: True)
|
# auto_sync_on_failure : True | False (default: True)
|
||||||
|
# consistency_interval : <integer> (default: 60 seconds)
|
||||||
# server_timeout : <integer> (default: 10 seconds)
|
# server_timeout : <integer> (default: 10 seconds)
|
||||||
# neutron_id : <string> (default: neutron-<hostname>)
|
# neutron_id : <string> (default: neutron-<hostname>)
|
||||||
# add_meta_server_route : True | False (default: True)
|
# add_meta_server_route : True | False (default: True)
|
||||||
@@ -47,6 +48,10 @@ servers=localhost:8080
|
|||||||
# synchronization to the controller.
|
# synchronization to the controller.
|
||||||
# auto_sync_on_failure=True
|
# 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.
|
# Maximum number of seconds to wait for proxy request to connect and complete.
|
||||||
# server_timeout=10
|
# server_timeout=10
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ restproxy_opts = [
|
|||||||
"synchronization to the controller.")),
|
"synchronization to the controller.")),
|
||||||
cfg.IntOpt('consistency_interval', default=60,
|
cfg.IntOpt('consistency_interval', default=60,
|
||||||
help=_("Time between verifications that the backend controller "
|
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,
|
cfg.IntOpt('server_timeout', default=10,
|
||||||
help=_("Maximum number of seconds to wait for proxy request "
|
help=_("Maximum number of seconds to wait for proxy request "
|
||||||
"to connect and complete.")),
|
"to connect and complete.")),
|
||||||
|
@@ -550,6 +550,10 @@ class ServerPool(object):
|
|||||||
LOG.warning(_("Backend server(s) do not support automated "
|
LOG.warning(_("Backend server(s) do not support automated "
|
||||||
"consitency checks."))
|
"consitency checks."))
|
||||||
return
|
return
|
||||||
|
if not polling_interval:
|
||||||
|
LOG.warning(_("Consistency watchdog disabled by polling interval "
|
||||||
|
"setting of %s."), polling_interval)
|
||||||
|
return
|
||||||
while True:
|
while True:
|
||||||
# If consistency is supported, all we have to do is make any
|
# If consistency is supported, all we have to do is make any
|
||||||
# rest call and the consistency header will be added. If it
|
# rest call and the consistency header will be added. If it
|
||||||
|
@@ -74,6 +74,15 @@ class ServerManagerTests(test_rp.BigSwitchProxyPluginV2TestCase):
|
|||||||
)
|
)
|
||||||
sslgetmock.assert_has_calls([mock.call(('example.org', 443))])
|
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):
|
def test_consistency_watchdog(self):
|
||||||
pl = manager.NeutronManager.get_plugin()
|
pl = manager.NeutronManager.get_plugin()
|
||||||
pl.servers.capabilities = []
|
pl.servers.capabilities = []
|
||||||
|
Reference in New Issue
Block a user