User can pass scheduler_hints inside volume object for volume create API on master

Bug #1774155 reported by Pooja Jadhav
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Pooja Jadhav

Bug Description

On current master, user can pass scheduler_hints inside volume object.
One should not able to pass since its job of scheduler_hints as an extension.
For volume create API, first request transfers to scheduler_hints and extracts the hints and these extracted hints are part of volume object.

To be allies with NOVA, one should NOT pass scheduler_hints inside volume object.

In case of NOVA, server create API, if we pass scheduler_hints inside server object, it throws 400 error:

curl -g -i -X POST http://<IP Address>/compute/v2.1/servers -H "Accept: application/json" -H "Content-Type: application/json" -H "OpenStack-API-Version: compute 2.61" -H "User-Agent: python-novaclient" -H "X-Auth-Token: <Token>" -H "X-OpenStack-Nova-API-Version: 2.61" -d '{"server": {"name": "test_vm1", "imageRef": "f122daad-d164-42cb-af76-241dcd1c5337", "flavorRef": "1", "networks": "auto", "scheduler_hints": {"test": "abc"}}}'
HTTP/1.1 400 Bad Request
Date: Thu, 24 May 2018 07:06:24 GMT
Server: Apache/2.4.18 (Ubuntu)
OpenStack-API-Version: compute 2.61
X-OpenStack-Nova-API-Version: 2.61
Vary: OpenStack-API-Version,X-OpenStack-Nova-API-Version
Content-Type: application/json; charset=UTF-8
Content-Length: 325
x-openstack-request-id: req-2a92bf67-ea79-4c0e-8b20-66d744d36092
x-compute-request-id: req-2a92bf67-ea79-4c0e-8b20-66d744d36092
Connection: close

{"badRequest": {"message": "Invalid input for field/attribute server. Value: {u'flavorRef': u'1', u'scheduler_hints': {u'test': u'abc'}, u'name': u'test_vm1', u'imageRef': u'f122daad-d164-42cb-af76-241dcd1c5337', u'networks': u'auto'}. Additional properties are not allowed (u'scheduler_hints' was unexpected)", "code": 400}}

Steps to reproduce:

In cinder, it returns 202 Accepted. It should return 400 Bad Request for scheduler_hints parameter for volume create API.

In case of CINDER, volume create API,

curl -g -i -X POST http:// <ip_address>/volume/v3/3b192df72a864436a8a682659d93c1b2/volumes -H "User-Agent: python-cinderclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "OpenStack-API-Version: volume 3.47" -H "X-OpenStack-Cinder-API-Version: 3.47" -H "X-Auth-Token: 3b192df72a864436a8a682659d93c1b2" -d '{"volume": {"size": 1, "scheduler_hints": {"test": "test"}}}'

HTTP/1.1 202 Accepted
Date: Wed, 30 May 2018 07:12:34 GMT
Server: Apache/2.4.18 (Ubuntu)
x-compute-request-id: req-4aac529b-b6fc-4444-bd5c-d4346789e374
Content-Type: application/json
Content-Length: 845
OpenStack-API-Version: volume 3.47
Vary: OpenStack-API-Version
x-openstack-request-id: req-4aac529b-b6fc-4444-bd5c-d4346789e374
Connection: close

{"volume": {"migration_status": null, "provider_id": null, "attachments": [], "links": [{"href": "http://<ip_address>/volume/v3/3b192df72a864436a8a682659d93c1b2/volumes/56e758f9-55e9-4087-930f-69e608f32726", "rel": "self"}, {"href": "http:// <ip_address>/volume/3b192df72a864436a8a682659d93c1b2/volumes/56e758f9-55e9-4087-930f-69e608f32726", "rel": "bookmark"}], "availability_zone": "nova", "encrypted": false, "updated_at": null, "replication_status": null, "snapshot_id": null, "id": "56e758f9-55e9-4087-930f-69e608f32726", "size": 1, "user_id": "4c227e167d3d44d9b61bae46aa8b4305", "metadata": {}, "status": "creating", "description": null, "multiattach": false, "source_volid": null, "consistencygroup_id": null, "name": null, "bootable": "false", "created_at": "2018-05-30T07:12:35.000000", "volume_type": "lvmdriver-1", "group_id": null}}

Changed in cinder:
assignee: nobody → Pooja Jadhav (poojajadhav)
status: New → In Progress
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/573093

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/573093
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=48b8973aed73e9dc88288607aecc4da6a69d94ac
Submitter: Zuul
Branch: master

commit 48b8973aed73e9dc88288607aecc4da6a69d94ac
Author: bhagyashris <email address hidden>
Date: Wed Nov 8 19:17:27 2017 +0530

    V3 jsonschema validation: Volumes

    This patch adds jsonschema validation for below Volumes API's
    * POST /v3/{project_id}/volumes
    * PUT /v3/{project_id}/volumes/{volume_id}

    Adding new Microversion 3.53, this will have impact on both Create
    and Update Volume API

    * Create volume API will not accept additional properties like
      (user_id, project_id, status and attach_status).
    * Update volume API will require minimum one parameter in request
      body otherwise it will raise 400 error.

    APIImpact :
    Before 3.53 version, create volume allows additional properties,
    but now it will raise 400 error.
    Also before 3.53 version, update volume allows empty body {},
    but now it will raise 400 error.

    DocImpact
    Closes-Bug: #1774155
    Partial-Implements: bp json-schema-validation

    Change-Id: I1829b6796cd6d3fa1040dd0fb9280bec5bdbc92e

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

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