[WORKER] Active monitoring support

Support active (HTTP) monitoring in addition to passive (CONNECT)
tcp monitoring. If no monitoring for a load balancer is defined,
we always use a simple tcp-only monitor.

Change-Id: Ib2d4e87097069a4fec5c307bf2718ec1954ebf10
This commit is contained in:
David Shrewsbury
2013-08-14 15:32:07 +00:00
parent 44bf5ccbab
commit b4cebeacca
4 changed files with 301 additions and 7 deletions

View File

@@ -171,6 +171,36 @@ class LBaaSController(object):
self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE
return self.msg
if 'monitor' in current_lb:
monitor = current_lb['monitor']
for opt in ['type', 'delay', 'timeout', 'attempts']:
if opt not in monitor:
return BadRequest("Missing monitor value '%s'" %
opt).to_json()
if 'path' not in monitor:
monitor['path'] = '/'
try:
self.driver.add_monitor(current_lb['protocol'],
monitor['type'],
monitor['delay'],
monitor['timeout'],
monitor['attempts'],
monitor['path'])
except NotImplementedError:
self.logger.error(
"Selected driver does not support adding healthchecks."
)
self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE
return self.msg
except Exception as e:
self.logger.error(
"Selected driver failed adding healthchecks: %s, %s" %
(e.__class__, e)
)
self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE
return self.msg
for lb_node in current_lb['nodes']:
port, address, node_id, weight = None, None, None, None