Fix failover when the last listener is deleted
This patch fixes an issue when deleting the last listener from a load balancer may trigger a failover. Story: 2010652 Task: 47683 Change-Id: I02804b7075edac72776b0377b7b283d0c7bfd8a2
This commit is contained in:
parent
764cbf014f
commit
ba92aeb946
@ -157,9 +157,15 @@ def run_sender(cmd_queue):
|
||||
|
||||
|
||||
def get_stats(stat_sock_file):
|
||||
try:
|
||||
stats_query = haproxy_query.HAProxyQuery(stat_sock_file)
|
||||
stats = stats_query.show_stat()
|
||||
pool_status = stats_query.get_pool_status()
|
||||
except Exception as e:
|
||||
LOG.warning('Unable to query the HAProxy stats (%s) due to: %s',
|
||||
stat_sock_file, str(e))
|
||||
# Return empty lists so that the heartbeat will still be sent
|
||||
return [], {}
|
||||
return stats, pool_status
|
||||
|
||||
|
||||
|
@ -319,6 +319,14 @@ class TestHealthDaemon(base.TestCase):
|
||||
stats_query_mock.show_stat.assert_called_once_with()
|
||||
stats_query_mock.get_pool_status.assert_called_once_with()
|
||||
|
||||
@mock.patch('octavia.amphorae.backends.utils.haproxy_query.HAProxyQuery')
|
||||
def test_get_stats_exception(self, mock_query):
|
||||
mock_query.side_effect = Exception('Boom')
|
||||
|
||||
stats, pool_status = health_daemon.get_stats('TEST')
|
||||
self.assertEqual([], stats)
|
||||
self.assertEqual({}, pool_status)
|
||||
|
||||
@mock.patch('octavia.amphorae.backends.agent.api_server.'
|
||||
'util.is_lb_running')
|
||||
@mock.patch('octavia.amphorae.backends.health_daemon.'
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixed an issue when deleting the last listener from a load balancer may
|
||||
trigger a failover.
|
Loading…
Reference in New Issue
Block a user