LsPci - Commands lspci

The parsers in this module are to parse the PCI device information gathered from the /sbin/lspci commands.

LsPci - Command lspci -k

LsPciVmmkn - Command lspci -vmmkn

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.

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

Bases: insights.core.CommandParser, list

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

Typical output of the lspci -vmmkn command is:

Slot:   00:00.0
Class:  0600
Vendor: 8086
Device: 1237
SVendor:    1af4
SDevice:    1100
Rev:    02

Slot:   00:01.0
Class:  0101
Vendor: 8086
Device: 7010
SVendor:    1af4
SDevice:    1100
ProgIf: 80
Driver: ata_piix
Module: ata_piix
Module: ata_generic

Slot:   00:01.1
Class:  0c03
Vendor: 8086
Device: 7020
SVendor:    1af4
SDevice:    1100
Rev:    01
Driver: uhci_hcd

Slot:   00:03.0
Class:  0200
Vendor: 1af4
Device: 1000
SVendor:    1af4
SDevice:    0001
PhySlot:    3
Driver: virtio-pci

Examples

>>> type(lspci_vmmkn)
<class 'insights.parsers.lspci.LsPciVmmkn'>
>>> sorted(lspci_vmmkn.pci_dev_list)
['00:00.0', '00:01.0', '00:01.1', '00:03.0']
>>> lspci_vmmkn[0].get('Driver') is None
True
>>> lspci_vmmkn[-1].get('Driver')
'virtio-pci'
>>> len(lspci_vmmkn[1].get('Module'))
2

Attributes:

parse_content(content)[source]

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

property pci_dev_list

The list of PCI devices.