floating ip list fails for non-admin users

Bug #902626 reported by Jesse Andrews
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Jake Dahn

Bug Description

After updating devstack I can no longer list floating ips.

steps:

1) install essex devstack (master branch)
2) create a collection of floating ips (default)
3) login as a non-admin user (demo is created by default)
4) click on floating ips
5) click allocate

Expected:

after step 4 you should see a blank list, after step 5 you should see a single ip

Actual:

Allocation seemed to succeed but horizon reported in both step 4/5:

   Error: Error fetching floating ips: The server has either erred or is incapable of performing the requested operation.

---

If I look at nova-api I see an error that nova is (improperly) attempting to check for admin-ness. Members of a project should be able to list IPs for their project.

2011-12-10 14:39:55,358 ERROR nova.api.openstack.v2 [58258ebc-16ac-4d87-8026-a1ddafb7d13f jesse 11] Caught error: Remote error: AdminRequired User does not have admin privileges
[u'Traceback (most recent call last):\n', u' File "/opt/stack/nova/nova/rpc/impl_kombu.py", line 620, in _process_data\n rval = node_func(context=ctxt, **node_args)\n', u' File "/opt/stack/nova/nova/network/manager.py", line 434, in get_floating_ips_by_project\n context.project_id)\n', u' File "/opt/stack/nova/nova/db/api.py", line 294, in floating_ip_get_all_by_project\n return IMPL.floating_ip_get_all_by_project(context, project_id)\n', u' File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 113, in wrapper\n return f(*args, **kwargs)\n', u' File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 616, in floating_ip_get_all_by_project\n return _floating_ip_get_all(context).\\\n', u' File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 94, in wrapper\n raise exception.AdminRequired()\n', u'AdminRequired: User does not have admin privileges\n'].
(nova.api.openstack.v2): TRACE: Traceback (most recent call last):
(nova.api.openstack.v2): TRACE: File "/opt/stack/nova/nova/api/openstack/v2/__init__.py", line 61, in __call__
(nova.api.openstack.v2): TRACE: return req.get_response(self.application)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in get_response
(nova.api.openstack.v2): TRACE: application, catch_exc_info=False)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in call_application
(nova.api.openstack.v2): TRACE: app_iter = application(self.environ, start_response)
(nova.api.openstack.v2): TRACE: File "/opt/stack/keystone/keystone/middleware/auth_token.py", line 212, in __call__
(nova.api.openstack.v2): TRACE: return self._forward_request(env, start_response, proxy_headers)
(nova.api.openstack.v2): TRACE: File "/opt/stack/keystone/keystone/middleware/auth_token.py", line 344, in _forward_request
(nova.api.openstack.v2): TRACE: return self.app(env, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
(nova.api.openstack.v2): TRACE: return resp(environ, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
(nova.api.openstack.v2): TRACE: return resp(environ, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
(nova.api.openstack.v2): TRACE: resp = self.call_func(req, *args, **self.kwargs)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
(nova.api.openstack.v2): TRACE: return self.func(req, *args, **kwargs)
(nova.api.openstack.v2): TRACE: File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 499, in __call__
(nova.api.openstack.v2): TRACE: response = req.get_response(self.application)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1053, in get_response
(nova.api.openstack.v2): TRACE: application, catch_exc_info=False)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1022, in call_application
(nova.api.openstack.v2): TRACE: app_iter = application(self.environ, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
(nova.api.openstack.v2): TRACE: return resp(environ, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/pymodules/python2.7/routes/middleware.py", line 131, in __call__
(nova.api.openstack.v2): TRACE: response = self.app(environ, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 159, in __call__
(nova.api.openstack.v2): TRACE: return resp(environ, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 147, in __call__
(nova.api.openstack.v2): TRACE: resp = self.call_func(req, *args, **self.kwargs)
(nova.api.openstack.v2): TRACE: File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 208, in call_func
(nova.api.openstack.v2): TRACE: return self.func(req, *args, **kwargs)
(nova.api.openstack.v2): TRACE: File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 567, in __call__
(nova.api.openstack.v2): TRACE: action_result = self.dispatch(request, action, args)
(nova.api.openstack.v2): TRACE: File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 599, in dispatch
(nova.api.openstack.v2): TRACE: return controller_method(req=request, **action_args)
(nova.api.openstack.v2): TRACE: File "/opt/stack/nova/nova/api/openstack/v2/contrib/floating_ips.py", line 75, in index
(nova.api.openstack.v2): TRACE: floating_ips = self.network_api.get_floating_ips_by_project(context)
(nova.api.openstack.v2): TRACE: File "/opt/stack/nova/nova/network/api.py", line 51, in get_floating_ips_by_project
(nova.api.openstack.v2): TRACE: {'method': 'get_floating_ips_by_project'})
(nova.api.openstack.v2): TRACE: File "/opt/stack/nova/nova/rpc/__init__.py", line 45, in call
(nova.api.openstack.v2): TRACE: return get_impl().call(context, topic, msg)
(nova.api.openstack.v2): TRACE: File "/opt/stack/nova/nova/rpc/impl_kombu.py", line 747, in call
(nova.api.openstack.v2): TRACE: rv = list(rv)
(nova.api.openstack.v2): TRACE: File "/opt/stack/nova/nova/rpc/impl_kombu.py", line 715, in __iter__
(nova.api.openstack.v2): TRACE: raise result

Revision history for this message
Jesse Andrews (anotherjesse) wrote :

Seems to be a side effect of https://github.com/openstack/nova/commit/c40ee5cfe75e8b1209dc53fc7eb2097812efa54e

line 616 calls _floating_ip_get_all which requires admin

We could either send a context_elevated or redo the way the call is made

Changed in nova:
importance: Undecided → Medium
assignee: nobody → Jake Dahn (jakedahn)
Changed in nova:
status: New → In Progress
milestone: none → essex-2
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/2345
Committed: http://github.com/openstack/nova/commit/369050f3a3f82460825edd23079f8f35334bdf14
Submitter: Jenkins
Branch: master

 status fixcommitted
 done

commit 369050f3a3f82460825edd23079f8f35334bdf14
Author: jakedahn <email address hidden>
Date: Wed Dec 14 16:04:46 2011 -0800

    Bug 902626

    Fixing typo which breaks floating_ip_get_all_by_project.

    Change-Id: Ic586455b202ece5a9fb61e78d243502069d39242

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to nova (milestone-proposed)

Reviewed: https://review.openstack.org/2359
Committed: http://github.com/openstack/nova/commit/b25d1375d52e01418af6faeea2939b23498b2fb9
Submitter: Jenkins
Branch: milestone-proposed

 tag in-milestone-proposed
 done

commit b25d1375d52e01418af6faeea2939b23498b2fb9
Author: jakedahn <email address hidden>
Date: Wed Dec 14 16:04:46 2011 -0800

    Bug 902626

    Fixing typo which breaks floating_ip_get_all_by_project.

    Change-Id: Ic586455b202ece5a9fb61e78d243502069d39242

Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: essex-2 → 2012.1
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.