extra_specs string check breaks backward compatibility

Bug #1358818 reported by Matthew Edmonds
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Davanum Srinivas (DIMS)

Bug Description

We've found that while with Icehouse we were able to specify extra_specs values as ints or floats, in Juno the command fails unless we make these values strings by quoting them. This breaks backward compatibility.

compare Icehouse:

curl -k -i -X POST http://127.0.0.1:8774/v2/982607a6a1134514abac252fc25384ad/flavors/1/os-extra_specs -H "X-Auth-Token: *****" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"extra_specs":{"powervm:proc_units":"0.2","powervm:processor_compatibility":"default","powervm:min_proc_units":"0.1","powervm:max_proc_units":"0.5","powervm:min_vcpu":1,"powervm:max_vcpu":5,"powervm:min_mem":1024,"powervm:max_mem":4096,"powervm:availability_priority":127,"powervm:dedicated_proc":"false","powervm:uncapped":"true","powervm:shared_weight":128}}'; echo
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 385
X-Compute-Request-Id: req-9132922d-c703-4573-9822-9ca7a6bf7b0d
Date: Thu, 14 Aug 2014 18:25:02 GMT

{"extra_specs": {"powervm:processor_compatibility": "default", "powervm:max_proc_units": "0.5", "powervm:shared_weight": 128, "powervm:min_mem": 1024, "powervm:max_mem": 4096, "powervm:uncapped": "true", "powervm:proc_units": "0.2", "powervm:dedicated_proc": "false", "powervm:max_vcpu": 5, "powervm:availability_priority": 127, "powervm:min_proc_units": "0.1", "powervm:min_vcpu": 1}}

to Juno:

curl -k -i -X POST http://127.0.0.1:8774/v2/be2ffade1e0b4bed83619e00482317d1/flavors/1/os-extra_specs -H "X-Auth-Token: *****" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"extra_specs":{"powervm:proc_units":"0.2","powervm:processor_compatibility":"default","powervm:min_proc_units":"0.1","powervm:max_proc_units":"0.5","powervm:min_vcpu":1,"powervm:max_vcpu":5,"powervm:min_mem":1024,"powervm:max_mem":4096,"powervm:availability_priority":127,"powervm:dedicated_proc":"false","powervm:uncapped":"true","powervm:shared_weight":128}}'; echo
HTTP/1.1 400 Bad Request
Content-Length: 88
Content-Type: application/json; charset=UTF-8
Date: Thu, 14 Aug 2014 18:25:46 GMT

{"badRequest": {"message": "extra_specs value is not a string or unicode", "code": 400}}

if I modify the data sent so that everything is a string, it will work for Juno:

curl -k -i -X POST http://127.0.0.1:8774/v2/be2ffade1e0b4bed83619e00482317d1/flavors/1/os-extra_specs -H "X-Auth-Token: *****" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"extra_specs":{"powervm:proc_units":"0.2","powervm:processor_compatibility":"default","powervm:min_proc_units":"0.1","powervm:max_proc_units":"0.5","powervm:min_vcpu":"1","powervm:max_vcpu":"5","powervm:min_mem":"1024","powervm:max_mem":"4096","powervm:availability_priority":"127","powervm:dedicated_proc":"false","powervm:uncapped":"true","powervm:shared_weight":"128"}}'; echo
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 397
Date: Thu, 14 Aug 2014 18:26:27 GMT

{"extra_specs": {"powervm:processor_compatibility": "default", "powervm:max_proc_units": "0.5", "powervm:shared_weight": "128", "powervm:min_mem": "1024", "powervm:max_mem": "4096", "powervm:uncapped": "true", "powervm:proc_units": "0.2", "powervm:dedicated_proc": "false", "powervm:max_vcpu": "5", "powervm:availability_priority": "127", "powervm:min_proc_units": "0.1", "powervm:min_vcpu": "1"}}

The API change guidelines (https://wiki.openstack.org/wiki/APIChangeGuidelines) describe as "generally not acceptable": "A change such that a request which was successful before now results in an error response (unless the success reported previously was hiding an existing error condition)". That is exactly what this is.

Tags: api
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
assignee: nobody → Davanum Srinivas (DIMS) (dims-v)
status: New → In Progress
Changed in nova:
importance: Undecided → High
Matt Riedemann (mriedem)
tags: added: api
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/115660
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=e9a5463bf71cb2f2e7185dea3ed8ee8b973a3208
Submitter: Jenkins
Branch: master

commit e9a5463bf71cb2f2e7185dea3ed8ee8b973a3208
Author: Davanum Srinivas <email address hidden>
Date: Wed Aug 20 10:27:56 2014 -0400

    Restore backward compat for int/float in extra_specs

    In icehouse, we were able to store ints, floats in
    extra_specs, with I195bd5d45a896e9b26dd81dab1e49c9f939b4805 we
    forced the value(s) to be just strings. Let's loosen up
    this restriction and still enforce a length check.

    Closes-Bug: #1358818
    Change-Id: I7687d0214e44d4af1b595c6c6c7ce685d4083556

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-3 → 2014.2
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.