listing nova instances with invalid status raises 500 InternalServerError for admin user

Bug #1579706 reported by Dinesh Bhor
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Ed Leafe
Mitaka
Fix Released
Medium
Matt Riedemann

Bug Description

Listing nova instances with invalid status raises 500 InternalServerError for admin user.

Steps to reproduce
==================
Command:
nova list --status invalid-status

Actual result
=============
ERROR (ClientException): The server has either erred or is incapable of performing the requested operation. (HTTP 500)
(Request-ID: req-07567061-bd94-4c83-ba8e-510cad9f388b)

Expected result
===============
It should return empty instance list.

n-API LOG:
2016-05-09 10:42:28.653 ERROR nova.api.openstack [req-07567061-bd94-4c83-ba8e-510cad9f388b admin admin] Caught error: 'instances'
2016-05-09 10:42:28.653 TRACE nova.api.openstack Traceback (most recent call last):
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/__init__.py", line 134, in __call__
2016-05-09 10:42:28.653 TRACE nova.api.openstack return req.get_response(self.application)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in s
end
2016-05-09 10:42:28.653 TRACE nova.api.openstack application, catch_exc_info=False)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in c
all_application
2016-05-09 10:42:28.653 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call
__
2016-05-09 10:42:28.653 TRACE nova.api.openstack return resp(environ, start_response)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call
__
2016-05-09 10:42:28.653 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_f
unc
2016-05-09 10:42:28.653 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/keystonemiddleware/auth_token/__in
it__.py", line 467, in __call__
2016-05-09 10:42:28.653 TRACE nova.api.openstack response = req.get_response(self._app)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
2016-05-09 10:42:28.653 TRACE nova.api.openstack application, catch_exc_info=False)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
2016-05-09 10:42:28.653 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2016-05-09 10:42:28.653 TRACE nova.api.openstack return resp(environ, start_response)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2016-05-09 10:42:28.653 TRACE nova.api.openstack return resp(environ, start_response)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/routes/middleware.py", line 141, in __call__
2016-05-09 10:42:28.653 TRACE nova.api.openstack response = self.app(environ, start_response)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2016-05-09 10:42:28.653 TRACE nova.api.openstack return resp(environ, start_response)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2016-05-09 10:42:28.653 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2016-05-09 10:42:28.653 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 674, in __call__
2016-05-09 10:42:28.653 TRACE nova.api.openstack content_type, body, accept)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 758, in _process_stack
2016-05-09 10:42:28.653 TRACE nova.api.openstack request, action_args)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 621, in post_process_extensions
2016-05-09 10:42:28.653 TRACE nova.api.openstack **action_args)
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/compute/extended_server_attributes.py", line 92, in detail
2016-05-09 10:42:28.653 TRACE nova.api.openstack instances = req.get_db_instances()
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 145, in get_db_instances
2016-05-09 10:42:28.653 TRACE nova.api.openstack return self.get_db_items('instances')
2016-05-09 10:42:28.653 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 128, in get_db_items
2016-05-09 10:42:28.653 TRACE nova.api.openstack return self._extension_data['db_items'][key]
2016-05-09 10:42:28.653 TRACE nova.api.openstack KeyError: 'instances'
2016-05-09 10:42:28.653 TRACE nova.api.openstack

Changed in nova:
assignee: nobody → Dinesh Bhor (dinesh-bhor)
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/315964

Changed in nova:
status: New → In Progress
Revision history for this message
Ken'ichi Ohmichi (oomichi) wrote :
Revision history for this message
Ken'ichi Ohmichi (oomichi) wrote :
Download full text (5.3 KiB)

nova-api log:

2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack [req-84c581d6-b806-4bfe-a950-1db022912b1b tempest-ServersAdminTestJSON-1176263737 tempest-ServersAdminTestJSON-1176263737] Caught erro
r: 'instances'
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack Traceback (most recent call last):
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack File "/opt/stack/new/nova/nova/api/openstack/__init__.py", line 107, in __call__
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack return req.get_response(self.application)
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack application, catch_exc_info=False)
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack app_iter = application(self.environ, start_response)
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack return resp(environ, start_response)
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack return self.func(req, *args, **kwargs)
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/keystonemiddleware/auth_token/__init__.py", line 472, in __call__
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack response = req.get_response(self._app)
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack application, catch_exc_info=False)
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack app_iter = application(self.environ, start_response)
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack return resp(environ, start_response)
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack return resp(environ, start_response)
2016-06-04 01:59:45.903 12245 ERROR nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/routes/middleware.py", line 141, in __call__
2016-06-04 01:59:45.903 12245 ERROR nova.api.opensta...

Read more...

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in nova:
assignee: Dinesh Bhor (dinesh-bhor) → Ed Leafe (ed-leafe)
Changed in nova:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit ee4d69e28dfb3d4764186d0c0212d53c99bda3ca
Author: EdLeafe <email address hidden>
Date: Wed Jun 29 18:51:34 2016 +0000

    Return HTTP 200 on list for invalid status

    The server listing API raises a 500 error if you pass an invalid status
    filter for admin user. In the case of a non-admin user, it simply
    returns an empty list. In the case of an admin user, it fetches extended
    server attributes, so a condition was added to get extended server
    attributes only when servers list is not empty.

    This change simply removes the cause of the 500 exception. A subsequent
    patch with a microversion bump will modify the behavior so that a 400
    Bad Request will be raised for an invalid status, for both admin and
    non-admin alike.

    Co-Authored-By: Dinesh Bhor <email address hidden>

    Closes-Bug: #1579706

    Change-Id: I10bde78f0a9ac59b8646d58f62fa5056f989f54f

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/336577

Matt Riedemann (mriedem)
Changed in nova:
importance: Low → Medium
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/nova 14.0.0.0b2

This issue was fixed in the openstack/nova 14.0.0.0b2 development milestone.

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

Reviewed: https://review.openstack.org/336577
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=9a97047850e6febce090cee9a5f2224cdf02a2c3
Submitter: Jenkins
Branch: stable/mitaka

commit 9a97047850e6febce090cee9a5f2224cdf02a2c3
Author: EdLeafe <email address hidden>
Date: Wed Jun 29 18:51:34 2016 +0000

    Return HTTP 200 on list for invalid status

    The server listing API raises a 500 error if you pass an invalid status
    filter for admin user. In the case of a non-admin user, it simply
    returns an empty list. In the case of an admin user, it fetches extended
    server attributes, so a condition was added to get extended server
    attributes only when servers list is not empty.

    This change simply removes the cause of the 500 exception. A subsequent
    patch with a microversion bump will modify the behavior so that a 400
    Bad Request will be raised for an invalid status, for both admin and
    non-admin alike.

    Co-Authored-By: Dinesh Bhor <email address hidden>

    Closes-Bug: #1579706

    Change-Id: I10bde78f0a9ac59b8646d58f62fa5056f989f54f
    (cherry picked from commit ee4d69e28dfb3d4764186d0c0212d53c99bda3ca)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 13.1.2

This issue was fixed in the openstack/nova 13.1.2 release.

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.