Nested metadata to volume causes an internal server error

Bug #1690363 reported by Hironori Shiina
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
luqitao

Bug Description

When we try setting nested metadata to a volume, an internal server error is returned.

---
$ curl -g -i -X POST http://$IP:8776/v2/$PROJECT/volumes/$VOLUME/metadata \
  -H "Content-Type: application/json" -H "Accept: application/json" -H \
  "X-Auth-Token: ${TOKEN}" \
  -d '{"metadata": {"x": "1", "y": {"aa":"bb"}}}'
HTTP/1.1 500 Internal Server Error
Content-Length: 128
Content-Type: application/json
X-Compute-Request-Id: req-b19eef5b-4e1b-4147-a2ae-d81e05fd6e77
X-Openstack-Request-Id: req-b19eef5b-4e1b-4147-a2ae-d81e05fd6e77
Date: Fri, 12 May 2017 11:54:11 GMT

{"computeFault": {"message": "The server has either erred or is incapable of performing the requested operation.", "code": 500}}
---

We're going to set such metadata when ironic attaches or detaches a volume.
[1] https://github.com/openstack/ironic/blob/767ed8002045defa0a3e982c22a0c4856796df7e/ironic/common/cinder.py#L425
[2] https://github.com/openstack/ironic/blob/767ed8002045defa0a3e982c22a0c4856796df7e/ironic/common/cinder.py#L114

summary: - Neted metadata to volume causes an internal server error
+ Nested metadata to volume causes an internal server error
luqitao (qtlu)
Changed in cinder:
status: New → Confirmed
assignee: nobody → luqitao (qtlu)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/465829

Changed in cinder:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/465829
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=4c230df10e8b637c9b0dc6bdc933c21da425d918
Submitter: Jenkins
Branch: master

commit 4c230df10e8b637c9b0dc6bdc933c21da425d918
Author: luqitao <email address hidden>
Date: Thu May 18 01:19:58 2017 -0400

    Check the volume metadata value is a string or not

    When creating or updating the metadata for a volume, if user
    give a nested value, cinder-api will raise a 500 error, the root
    cause is a syntax error in sql statement.

    According to cinder api ref [1], the metadata value should be a
    string.

    [1] https://developer.openstack.org/api-ref/block-storage/v3/?expanded=update-a-volume-s-metadata-detail#update-a-volume-s-metadata

    Change-Id: I6febfe177fb49372bb6413d3b6478cb762170b2a
    Closes-Bug: #1690363

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 11.0.0.0b2

This issue was fixed in the openstack/cinder 11.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.