@abc.abstractmethod
def create_health_monitor(self, context, health_monitor):
- """Driver may call the code below in order to update the status.
- self.plugin.update_status(context, HealthMonitor,
- health_monitor["id"],
- constants.ACTIVE)
- """
pass
@abc.abstractmethod
def _get_server_health_option(config):
"""return the first active health option."""
for monitor in config['healthmonitors']:
- if monitor['status'] == ACTIVE and monitor['admin_state_up']:
+ # not checking the status of healthmonitor for two reasons:
+ # 1) status field is absent in HealthMonitor model
+ # 2) only active HealthMonitors are fetched with
+ # LoadBalancerCallbacks.get_logical_device
+ if monitor['admin_state_up']:
break
else:
return '', []
self.driver.delete_member(context, m)
def create_health_monitor(self, context, health_monitor):
- # no PENDING_CREATE status sinse healthmon is shared DB object
hm = super(LoadBalancerPlugin, self).create_health_monitor(
context,
health_monitor
return hm
def update_health_monitor(self, context, id, health_monitor):
- if 'status' not in health_monitor['health_monitor']:
- health_monitor['health_monitor']['status'] = (
- constants.PENDING_UPDATE
- )
old_hm = self.get_health_monitor(context, id)
hm = super(LoadBalancerPlugin, self).update_health_monitor(
context,
'address': '10.0.0.3',
'protocol_port': 80,
'weight': 1}],
- 'healthmonitors': [{'status': 'ACTIVE',
- 'admin_state_up': True,
+ 'healthmonitors': [{'admin_state_up': True,
'delay': 3,
'max_retries': 4,
'timeout': 2,
self.assertEqual(expected_opts, list(opts))
def test_get_server_health_option(self):
- test_config = {'healthmonitors': [{'status': 'ERROR',
- 'admin_state_up': False,
+ test_config = {'healthmonitors': [{'admin_state_up': False,
'delay': 3,
'max_retries': 4,
'timeout': 2,
'expected_codes': '200'}]}
self.assertEqual(('', []), cfg._get_server_health_option(test_config))
- test_config['healthmonitors'][0]['status'] = 'ACTIVE'
self.assertEqual(('', []), cfg._get_server_health_option(test_config))
test_config['healthmonitors'][0]['admin_state_up'] = True