yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #95319
[Bug 2097431] Re: [OVN] OVN metadata agent should build the response according to the content
Reviewed: https://review.opendev.org/c/openstack/neutron/+/940679
Committed: https://opendev.org/openstack/neutron/commit/ce140980107b77367b1fe755c04aa1cb5b56eeec
Submitter: "Zuul (22348)"
Branch: master
commit ce140980107b77367b1fe755c04aa1cb5b56eeec
Author: Rodolfo Alonso Hernandez <ralonsoh@xxxxxxxxxx>
Date: Tue Feb 4 08:35:21 2025 +0000
[OVN] Fix metadata server when body response is empty
HAProxy is expecting two "\r\n" blocks between the headers and the body.
By default, ``webob`` is adding this block twice in [1] when the
response is formated as an string. However, this is not done when the
body is empty.
This patch is manually adding these characters at the end of the message
when the response body length is empty.
The change in the socket server handler was done in [2]. This new class
does not uses the decorator ``@webob.dec.wsgify`` but needs to format
the response properly and write it in the UNIX socket.
This patch is also changing how the crafted response ``webob.Response``
is built. The only header copied is the content type. The content
length will be calculated from the body size.
Expected request and response (captured in the socket file used to
communicate to HAProxy) with the implementation before [2]; notice the
two "0x0d 0x0a" characters at the end:
> 2025/02/04 07:34:43.709708 length=211 from=0 to=210
47 45 54 20 2f 6c 61 74 65 73 74 2f 6d 65 74 61 GET /latest/meta
2d 64 61 74 61 2f 70 75 62 6c 69 63 2d 69 70 76 -data/public-ipv
34 20 48 54 54 50 2f 31 2e 31 0d 0a 4 HTTP/1.1..
68 6f 73 74 3a 20 31 36 39 2e 32 35 34 2e 31 36 host: 169.254.16
39 2e 32 35 34 0d 0a 9.254..
75 73 65 72 2d 61 67 65 6e 74 3a 20 63 75 72 6c user-agent: curl
2f 37 2e 38 34 2e 30 0d 0a /7.84.0..
61 63 63 65 70 74 3a 20 2a 2f 2a 0d 0a accept: */*..
78 2d 6f 76 6e 2d 6e 65 74 77 6f 72 6b 2d 69 64 x-ovn-network-id
3a 20 66 33 64 63 38 31 31 32 2d 32 37 33 65 2d : f3dc8112-273e-
34 36 35 33 2d 61 66 33 63 2d 36 30 36 39 33 33 4653-af3c-606933
30 61 64 33 35 30 0d 0a 0ad350..
78 2d 66 6f 72 77 61 72 64 65 64 2d 66 6f 72 3a x-forwarded-for:
20 31 30 2e 30 2e 31 30 2e 35 32 0d 0a 10.0.10.52..
63 6f 6e 6e 65 63 74 69 6f 6e 3a 20 63 6c 6f 73 connection: clos
65 0d 0a e..
0d 0a ..
--
< 2025/02/04 07:34:49.766945 length=135 from=0 to=134
48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d HTTP/1.1 200 OK.
0a .
43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 Content-Type: te
78 74 2f 70 6c 61 69 6e 3b 20 63 68 61 72 73 65 xt/plain; charse
74 3d 55 54 46 2d 38 0d 0a t=UTF-8..
43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 Content-Length:
30 0d 0a 0..
44 61 74 65 3a 20 54 75 65 2c 20 30 34 20 46 65 Date: Tue, 04 Fe
62 20 32 30 32 35 20 30 37 3a 33 34 3a 34 39 20 b 2025 07:34:49
47 4d 54 0d 0a GMT..
43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 63 6c 6f 73 Connection: clos
65 0d 0a e..
0d 0a ..
--
[1]https://github.com/faucetsdn/python3-webob/blob/ac5a25e9e962eeb20a55e44c93f60a154e35d8a8/src/webob/response.py#L402-L404
[2]https://review.opendev.org/c/openstack/neutron/+/938393
Closes-Bug: #2097273
Closes-Bug: #2097431
Change-Id: I58d2fd95ae983ee4b80d751ba626c6aa3f20eedf
** Changed in: neutron
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/2097431
Title:
[OVN] OVN metadata agent should build the response according to the
content
Status in neutron:
Fix Released
Bug description:
The OVN metadata response should be built according to the response.
When "curl -I" is sent, the HTTP method used is "HEAD". The request
returns the actual content length of the response with an empty body
because the request only needs the headers. The new ``webob.Response``
built should contain the response body (empty) but the actual content
length (zero).
Currently [1] the crafted response is receiving all the returned
headers. Instead of this, only 'content-type' header should be copied.
The length will be calculated from the body size.
[1]https://github.com/openstack/neutron/blob/a962fc636b7b3c410633a34aa0c6a146a60a8acd/neutron/agent/ovn/metadata/server_socket.py#L63
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/2097431/+subscriptions
References