LsPci - Command lspci -k

To parse the PCI device information gathered from the /sbin/lspci -k command.

class insights.parsers.lspci.LsPci(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.LogFileOutput

Class to parse the PCI device information gathered from the /sbin/lspci -k command.

Typical output of the lspci -k command is:

00:00.0 Host bridge: Intel Corporation 5500 I/O Hub to ESI Port (rev 13)
        Subsystem: Cisco Systems Inc Device 0101
00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 13)
        Kernel driver in use: pcieport
        Kernel modules: shpchp
00:02.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 2 (rev 13)
        Kernel driver in use: pcieport
        Kernel modules: shpchp
03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)
        Subsystem: Cisco Systems Inc Device 004a
        Kernel driver in use: ixgbe
        Kernel modules: ixgbe
06:00.0 Ethernet controller: Intel Corporation 82598EB 10-Gigabit AF Dual Port Network Connection (rev 01)
        Subsystem: Cisco Systems Inc Device 004a
        Kernel driver in use: ixgbe
        Kernel modules: ixgbe

Examples

>>> type(lspci)
<class 'insights.parsers.lspci.LsPci'>
>>> lspci.get("Intel Corporation")[0]['raw_message']
'00:00.0 Host bridge: Intel Corporation 5500 I/O Hub to ESI Port (rev 13)'
>>> len(lspci.get("Network controller"))
1
>>> "Centrino Advanced-N 6205" in lspci
True
>>> "0d:00.0" in lspci
False
>>> sorted(lspci.pci_dev_list)
['00:00.0', '00:01.0', '00:02.0', '03:00.0', '06:00.0']
>>> lspci.pci_dev_details('00:00.0')['Subsystem']
'Cisco Systems Inc Device 0101'
>>> lspci.pci_dev_details('00:00.0')['Dev_Details']
'Host bridge: Intel Corporation 5500 I/O Hub to ESI Port (rev 13)'
data

Dict where the keys are the device number and values are details of the device.

Type

dict

lines

List of details of each listed device, the same to the values of self.data

Type

list

parse_content(content)[source]

This method must be implemented by classes based on this class.

pci_dev_details(dev_name)[source]

It will return the PCI device and it’s details.

Parameters

Bus Device function number eg (PCI) -- ‘00:01:0’

Returns

Returns device details along with ‘Subsystem’, ‘Kernel Driver in Use’, ‘Kernel Modules’. Returns None if device doesn’t exists

Return type

(dict)

property pci_dev_list

The list of PCI devices.