discrepancy in snapshot_manage create API for 'ref' parameter

Bug #1743338 reported by Neha Alhat
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Neha Alhat

Bug Description

Before merging patch[1] for snapshot_manage create API,
user was allowed to pass ref:”string” in the request body. But after this patch is merged, it returns 400 error.

A. When user passes "ref" as "string" in curl command before merging patch [1]:

curl -g -i -X POST http://10.232.48.198/volume/v2/5fe3b884c656498b922d8551c86cb0b0/os-snapshot-manage -H "Content-Type: application/json" -H "User-Agent: python-cinderclient" -H "Accept: application/json" -H "X-Auth-Token: 1b882a6cc9f047e79b99e65c33ad6437" -H "X-OpenStack-Request-ID: req-2db58dbd-cf35-4fde-9c71-8fbb803eb9df" -d '{"snapshot": {"volume_id": "daf9e961-d6dd-41f8-9cb6-4bba0fce8a1c", "ref": "string"}}'

output:
HTTP/1.1 202 Accepted
Date: Mon, 15 Jan 2018 07:11:03 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Type: application/json
x-compute-request-id: req-d8a3c2b6-e11b-4664-acc8-f8d2e703e14a
Content-Length: 261
x-openstack-request-id: req-d8a3c2b6-e11b-4664-acc8-f8d2e703e14a
Connection: close

B. When user passes "ref" as "string" in curl command after merging patch [1]:

1. curl -g -i -X POST http://10.232.48.198/volume/v2/5fe3b884c656498b922d8551c86cb0b0/os-snapshot-manage -H "Content-Type: application/json" -H "User-Agent: python-cinderclient" -H "Accept: application/json" -H "X-Auth-Token: 48336058d0fb47c58ae9deabdc43d1ee" -H "X-OpenStack-Request-ID: req-2db58dbd-cf35-4fde-9c71-8fbb803eb9df" -d '{"snapshot": {"volume_id": "daf9e961-d6dd-41f8-9cb6-4bba0fce8a1c", "ref": "test"}}'
HTTP/1.1 400 Bad Request
Date: Mon, 15 Jan 2018 08:38:10 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 134
Content-Type: application/json
x-compute-request-id: req-eb995fd2-68e8-427b-b3b8-017d2466e64e
x-openstack-request-id: req-eb995fd2-68e8-427b-b3b8-017d2466e64e
Connection: close

{"badRequest": {"message": "Invalid input for field/attribute ref. Value: test. 'test' is not of type 'object', 'null'", "code": 400}}

Expected output: To keep the same behavior before schema validation changes were merged [1].
ref parameter should accept value as string or object (object can be null).

[1] : https://review.openstack.org/#/c/528631/

Neha Alhat (nehaalhat)
Changed in cinder:
assignee: nobody → Neha Alhat (nehaalhat)
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/534075

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

Reviewed: https://review.openstack.org/534075
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=38976a5b9316ba37123d04d13b0dd7dca7f2d1fe
Submitter: Zuul
Branch: master

commit 38976a5b9316ba37123d04d13b0dd7dca7f2d1fe
Author: Neha Alhat <email address hidden>
Date: Mon Jan 15 19:31:15 2018 +0530

    Fix BadRequest for 'ref' as string value

    Before schema validation patch [1] got merged, it was allowed to
    pass "ref" as string value (ref:"string") in request body of
    snapshot_manage create API but after schema changes, it is
    returning 400 error.

    This patch fixes this issue by allowing user to pass "ref" parameter
    as string.

    Note: In case user uses python-cinderclient to manage snapshot, it
    always passes "ref" parameter as object (dict).

    Change-Id: I6464eacf9f970cbcc1429a50bd59d59faf262bc6
    Closes-Bug: #1743338

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

This issue was fixed in the openstack/cinder 12.0.0.0b3 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.