update cell error

Bug #1198796 reported by skywalker
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Russell Bryant

Bug Description

I updated the cell info and the response is as follows:
{
    "computeFault": {
        "message": "The server has either erred or is incapable of performing the requested operation.",
        "code": 500
    }
}

I found error in nova-cells.log:
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack Traceback (most recent call last):
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/__init__.py", line 81, in __call__
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack return req.get_response(self.application)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack application, catch_exc_info=False)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack return resp(environ, start_response)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/keystoneclient/middleware/auth_token.py", line 450, in __call__
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack return self.app(env, start_response)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack return resp(environ, start_response)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack return resp(environ, start_response)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack return resp(environ, start_response)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack response = self.app(environ, start_response)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack return resp(environ, start_response)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 890, in __call__
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack content_type, body, accept)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 942, in _process_stack
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack action_result = self.dispatch(meth, request, action_args)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 1022, in dispatch
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack return method(req=request, **action_args)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/compute/contrib/cells.py", line 257, in update
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack return dict(cell=_scrub_cell(cell))
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/compute/contrib/cells.py", line 118, in _scrub_cell
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack cell_info = _filter_keys(cell, keys)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/compute/contrib/cells.py", line 110, in _filter_keys
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack return dict((k, v) for k, v in item.iteritems() if k in keys)
2013-07-07 23:55:20.777 31477 TRACE nova.api.openstack AttributeError: 'Query' object has no attribute 'iteritems'

I viewed the code and found that:
@require_admin_context
def cell_update(context, cell_name, values):
    session = get_session()
    with session.begin():
        cell = _cell_get_by_name_query(context, cell_name, session=session)
        cell.update(values)
    return cell

The method nova.db.sqlalchemy.api.cell_update() returns a 'Query' object.

def _filter_keys(item, keys):
    """
    Filters all model attributes except for keys
    item is a dict

    """
    return dict((k, v) for k, v in item.iteritems() if k in keys)

The method nova.api.openstack.compute.contrib.cells_filter_keys() uses the 'Query' object as a dict.

This bring on the error.

Tags: cells
Matt Riedemann (mriedem)
tags: added: cells
Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
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/45718

Changed in nova:
assignee: nobody → Russell Bryant (russellb)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/45718
Committed: http://github.com/openstack/nova/commit/f10f67dcc82dc7fda5aaf546b145dad34db82f7b
Submitter: Jenkins
Branch: master

commit f10f67dcc82dc7fda5aaf546b145dad34db82f7b
Author: Russell Bryant <email address hidden>
Date: Mon Sep 9 13:50:04 2013 -0400

    Don't return query from db API

    The cell_update() method of the sqlalchemy db API returned a Query when
    it really intended to return a Cell. Fix this and tweak the db API test
    so that it verifies that the result of this method is a Cell.

    Change-Id: I7ab7ea19f00ac2e8c2c73afe8a14f331940b4580
    Closes-bug: #1198796

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → havana-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/48567

Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
tags: added: grizzly-backport-potential
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-rc1 → 2013.2
Alan Pevec (apevec)
tags: removed: grizzly-backport-potential
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.