LsSCSI - command /usr/bin/lsscsi
¶
This module provides processing for the output of the /usr/bin/lsscsi
command.
-
class
insights.parsers.lsscsi.
LsSCSI
(context, extra_bad_lines=None)[source]¶ Bases:
insights.core.CommandParser
This parser reads the output of
/usr/bin/lsscsi
into a list of dictionarys. Each item is a dictionary with six keys:HCTL
- the scsi_host,channel,target_number,LUN tuplePeripheral-Type
- the SCSI peripheral typeVendor
- the vendor nameModel
- the model nameRevision
- the revision stringPrimary-Device-Node
- the primary device node name
-
data
¶ List of the input lines, where each line is a dictionary having the keys identified above.
Type: list of dict
Parsing refers to http://sg.danny.cz/scsi/lsscsi.html.
Sample input:
[1:0:0:0] storage IET Controller 0001 - [1:0:0:1] cd/dvd QEMU QEMU DVD-ROM 2.5+ /dev/sr0 [1:0:0:2] disk IET VIRTUAL-DISK 0001 /dev/sdb [3:0:5:0] tape HP C5713A H910 /dev/st0
Examples
>>> lsscsi[0] == {'Model': 'Controller', 'Vendor': 'IET', 'HCTL': '[1:0:0:0]', 'Peripheral-Type': 'storage', 'Primary-Device-Node': '-', 'Revision': '0001'} True >>> lsscsi.device_nodes ['-', '/dev/sr0', '/dev/sdb', '/dev/st0'] >>> len(lsscsi.data) 4 >>> lsscsi[1]['Peripheral-Type'] 'cd/dvd'
-
device_nodes
¶ All lines’ Primary-Device-Node values.
Type: list
-
device_vendors
¶ All lines’ Vendor values
Type: list