[openstack-dev] [zun][unit test] Any python utils can collect pci info?

Eric Fried openstack at fried.cc
Mon Sep 18 14:50:30 UTC 2017


You may get a little help from the methods in nova.pci.utils.

If you're calling out to lspci or accessing sysfs, be aware of this
series [1] and do it via the new privsep mechanisms.

[1]
https://review.openstack.org/#/q/status:open+project:openstack/nova+branch:master+topic:hurrah-for-privsep

On 09/17/2017 09:41 PM, Hongbin Lu wrote:
> Hi Shunli,
> 
>  
> 
> I am not aware of any prevailing python utils for this. An alternative
> is to shell out Linux commands to collect the information. After a quick
> search, it looks xenapi [1] uses “lspci -vmmnk” to collect PCI device
> detail info and “ls /sys/bus/pci/devices/<pci_device>/” to detect the
> PCI device type (PF or VF). FWIW, you might find it helpful to refer the
> implementation of Nova’s xenapi driver for gettiing PCI resources [2].
> Hope it helps.
> 
>  
> 
> [1]
> https://github.com/openstack/os-xenapi/blob/master/os_xenapi/dom0/etc/xapi.d/plugins/xenhost.py#L593
> 
> [2]
> https://github.com/openstack/nova/blob/master/nova/virt/xenapi/host.py#L154
> 
>  
> 
> Best regards,
> 
> Hongbin
> 
>  
> 
> *From:*Shunli Zhou [mailto:shunli6658 at gmail.com]
> *Sent:* September-17-17 9:35 PM
> *To:* openstack-dev at lists.openstack.org
> *Subject:* [openstack-dev] [zun][unit test] Any python utils can collect
> pci info?
> 
>  
> 
> Hi all,
> 
>  
> 
> For https://blueprints.launchpad.net/zun/+spec/support-pcipassthroughfilter
> this BP, Nova use the libvirt to collect the PCI device info. But for
> zun, libvirt seems is a heavy dependecies. Is there a python utils that
> can be used to collect the PCI device detail info? Such as the whether
> it's a PF of network pci device of VF, the device capabilities, etc.
> 
>  
> 
> Note: For 'lspci -D -nnmm' , there are some info can not get.
> 
>  
> 
>  
> 
> Thanks
> 
> 
> 
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 



More information about the OpenStack-dev mailing list