Updating image metadata fails when value contains newline (\n)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
Invalid
|
Undecided
|
Santiago Baldassin |
Bug Description
This is a correct request/response (Via LibCloud) to set metadata (without the newline)
The metadata I am attempting to add is: {"application_
# -------- begin 66424056 request ----------
curl -i -X POST -H 'Host: xx.xx.xx.xx:8774' -H 'X-LC-Request-ID: 66424056' -H 'Accept-Encoding: gzip,deflate' -H 'X-Auth-Token: <REMOVED>' -H 'Content-Type: application/json; charset=UTF-8' -H 'Content-Length: 83' -H 'Accept: application/json' -H 'User-Agent: libcloud/
--data-binary '{"metadata": {"application_
# -------- begin 66424056:64395816 response ----------
HTTP/1.1 200 OK
Date: Thu, 16 Jan 2014 20:25:36 GMT
Content-Length: 256
Content-Type: application/json
X-Compute-
{"metadata": {"application_
# -------- end 66424056:64395816 response ----------
This is the same request with a newline character as part of the value for the key 'application_
The metadata I am attempting to add is: {"application_
# -------- begin 66422544 request ----------
curl -i -X POST -H 'Host: xx.xx.xx.xx:8774' -H 'X-LC-Request-ID: 66422544' -H 'Accept-Encoding: gzip,deflate' -H 'X-Auth-Token: <REMOVED>' -H 'Content-Type: application/json; charset=UTF-8' -H 'Content-Length: 85' -H 'Accept: application/json' -H 'User-Agent: libcloud/
--data-binary '{"metadata": {"application_
# -------- begin 66422544:64395816 response ----------
HTTP/1.1 200 OK
Date: Thu, 16 Jan 2014 20:25:46 GMT
Content-Length: 224
Content-Type: application/json
X-Compute-
{"metadata": {"application_
# -------- end 66422544:64395816 response ----------
The second request has two errors:
1. All of the characters following the \n have been removed from the metadata
2. The 'application_
Other notes:
In my testing of this error, the application_version metadata item would be deleted even if it previously existed in image metadata and even when application_version was never intended to be set in the request above.
The 'maxImageMeta' is set to 128, so the # of metadata items should not be limited, and the response is returning a 200 OK, even when the output data does not match the input data, and whole metadata items are missing.
Changed in glance: | |
assignee: | nobody → Santiago Baldassin (santiago-b-baldassin) |
Changed in glance: | |
status: | New → Confirmed |
I looked into this a little more and I found that the problem occurred because the \n character is not valid json, and that the value should have been \\n.
However, instead of returning an error, the server returned a 200 with the metadata up to the point the error occurred.
No error was detected in nova-api.log