← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1408480] Re: PciDevTracker passes context module instead of instance

 

While this is Low by itself, it is required for Juno backport of bug
1415768

** Also affects: nova/juno
   Importance: Undecided
       Status: New

** Changed in: nova/juno
       Status: New => In Progress

** Changed in: nova/juno
   Importance: Undecided => High

** Changed in: nova/juno
     Assignee: (unassigned) => Nikola Đipanov (ndipanov)

** Tags removed: juno-backport-potential

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

Title:
  PciDevTracker passes context module instead of instance

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

Bug description:
  Currently, the code in the PciDevTracker.__init__() method of
  nova/pci/manager.py reads:

  ```
      def __init__(self, node_id=None):                                                                                                                                                       
          """Create a pci device tracker.                                                                                                                                                     
                                                                                                                                                                                              
          If a node_id is passed in, it will fetch pci devices information                                                                                                                    
          from database, otherwise, it will create an empty devices list                                                                                                                      
          and the resource tracker will update the node_id information later.                                                                                                                 
          """                                                                                                                                                                                 
                                                                                                                                                                                              
          super(PciDevTracker, self).__init__()                                                                                                                                               
          self.stale = {}                                                                                                                                                                     
          self.node_id = node_id                                                                                                                                                              
          self.stats = stats.PciDeviceStats()                                                                                                                                                 
          if node_id:                                                                                                                                                                         
              self.pci_devs = list(                                                                                                                                                           
                  objects.PciDeviceList.get_by_compute_node(context, node_id))                                                                                                                
          else:                                                                                                                                                                               
              self.pci_devs = []                                                                                                                                                              
          self._initial_instance_usage()                  
  ```

  The problem is that in the call to
  `objects.PciDeviceList.get_by_compute_node(context, node_id)`, there
  is no local value for the 'context' parameter, so as a result, the
  context module defined in the imports is what is passed.

  Instead, the parameter should be changed to
  `context.get_admin_context()`.

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


References