Common context module missed in Glance

Bug #1288846 reported by Viktor Serhieiev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Eugeniya Kudryashova
oslo-incubator
Fix Released
Undecided
Viktor Serhieiev

Bug Description

Common module glance.openstack.common.db.sqlalchemy.utils requires common context module [1] but this module missed in glance, so we get an error, when we try to use sqlalchemy.utils module. See an example at [2]

[1] https://github.com/openstack/glance/blob/master/glance/openstack/common/db/sqlalchemy/utils.py#L41
[2] http://logs.openstack.org/77/43277/19/check/gate-glance-python27/a4b3b56/console.html

Tags: db context
Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :

I'm a little worried on the future Oslo-db synchron for Glance.

Currently there is only one place use Oslo common context in Oslo-db [1], so it can be fixed easily and isn't a big deal, but because Glance don't use common context now, it means all the "context" object within the Oslo-db code are all be glance.context.RequestContext object instead of common context object, so I'm thinking how can we fix it if Oslo-db use particular method of common context object when we synchronize it in the future? Do you think it's a idea if we leverage Oslo common context in Glance completely instead of using private implementation (glance.context)?

[1] https://github.com/openstack/glance/blob/master/glance/openstack/common/db/sqlalchemy/utils.py#L186

Zhi Yan Liu (lzy-dev)
Changed in glance:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Viktor Serhieiev (vsergeyev) wrote :

Agree, it sounds reasonable.

Changed in oslo:
assignee: nobody → Victor Sergeyev (vsergeyev)
status: New → In Progress
Revision history for this message
Viktor Serhieiev (vsergeyev) wrote :

See patch in Oslo - https://review.openstack.org/#/c/79653 (Remove common context usage from db model_query())

Revision history for this message
Roman Podoliaka (rpodolyaka) wrote :

In oslo.db we've been actually thinking about removing of the common context module. As you already pointed out, it's currently used only in one function, which hasn't been synced and reused in any of target OpenStack projects yet, so we can modify it easily. And from the oslo.db API point of view it actually makes sense to accept keyword arguments instead of a context instance.

At the same time, openstack.common.context is still useful for logging, so it might make sense for glance to use the common context module.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.db (master)

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

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

Reviewed: https://review.openstack.org/93396
Committed: https://git.openstack.org/cgit/openstack/oslo.db/commit/?id=4f58e79436a92acbdb6a738f3f8aa8200ebcc471
Submitter: Jenkins
Branch: master

commit 4f58e79436a92acbdb6a738f3f8aa8200ebcc471
Author: Victor Sergeyev <email address hidden>
Date: Tue May 13 11:54:23 2014 +0300

    Remove common context usage from db model_query()

    Currently, function model_query() from oslo.db.sqlalchemy.utils uses
    is_use_context() function in order to determine whether a normal or an
    admin user request is being processed. But usage of RequestContext is
    not unified across OpenStack projects, so there is no way for oslo.db to
    guarantee it processes project_id/deleted filters correctly here.

    To remove this ambiguity, project_id/deleted filters should be passed
    explicitly instead. At the same time, developers of OpenStack projects
    are encouraged to provide wrappers for oslo.db model_query() function,
    so that they could determine the values for project_id/deleted filters
    depending on how they use RequestContext in their project.

    Closes-bug: #1288846
    Change-Id: Iec5cbbc44cf9626f0464ab684dff1ba37e006151

Changed in oslo:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in oslo:
milestone: none → juno-1
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on oslo-incubator (master)

Change abandoned by Victor Sergeyev (<email address hidden>) on branch: master
Review: https://review.openstack.org/79653

Revision history for this message
Viktor Serhieiev (vsergeyev) wrote :

Change https://review.openstack.org/#/c/106818/ fixes this bug in Glance

Changed in glance:
assignee: nobody → Eugeniya Kudryashova (ekudryashova)
Changed in glance:
status: Triaged → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: juno-3 → 2014.2
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.