Merge "Fix detection of member operating status DRAIN" into stable/ussuri
This commit is contained in:
commit
5fca1f8b71
|
@ -114,20 +114,22 @@ class HAProxyQuery(object):
|
|||
for line in results:
|
||||
# pxname: pool, svname: server_name, status: status
|
||||
|
||||
# Due to a bug in some versions of HAProxy, DRAIN mode isn't
|
||||
# calculated correctly, but we can spoof the correct value here.
|
||||
if line['status'] == consts.UP and line['weight'] == 0:
|
||||
line['status'] = consts.DRAIN
|
||||
|
||||
if line['pxname'] not in final_results:
|
||||
final_results[line['pxname']] = dict(members={})
|
||||
|
||||
if line['svname'] == 'BACKEND':
|
||||
# BACKEND describes a pool of servers in HAProxy
|
||||
pool_id, listener_id = line['pxname'].split(':')
|
||||
final_results[line['pxname']]['pool_uuid'] = pool_id
|
||||
final_results[line['pxname']]['listener_uuid'] = listener_id
|
||||
final_results[line['pxname']]['status'] = line['status']
|
||||
else:
|
||||
# Due to a bug in some versions of HAProxy, DRAIN mode isn't
|
||||
# calculated correctly, but we can spoof the correct
|
||||
# value here.
|
||||
if line['status'] == consts.UP and line['weight'] == '0':
|
||||
line['status'] = consts.DRAIN
|
||||
|
||||
final_results[line['pxname']]['members'][line['svname']] = (
|
||||
line['status'])
|
||||
return final_results
|
||||
|
|
|
@ -39,7 +39,7 @@ STATS_SOCKET_SAMPLE = (
|
|||
"tcp-servers:listener-id,id-34833,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,1,1,0,1,1,"
|
||||
"560,560,,1,5,1,,0,,2,0,,0,L4TOUT,,30000,,,,,,,0,,,,0,0,,,,,-1,,,0,0,0,0,"
|
||||
"\n"
|
||||
"tcp-servers:listener-id,id-34836,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,1,1,0,1,1,"
|
||||
"tcp-servers:listener-id,id-34836,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,0,1,0,1,1,"
|
||||
"552,552,,1,5,2,,0,,2,0,,0,L4TOUT,,30001,,,,,,,0,,,,0,0,,,,,-1,,,0,0,0,0,"
|
||||
"\n"
|
||||
"tcp-servers:listener-id,id-34839,0,0,0,0,,0,0,0,,0,,0,0,0,0,DRAIN,0,1,0,"
|
||||
|
@ -48,7 +48,7 @@ STATS_SOCKET_SAMPLE = (
|
|||
"tcp-servers:listener-id,id-34842,0,0,0,0,,0,0,0,,0,,0,0,0,0,MAINT,0,1,0,"
|
||||
"0,0,552,0,,1,5,2,,0,,2,0,,0,L7OK,,30001,,,,,,,0,,,,0,0,,,,,-1,,,0,0,0,0,"
|
||||
"\n"
|
||||
"tcp-servers:listener-id,BACKEND,0,0,0,0,200,0,0,0,0,0,,0,0,0,0,UP,0,0,0,,"
|
||||
"tcp-servers:listener-id,BACKEND,0,0,0,0,200,0,0,0,0,0,,0,0,0,0,UP,1,0,0,,"
|
||||
"1,552,552,,1,5,0,,0,,1,0,,0,,,,,,,,,,,,,,0,0,0,0,0,0,-1,,,0,0,0,0,"
|
||||
)
|
||||
|
||||
|
@ -105,7 +105,7 @@ class QueryTestCase(base.TestCase):
|
|||
'pool_uuid': 'tcp-servers',
|
||||
'members':
|
||||
{'id-34833': constants.UP,
|
||||
'id-34836': constants.UP,
|
||||
'id-34836': constants.DRAIN,
|
||||
'id-34839': constants.DRAIN,
|
||||
'id-34842': constants.MAINT}},
|
||||
'http-servers:listener-id': {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Correctly detect the member operating status "drain" when querying status
|
||||
data from HAProxy.
|
Loading…
Reference in New Issue