Context goes None intermittently due to calls to get_admin_context method

Bug #899302 reported by Unmesh Gurjar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Vish Ishaya

Bug Description

While testing the Create server API with the master branch, I noticed from the (Compute server) logs that the context was getting set to None intermittently. After digging more into the issue, it looks like the calls to the 'get_admin_context( )' method in nova.context module is causing this.

If we trace the a request's path from the server logs, the context information needs to be available throughout the processing cycle of the request. However, since the calls to 'get_admin_context' sets the context to None, the '_log' method in NovaLogger fails to find the context and logs the messages without the request_id field. This results in the log messages after the call to 'get_admin_context' getting logged without request_id in it.
Same is also the case with the log messages after 'elevated' method is called.

This method needs to be fixed, so that a request path can be easily traced from the server logs.

description: updated
description: updated
description: updated
description: updated
Revision history for this message
Vish Ishaya (vishvananda) wrote :

I would propose all of the get_admin_context calls are converted to elevated. We should never be calling get_admin_context if we already have a context available. Then we can make elevated not clobber the local context.

Changed in nova:
status: New → Triaged
importance: Undecided → Medium
Changed in nova:
assignee: nobody → Vish Ishaya (vishvananda)
status: Triaged → In Progress
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/2923

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

Reviewed: https://review.openstack.org/2923
Committed: http://github.com/openstack/nova/commit/3d0311df9e3fccf96bde34e72f8011843941ac98
Submitter: Jenkins
Branch: master

commit 3d0311df9e3fccf96bde34e72f8011843941ac98
Author: Vishvananda Ishaya <email address hidden>
Date: Mon Jan 9 16:07:43 2012 -0800

    Don't overwrite local context on elevated

     * Adds an 'overwrite' parameter to context.__init__
     * Overwrite is set to false for elevated and get_admin_context
     * Fixes bug 899302

    Change-Id: Ic9464e5813d6db38c48239c7ea8f15aa1bff5562

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