GET /servers?status=BALONEY returns 400, should return 200 with empty list
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Undecided
|
Davanum Srinivas (DIMS) |
Bug Description
This code in Tempest:
def test_list_
"""Return an empty list when invalid status is specified"""
resp, body = self.client.
servers = body['servers']
Currently fails with:
=======
ERROR: Return an empty list when invalid status is specified
-------
Traceback (most recent call last):
File "/home/
resp, body = self.client.
File "/home/
resp, body = self.get(url)
File "/home/
return self.request('GET', url, headers)
File "/home/
raise exceptions.
BadRequest: Bad request
Details: Bad request
Details: {u'badRequest': {u'message': u'Invalid server status: BALONEY', u'code': 400}}
-------
tempest.
tempest.
tempest.
tempest.
-------
The return should be an empty list and 200 OK to make this consistent with other non-existing filters like flavour ID or changes-since dates in the future that return an empty list.
The fact is that the API indicates the status parameter is a string, but no more details. As such, status=BALONEY is a valid filter that should return no records since no records match that status.
-jay
Changed in nova: | |
milestone: | none → grizzly-1 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | grizzly-1 → 2013.1 |
I would say this may be a gray area where the spec doesn't explicitly state what should happen when an invalid status is specified.
In my opinion the Nova code is currently doing the correct thing by throwing a 400 if a bad status is specified. Here is the relevant code:
# Verify search by 'status' contains a valid status. opts.pop( 'status' , None) vm_state_ from_status( status)
raise exc.HTTPBadRequ est(explanation =msg)
search_ opts['vm_ state'] = state
# Convert it to filter by vm_state for compute_api.
status = search_
if status is not None:
state = common.
if state is None:
msg = _('Invalid server status: %(status)s') % locals()