← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1627838] Re: Context is reset to by ClientRouter in nova/rpc.py

 

Reviewed:  https://review.openstack.org/377093
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=d218f0df65729e2818a63a22f9eb476d376e168e
Submitter: Jenkins
Branch:    master

commit d218f0df65729e2818a63a22f9eb476d376e168e
Author: melanie witt <melwittt@xxxxxxxxx>
Date:   Mon Sep 26 20:08:33 2016 +0000

    Stop overwriting thread local context in ClientRouter
    
    In commit 4df0869, a ClientRouter was added to cache client connections
    to cell message queues. The periodic task for removing stale clients
    is called with an empty RequestContext, but this overwrites the copy
    in thread local storage unless overwrite=False is specified.
    
    This adds overwrite=False to the empty RequestContext to prevent it
    from overwriting the thread local context. All of the other periodic
    tasks use get_admin_context() which also creates a RequestContext with
    overwrite=False.
    
    Closes-Bug: #1627838
    
    Change-Id: I48024952865fe017e0cb786567b5b445b05e7659


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1627838

Title:
  Context is reset to by ClientRouter in nova/rpc.py

Status in OpenStack Compute (nova):
  Fix Released
Status in OpenStack Compute (nova) newton series:
  In Progress

Bug description:
  The following line in the constructor of ClientRouter in nova/rpc.py
  is resetting the context on the threading.local to an invalid context.

  self.run_periodic_tasks(nova.context.RequestContext())

  Rather than creating a new context here, I believe it should either
  be:

  self.run_periodic_tasks(nova.context.RequestContext(overwrite=False))
  or
  from oslo_context import context
  curr_context = context.get_current()
  self.run_periodic_tasks(curr_context)

  
  Before the call

  <Context {'domain': None, 'project_name': u'default',
  'project_domain': None, 'timestamp': '2016-09-26T19:00:37.292388',
  'auth_token': u'gAAAAABX6XAxNbPfOJvmNZqCGd3kws4l92qrbvL_JTCpTVv-
  6Sk8fVE8F4VklDunreU', 'remote_address': u'127.0.0.1', 'quota_class':
  None, 'resource_uuid': None, 'is_admin': True, 'user':
  u'0688b01e6439ca32d698d20789d52169126fb41fb1a4ddafcebb97d854e836c9',
  'service_catalog': [{u'endpoints': [{u'adminURL':
  u'https://ip9-114-192-147.pok.stglabs.ibm.com:9000/v2/cd65f1b0d9f6410c92101ed1211b74ea',
  u'region': u'RegionOne', u'internalURL':
  u'http://127.0.0.1:9000/v2/cd65f1b0d9f6410c92101ed1211b74ea',
  u'publicURL':
  u'https://XXXXX:9000/v2/cd65f1b0d9f6410c92101ed1211b74ea'}], u'type':
  u'volume', u'name': u'cinder'}], 'tenant':
  u'cd65f1b0d9f6410c92101ed1211b74ea', 'read_only': False, 'project_id':
  u'cd65f1b0d9f6410c92101ed1211b74ea', 'user_id':
  u'0688b01e6439ca32d698d20789d52169126fb41fb1a4ddafcebb97d854e836c9',
  'show_deleted': False, 'roles': [u'admin'], 'user_identity':
  u'0688b01e6439ca32d698d20789d52169126fb41fb1a4ddafcebb97d854e836c9
  cd65f1b0d9f6410c92101ed1211b74ea - - -', 'is_admin_project': True,
  'read_deleted': u'no', 'request_id': u'req-
  f5b85c48-a3b5-4fc0-bf36-3cf7c66182ed', 'instance_lock_checked': False,
  'user_domain': None, 'user_name': u'root'}>

  After the call (auth_token, user props, etc. are gone )

  <Context {'domain': None, 'project_name': None, 'project_domain':
  None, 'timestamp': '2016-09-26T19:00:44.442372', 'auth_token': None,
  'remote_address': None, 'quota_class': None, 'resource_uuid': None,
  'is_admin': False, 'user': None, 'service_catalog': [], 'tenant':
  None, 'read_only': False, 'project_id': None, 'user_id': None,
  'show_deleted': False, 'roles': [], 'user_identity': u'- - - - -',
  'is_admin_project': True, 'read_deleted': 'no', 'request_id': 'req-
  44d322cd-2e0c-4dba-bb65-c9962b8ac713', 'instance_lock_checked': False,
  'user_domain': None, 'user_name': None}>

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1627838/+subscriptions


References