Syntax error in server create request body should return 400 code

Bug #1175683 reported by Phil Nelson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Satyanarayana Patibandla

Bug Description

While trying to create a new server instance, an error (500 return code) was received because of bad syntax with the "networks" parameter found in the request body (needed to surround parameter value with square brackets). While the server created successfully once the syntax in the request body was corrected, it was determined that the proper return code for the error case would have been a 400 (bad request).

Here is what the network info in the request body looked like when the 500 error was received:

   'networkRef' : '124af605-b346-43d2-b4f6-316d9f83aee9',
    'networks' : {'fixed_ip' : '192.168.1.250', 'uuid' : '124af605-b346-43d2-b4f6-316d9f83aee9'},

Changed in nova:
assignee: nobody → Satyanarayana Patibandla (satya-patibandla-i)
Revision history for this message
Satyanarayana Patibandla (satya-patibandla-i) wrote :

Could you please provide me the entire request details which you are sending to create a server.

Revision history for this message
Phil Nelson (philnel) wrote :

This is the request body used for the failed create server request which resulted in the 500 return code. Just to reaffirm, we did get this create to work by adding the square brackets around the value for the "networks" parameter.

{
  server:{
    'flavor' : {'ram' : 400, 'vcpus' : 1, 'disk': 40},
    'imageRef' : 'http://<ip_addr>:8774/v2/abbdb2578dc34c8ba4e690310a29ca70/images/054c7a66-66ea-496c-8000-a5f654357969',
    'networkRef' : '124af605-b346-43d2-b4f6-316d9f83aee9',
    'networks' : {'fixed_ip' : '192.168.1.250', 'uuid' : '124af605-b346-43d2-b4f6-316d9f83aee9'},
    'name' : test_server',
    'description' : 'test server',
    'availability_zone' : 'nova'
  }
}

Revision history for this message
Thierry Carrez (ttx) wrote :

Which version of Nova are you running ?

Changed in nova:
importance: Undecided → Low
status: New → Confirmed
Changed in nova:
status: Confirmed → In Progress
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/28705

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

Reviewed: https://review.openstack.org/28705
Committed: http://github.com/openstack/nova/commit/53226b3262a95e4e62472416c125ee3ebd58b52e
Submitter: Jenkins
Branch: master

commit 53226b3262a95e4e62472416c125ee3ebd58b52e
Author: Satyanarayana Patibandla <email address hidden>
Date: Sat Apr 27 18:18:44 2013 -0400

    Added validation for networks parameter value

    A validation check is added for networks parameter value.
    In server create request body, if networks parameter value
    is not stored in a list then 'Bad networks format' error
    is thrown with bad request exception.A new test case is
    added to verify whether it is returning bad request exception
    when invalid syntax is used.

    Fixes: bug #1175683

    Change-Id: I457a1626c56281f89d8c4a606ccc0d0e3aea05fa

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