Parsers to parse the output of modinfo <module_name>

ModInfoEach - Command modinfo *

for any module listed by lsmod

ModInfoAll - Command modinfo *(all modules)

for all modules listed by lsmod

KernelModulesInfo - Command modinfo filtered_modules

class insights.parsers.modinfo.KernelModulesInfo(context, extra_bad_lines=None)[source]

Bases: CommandParser, dict

Class to parse the information about filtered kernel modules collected by “modinfo filtered_modules”. The result will be stored in a dictionary. The key is the module name, the value is a instance of ModInfo with more details.

Sample output:

filename:       /lib/modules/3.10.0-957.10.1.el7.x86_64/kernel/drivers/net/vmxnet3/vmxnet3.ko.xz
version:        1.4.14.0-k
license:        GPL v2
description:    VMware vmxnet3 virtual NIC driver
author:         VMware, Inc.
retpoline:      Y
rhelversion:    7.6
srcversion:     7E672688ACACBDD2E363B63
alias:          pci:v000015ADd000007B0sv*sd*bc*sc*i*
depends:
intree:         Y
vermagic:       3.10.0-957.10.1.el7.x86_64 SMP mod_unload modversions
signer:         Red Hat Enterprise Linux kernel signing key
sig_key:        A5:70:18:DF:B6:C9:D6:1F:CF:CE:0A:3D:02:8B:B3:69:BD:76:CA:ED
sig_hashalgo:   sha256
filename:       /lib/modules/3.10.0-993.el7.x86_64/kernel/drivers/net/ethernet/intel/i40e/i40e.ko.xz
firmware:       i40e/i40e-e2-7.13.1.0.fw
firmware:       i40e/i40e-e1h-7.13.1.0.fw
version:        2.3.2-k
license:        GPL
description:    Intel(R) Ethernet Connection XL710 Network Driver
author:         Intel Corporation, <e1000-devel@lists.sourceforge.net>
retpoline:      Y
rhelversion:    7.7
srcversion:     DC5C250666ADD8603966656
alias:          pci:v00008086d0000158Bsv*sd*bc*sc*i*
alias:          pci:v00008086d0000158Asv*sd*bc*sc*i*
depends:        ptp
intree:         Y
vermagic:       3.10.0-993.el7.x86_64 SMP mod_unload modversions
signer:         Red Hat Enterprise Linux kernel signing key
sig_key:        81:7C:CB:07:72:4E:7F:B8:15:24:10:F9:27:2D:AA:CF:80:3E:CE:59
sig_hashalgo:   sha256
parm:           debug:Debug level (0=none,...,16=all), Debug mask (0x8XXXXXXX) (uint)
parm:           int_mode: Force interrupt mode other than MSI-X (1 INT#x; 2 MSI) (int)
Raises:

SkipComponent -- When nothing need to parse.

Examples

>>> from insights.core.filters import add_filter
>>> from insights.specs import Specs
>>> add_filter(Specs.modinfo_modules, 'i40e')
>>> add_filter(Specs.modinfo_modules, 'vmxnet3')
>>> type(mods_info)
<class 'insights.parsers.modinfo.KernelModulesInfo'>
>>> 'i40e' in mods_info
True
>>> mods_info['i40e'].module_version
'2.3.2-k'
>>> mods_info['i40e'].module_path
'/lib/modules/3.10.0-993.el7.x86_64/kernel/drivers/net/ethernet/intel/i40e/i40e.ko.xz'
>>> sorted(mods_info['i40e'].module_firmware)
['i40e/i40e-e1h-7.13.1.0.fw', 'i40e/i40e-e2-7.13.1.0.fw']
>>> sorted(mods_info['i40e'].module_alias)
['pci:v00008086d0000158Asv*sd*bc*sc*i*', 'pci:v00008086d0000158Bsv*sd*bc*sc*i*']
>>> sorted(mods_info['i40e'].module_parm)
['debug:Debug level (0=none,...,16=all), Debug mask (0x8XXXXXXX) (uint)', 'int_mode: Force interrupt mode other than MSI-X (1 INT#x; 2 MSI) (int)']
>>> 'vmxnet3' in mods_info
True
retpoline_y

A set of names of the modules with the attribute “retpoline: Y”.

Type:

set

retpoline_n

A set of names of the modules with the attribute “retpoline: N”.

Type:

set

parse_content(content)[source]

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

class insights.parsers.modinfo.ModInfo[source]

Bases: dict

Base class for the information about a kernel module, the module info will be stored in dictionary format. Besides of that, the following utility properties are provided as well.

classmethod from_content(content)[source]

A classmethod to generated a ModInfo object from the given content list. Two more keys module_name and module_deps will be created as well per the content.

Raises:

SkipComponent -- When nothing need to check to a dict.

property module_alias

This will return the list of alias to this kernel module when set, else [].

Type:

(list)

property module_deps

This will return the list of kernel modules depend on the kernel module when set, else [].

Type:

(list)

property module_details

This will return the kernel module details when set.

Type:

(dict)

property module_firmware

This will return the list of firmwares used by this module when set, else [].

Type:

(list)

property module_name

This will return kernel module name when set, else empty str.

Type:

(str)

property module_parm

This will return the list of parms for this kernel module when set, else [].

Type:

(list)

property module_path

This will return kernel module path when set, else None.

Type:

(str)

property module_signer

This will return the signer of kernel module when set, else empty string.

Type:

(str)

property module_version

This will return the kernel module version when set, else empty string.

Type:

(str)

class insights.parsers.modinfo.ModInfoAll(*args, **kwargs)[source]

Bases: KernelModulesInfo

Warning

This parser is deprecated, please use insights.combiners.modinfo.ModulesInfo instead.

Class to parse the information about all kernel modules, the module info will be stored in dictionary format.

Sample output::

filename: /lib/modules/3.10.0-957.10.1.el7.x86_64/kernel/drivers/net/vmxnet3/vmxnet3.ko.xz version: 1.4.14.0-k license: GPL v2 description: VMware vmxnet3 virtual NIC driver author: VMware, Inc. retpoline: Y rhelversion: 7.6 srcversion: 7E672688ACACBDD2E363B63 alias: pci:v000015ADd000007B0sv*sd*bc*sc*i* depends: intree: Y vermagic: 3.10.0-957.10.1.el7.x86_64 SMP mod_unload modversions signer: Red Hat Enterprise Linux kernel signing key sig_key: A5:70:18:DF:B6:C9:D6:1F:CF:CE:0A:3D:02:8B:B3:69:BD:76:CA:ED sig_hashalgo: sha256 filename: /lib/modules/3.10.0-993.el7.x86_64/kernel/drivers/net/ethernet/intel/i40e/i40e.ko.xz firmware: i40e/i40e-e2-7.13.1.0.fw firmware: i40e/i40e-e1h-7.13.1.0.fw version: 2.3.2-k license: GPL description: Intel(R) Ethernet Connection XL710 Network Driver author: Intel Corporation, <e1000-devel@lists.sourceforge.net> retpoline: Y rhelversion: 7.7 srcversion: DC5C250666ADD8603966656 alias: pci:v00008086d0000158Bsv*sd*bc*sc*i* alias: pci:v00008086d0000158Asv*sd*bc*sc*i* depends: ptp intree: Y vermagic: 3.10.0-993.el7.x86_64 SMP mod_unload modversions signer: Red Hat Enterprise Linux kernel signing key sig_key: 81:7C:CB:07:72:4E:7F:B8:15:24:10:F9:27:2D:AA:CF:80:3E:CE:59 sig_hashalgo: sha256 parm: debug:Debug level (0=none,…,16=all), Debug mask (0x8XXXXXXX) (uint) parm: int_mode: Force interrupt mode other than MSI-X (1 INT#x; 2 MSI) (int)

Raises:

SkipComponent -- When nothing need to parse.

Examples

>>> type(modinfo_all)
<class 'insights.parsers.modinfo.ModInfoAll'>
>>> 'i40e' in modinfo_all
True
>>> modinfo_all['i40e'].module_version
'2.3.2-k'
>>> modinfo_all['i40e'].module_path
'/lib/modules/3.10.0-993.el7.x86_64/kernel/drivers/net/ethernet/intel/i40e/i40e.ko.xz'
>>> sorted(modinfo_all['i40e'].module_firmware)
['i40e/i40e-e1h-7.13.1.0.fw', 'i40e/i40e-e2-7.13.1.0.fw']
>>> sorted(modinfo_all['i40e'].module_alias)
['pci:v00008086d0000158Asv*sd*bc*sc*i*', 'pci:v00008086d0000158Bsv*sd*bc*sc*i*']
>>> sorted(modinfo_all['i40e'].module_parm)
['debug:Debug level (0=none,...,16=all), Debug mask (0x8XXXXXXX) (uint)', 'int_mode: Force interrupt mode other than MSI-X (1 INT#x; 2 MSI) (int)']
>>> 'vmxnet3' in modinfo_all
True
retpoline_y

A set of names of the modules with the attribute “retpoline: Y”.

Type:

set

retpoline_n

A set of names of the modules with the attribute “retpoline: N”.

Type:

set

class insights.parsers.modinfo.ModInfoEach(*args, **kwargs)[source]

Bases: CommandParser, ModInfo

Warning

This parser is deprecated, please use insights.combiners.modinfo.ModulesInfo instead.

Parses the output of modinfo %s command, where %s is any of the loaded modules.

Sample output::

filename: /lib/modules/3.10.0-993.el7.x86_64/kernel/drivers/net/ethernet/intel/i40e/i40e.ko.xz firmware: i40e/i40e-e2-7.13.1.0.fw firmware: i40e/i40e-e1h-7.13.1.0.fw version: 2.3.2-k license: GPL description: Intel(R) Ethernet Connection XL710 Network Driver author: Intel Corporation, <e1000-devel@lists.sourceforge.net> retpoline: Y rhelversion: 7.7 srcversion: DC5C250666ADD8603966656 alias: pci:v00008086d0000158Bsv*sd*bc*sc*i* alias: pci:v00008086d0000158Asv*sd*bc*sc*i* depends: ptp intree: Y vermagic: 3.10.0-993.el7.x86_64 SMP mod_unload modversions signer: Red Hat Enterprise Linux kernel signing key sig_key: 81:7C:CB:07:72:4E:7F:B8:15:24:10:F9:27:2D:AA:CF:80:3E:CE:59 sig_hashalgo: sha256 parm: debug:Debug level (0=none,…,16=all), Debug mask (0x8XXXXXXX) (uint) parm: int_mode: Force interrupt mode other than MSI-X (1 INT#x; 2 MSI) (int)

Raises:

SkipComponent -- When nothing is need to parse

Examples

>>> type(modinfo_obj)
<class 'insights.parsers.modinfo.ModInfoEach'>
>>> modinfo_obj.module_name
'i40e'
>>> modinfo_obj.module_version
'2.3.2-k'
>>> modinfo_obj.module_path
'/lib/modules/3.10.0-993.el7.x86_64/kernel/drivers/net/ethernet/intel/i40e/i40e.ko.xz'
>>> sorted(modinfo_obj.module_firmware)
['i40e/i40e-e1h-7.13.1.0.fw', 'i40e/i40e-e2-7.13.1.0.fw']
>>> sorted(modinfo_obj.module_alias)
['pci:v00008086d0000158Asv*sd*bc*sc*i*', 'pci:v00008086d0000158Bsv*sd*bc*sc*i*']
>>> sorted(modinfo_obj.module_parm)
['debug:Debug level (0=none,...,16=all), Debug mask (0x8XXXXXXX) (uint)', 'int_mode: Force interrupt mode other than MSI-X (1 INT#x; 2 MSI) (int)']
property data

This will return the kernel module details when set.

Type:

(dict)

parse_content(content)[source]

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