← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1333498] [NEW] table nova.pci_devices lost device status every time. && PciDeviceList.get_by_compute_node pass a wrong parameter

 

Public bug reported:


I'm trying to use SR-IOV in openstack havana.

After a pci device(virtual function in my case) is allocated to a vm, the status of  according record in table 'nova.pci_devices' is updated to allocated.
However,   when I restart the openstack services,  the devices' records are updated to available again.   Actually, the pci devices are allocated to vm.

I looked into the code and found the problem below.

In the __init__ function of PciDevTracker in pci/pci_manager.py ,  it requires node_id. 
        If a node_id is passed in, it will fetch pci devices information
        from database, otherwise, it will create an empty devices list

However, the code initiating PciDevTracker (in
compute/resource_tracker.py) never passes node_id.   So  it will never
fetch pci devices information from database and the status will be
updated to 'available' every time we restart services.


=================


Then I  try do add the node id and  want to see what will happen.

Then I got this error
     self.pci_tracker = pci_manager.PciDevTracker(node_id=1)
   File "/usr/lib/python2.6/site-packages/nova/pci/pci_manager.py", line 67, in __init__
     context, node_id)
   File "/usr/lib/python2.6/site-packages/nova/objects/base.py", line 106, in wrapper
     args, kwargs)
   File "/usr/lib/python2.6/site-packages/nova/conductor/rpcapi.py", line 492, in object_class_action
     objver=objver, args=args, kwargs=kwargs)
   File "/usr/lib/python2.6/site-packages/nova/rpcclient.py", line 85, in call
     return self._invoke(self.proxy.call, ctxt, method, **kwargs)
   File "/usr/lib/python2.6/site-packages/nova/rpcclient.py", line 63, in _invoke
     return cast_or_call(ctxt, msg, **self.kwargs)
   File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/proxy.py", line 126, in call
     result = rpc.call(context, real_topic, msg, timeout)
   File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/__init__.py", line 139, in call
     return _get_impl().call(CONF, context, topic, msg, timeout)
   File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/impl_qpid.py", line 783, in call
     rpc_amqp.get_connection_pool(conf, Connection))
   File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/amqp.py", line 572, in call
     rv = multicall(conf, context, topic, msg, timeout, connection_pool)
   File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/amqp.py", line 558, in multicall
     pack_context(msg, context)
   File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/amqp.py", line 308, in pack_context
     for (key, value) in context.to_dict().iteritems()])
 AttributeError: 'module' object has no attribute 'to_dict'


It pass the module context to pci_device_obj.PciDeviceList.get_by_compute_node.  But to_dict is a function of RequestContext in module context.     It seems that it should pass a RequestContext instance instead of the module context.

** Affects: nova
     Importance: Undecided
         Status: New

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

Title:
  table nova.pci_devices  lost device status every time. &&
  PciDeviceList.get_by_compute_node pass a wrong parameter

Status in OpenStack Compute (Nova):
  New

Bug description:
  
  I'm trying to use SR-IOV in openstack havana.

  After a pci device(virtual function in my case) is allocated to a vm, the status of  according record in table 'nova.pci_devices' is updated to allocated.
  However,   when I restart the openstack services,  the devices' records are updated to available again.   Actually, the pci devices are allocated to vm.

  I looked into the code and found the problem below.

  In the __init__ function of PciDevTracker in pci/pci_manager.py ,  it requires node_id. 
          If a node_id is passed in, it will fetch pci devices information
          from database, otherwise, it will create an empty devices list

  However, the code initiating PciDevTracker (in
  compute/resource_tracker.py) never passes node_id.   So  it will never
  fetch pci devices information from database and the status will be
  updated to 'available' every time we restart services.

  
  =================

  
  Then I  try do add the node id and  want to see what will happen.

  Then I got this error
       self.pci_tracker = pci_manager.PciDevTracker(node_id=1)
     File "/usr/lib/python2.6/site-packages/nova/pci/pci_manager.py", line 67, in __init__
       context, node_id)
     File "/usr/lib/python2.6/site-packages/nova/objects/base.py", line 106, in wrapper
       args, kwargs)
     File "/usr/lib/python2.6/site-packages/nova/conductor/rpcapi.py", line 492, in object_class_action
       objver=objver, args=args, kwargs=kwargs)
     File "/usr/lib/python2.6/site-packages/nova/rpcclient.py", line 85, in call
       return self._invoke(self.proxy.call, ctxt, method, **kwargs)
     File "/usr/lib/python2.6/site-packages/nova/rpcclient.py", line 63, in _invoke
       return cast_or_call(ctxt, msg, **self.kwargs)
     File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/proxy.py", line 126, in call
       result = rpc.call(context, real_topic, msg, timeout)
     File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/__init__.py", line 139, in call
       return _get_impl().call(CONF, context, topic, msg, timeout)
     File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/impl_qpid.py", line 783, in call
       rpc_amqp.get_connection_pool(conf, Connection))
     File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/amqp.py", line 572, in call
       rv = multicall(conf, context, topic, msg, timeout, connection_pool)
     File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/amqp.py", line 558, in multicall
       pack_context(msg, context)
     File "/usr/lib/python2.6/site-packages/nova/openstack/common/rpc/amqp.py", line 308, in pack_context
       for (key, value) in context.to_dict().iteritems()])
   AttributeError: 'module' object has no attribute 'to_dict'

  
  It pass the module context to pci_device_obj.PciDeviceList.get_by_compute_node.  But to_dict is a function of RequestContext in module context.     It seems that it should pass a RequestContext instance instead of the module context.

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


Follow ups

References