← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1269935] [NEW] Updating image metadata fails when value contains newline (\n)

 

Public bug reported:

This is a correct request/response (Via LibCloud) to set metadata
(without the newline)

The metadata I am attempting to add is: {"application_description":
"10chartest", "application_version":"1"}

# -------- 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/0.14.0-beta3 (OpenStack) ' 
--data-binary '{"metadata": {"application_description": "10chartest", "application_version": "1"}}' --compress http://xx.xx.xx.xx:8774/v2/3db7423c206849749a77c19f347624bc/images/304fbf85-cc3f-4be6-a729-c5c9d190254f/metadata

# -------- 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-Request-Id: req-99a0df3d-5432-444f-988f-fcd6d2765fe4

{"metadata": {"application_uuid": "d120cbca-1910-5542-b789-8dabc870c613", "application_description": "10chartest", "application_tags": "[\"R\", \"IGV\"]", "application_owner": "test", "application_name": "Visualization", "application_version": "1"}}
# -------- end 66424056:64395816 response ----------


This is the same request with a newline character as part of the value for the key 'application_description'
The metadata I am attempting to add is: {"application_description": "10char\ntest", "application_version":"1"}

# -------- 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/0.14.0-beta3 (OpenStack) '
 --data-binary '{"metadata": {"application_description": "10char\ntest", "application_version": "1"}}' --compress http://xx.xx.xx.xx:8774/v2/3db7423c206849749a77c19f347624bc/images/304fbf85-cc3f-4be6-a729-c5c9d190254f/metadata
# -------- 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-Request-Id: req-00caedb5-dedc-44fe-95e4-b48cf93e64ba

{"metadata": {"application_name": "Visualization", "application_uuid": "d120cbca-1910-5542-b789-8dabc870c613", "application_description": "10char", "application_owner": "test", "application_tags": "[\"R\", \"IGV\"]"}}
# -------- 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_version' metadata key-value pair has also been deleted from the image's metadata.

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.

** Affects: nova
     Importance: Undecided
         Status: New


** Tags: metadata

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1269935

Title:
  Updating image metadata fails when value contains newline (\n)

Status in OpenStack Compute (Nova):
  New

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_description":
  "10chartest", "application_version":"1"}

  # -------- 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/0.14.0-beta3 (OpenStack) ' 
  --data-binary '{"metadata": {"application_description": "10chartest", "application_version": "1"}}' --compress http://xx.xx.xx.xx:8774/v2/3db7423c206849749a77c19f347624bc/images/304fbf85-cc3f-4be6-a729-c5c9d190254f/metadata

  # -------- 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-Request-Id: req-99a0df3d-5432-444f-988f-fcd6d2765fe4

  {"metadata": {"application_uuid": "d120cbca-1910-5542-b789-8dabc870c613", "application_description": "10chartest", "application_tags": "[\"R\", \"IGV\"]", "application_owner": "test", "application_name": "Visualization", "application_version": "1"}}
  # -------- end 66424056:64395816 response ----------


  This is the same request with a newline character as part of the value for the key 'application_description'
  The metadata I am attempting to add is: {"application_description": "10char\ntest", "application_version":"1"}

  # -------- 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/0.14.0-beta3 (OpenStack) '
   --data-binary '{"metadata": {"application_description": "10char\ntest", "application_version": "1"}}' --compress http://xx.xx.xx.xx:8774/v2/3db7423c206849749a77c19f347624bc/images/304fbf85-cc3f-4be6-a729-c5c9d190254f/metadata
  # -------- 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-Request-Id: req-00caedb5-dedc-44fe-95e4-b48cf93e64ba

  {"metadata": {"application_name": "Visualization", "application_uuid": "d120cbca-1910-5542-b789-8dabc870c613", "application_description": "10char", "application_owner": "test", "application_tags": "[\"R\", \"IGV\"]"}}
  # -------- 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_version' metadata key-value pair has also been deleted from the image's metadata.

  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1269935/+subscriptions


Follow ups

References