AttributeError in Quota API

Bug #972001 reported by Gabriel Hurley
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Gabriel Hurley

Bug Description

There seems to be an import problem in nova.db that causes an AttributeError. Details are as follows:

request:

REQ: curl -i http://10.144.11.107:8774/v2/d6f370533b384a88b648f01af3e3ea54/os-quota-sets/d6f370533b384a88b648f01af3e3ea54 -X GET -H "X-Auth-Project-Id: d6f370533b384a88b648f01af3e3ea54" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: eccc847bbece4282a70894a16f7cb173"

n-api output:

TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/compute/contrib/quotas.py", line 60, in show
TRACE nova.api.openstack db.sqlalchemy.api.authorize_project_context(context, id)
TRACE nova.api.openstack AttributeError: 'module' object has no attribute 'sqlalchemy'

The offending line is here:

https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/contrib/quotas.py#L60

Trying this in a python shell you get the same AttributeError by doing "from nova import db; db.sqlalchemy", whereas this works perfectly:

>>> from nova.db.sqlalchemy import api
>>> api.authorize_project_context
<function authorize_project_context at 0x3114050>

Looks like there's a bad __init__ or a circular import problem somewhere preventing that import from working as expected.

Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

(4:51:20 PM) vishy: gabrielhurley: in no case should code outside the db be calling that
(4:51:46 PM) vishy: gabrielhurley: and if they were it should be a from nova.db.sqlalchemy import api

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/6125

Changed in nova:
assignee: nobody → Gabriel Hurley (gabriel-hurley)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (milestone-proposed)

Fix proposed to branch: milestone-proposed
Review: https://review.openstack.org/6126

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

Reviewed: https://review.openstack.org/6125
Committed: http://github.com/openstack/nova/commit/4ceb1adc487b8ae55b881596f9f406d867df902d
Submitter: Jenkins
Branch: master

commit 4ceb1adc487b8ae55b881596f9f406d867df902d
Author: Gabriel Hurley <email address hidden>
Date: Mon Apr 2 18:29:26 2012 -0700

    Corrects an AttributeError in the quota API.

    Fixes bug 972001.

    Change-Id: Iaf833bb6dae9cc17689e9f13eff917e91a2b722a

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Medium
Thierry Carrez (ttx)
Changed in nova:
milestone: none → essex-rc3
tags: removed: essex-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (milestone-proposed)

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

commit 66342ca048a3590feefbfeb30944bdb7205c97bb
Author: Gabriel Hurley <email address hidden>
Date: Mon Apr 2 18:29:26 2012 -0700

    Corrects an AttributeError in the quota API.

    Fixes bug 972001.

    Change-Id: Iaf833bb6dae9cc17689e9f13eff917e91a2b722a

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