Force to close http connection after notify about HA router status

Neutron-keepalived-state-change-monitor process is using HTTP to notify
L3 agent that state of the HA router was changed. It is done through
unix socket.
With HTTP 1.1 connection isn't closed properly and if
router's state was changed more than once in short time, it could happen
that wsgi worker on the L3 agent's side didn't process second request at
all. That caused problem with transitioning router to master state after
creation.
Request to close connection should be explicitly defined in the header
[1] and this patch adds "connection: close" header to the headers send in
such request to do exactly that.

[1] https://www.geeksforgeeks.org/http-headers-connection/

Closes-Bug: #1923633
Change-Id: Ic08ca5b167db4884efa07112cf9a6c3637e1b827
(cherry picked from commit 976cba6133)
This commit is contained in:
Slawek Kaplonski 2021-06-17 15:40:20 +02:00
parent 6ca1be0c1b
commit 939ad7016f
1 changed files with 2 additions and 1 deletions

View File

@ -128,7 +128,8 @@ class MonitorDaemon(daemon.Daemon):
# the URL doesn't matter.
'http://127.0.0.1/',
headers={'X-Neutron-Router-Id': self.router_id,
'X-Neutron-State': state},
'X-Neutron-State': state,
'Connection': 'close'},
connection_type=KeepalivedUnixDomainConnection)
if resp.status != 200: