Skip to content

Commit

Permalink
move per device data to subdirectories for nvme, scsi and block plugins.
Browse files Browse the repository at this point in the history
Signed-off-by: Nitin U. Yewale <[email protected]>
  • Loading branch information
NitinYewale committed Oct 4, 2023
1 parent 83d4ec9 commit 61dd005
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 28 deletions.
17 changes: 11 additions & 6 deletions sos/report/plugins/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class Block(Plugin, IndependentPlugin):
files = ('/sys/block',)

def setup(self):
_subdir1 = "udevadm_info_block"
_subdir2 = "fdisk_and_parted"
_subdir1 = "udevadm_block"
_subdir2 = "fdisk_parted"

self.add_forbidden_path("/sys/block/*/queue/iosched")

Expand Down Expand Up @@ -58,14 +58,19 @@ def setup(self):
"udevadm info -a %(dev)s"
]

parted_cmds = [
"parted -s %(dev)s unit s print"
]

self.add_device_cmd(udevadm_cmds, devices='block', blacklist='ram.*',
subdir=_subdir1)
self.add_device_cmd("parted -s %(dev)s unit s print",
blacklist="ram.*", devices="block",
tags="parted_s_sos", subdir=_subdir2)

self.add_device_cmd(parted_cmds, devices='block', blacklist='ram.*',
subdir=_subdir2)

self.add_device_cmd("fdisk -l %(dev)s", blacklist="ram.*",
devices="block", tags="fdisk_l_sos",
subdir=_subdir2)
subdir=_subdir2)

lsblk = self.collect_cmd_output("lsblk -f -a -l")
# for LUKS devices, collect cryptsetup luksDump
Expand Down
31 changes: 21 additions & 10 deletions sos/report/plugins/nvme.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,30 @@ def setup(self):
"nvme error-log %(dev)s"
]

nvme_commands = [
"nvme list-ns %(dev)s",
"nvme list-ctrl %(dev)s",
"nvme id-ctrl -H %(dev)s",
"nvme id-ns -H %(dev)s",
"nvme show-regs %(dev)s"
]

subdirs = [
"nvme_list-ns",
"nvme_list-ctrl",
"nvme_id-ctrl_-H",
"nvme_id-ns_-H",
"nvme_show-regs"
]

self.add_device_cmd(smartctl_cmds, devices='block', whitelist='nvme.*',
subdir=_subdir1)

self.add_device_cmd(nvme_logs_cmds, devices='block',
whitelist='nvme.*', subdir=_subdir2)
self.add_device_cmd("nvme list-ns %(dev)s", whitelist='nvme.*',
devices='block', subdir=_subdir3)
self.add_device_cmd("nvme list-ctrl %(dev)s", whitelist='nvme.*',
devices='block', subdir=_subdir4)
self.add_device_cmd("nvme id-ctrl -H %(dev)s", whitelist='nvme.*',
devices='block', subdir=_subdir5)
self.add_device_cmd("nvme id-ns -H %(dev)s", whitelist='nvme.*',
devices='block', subdir=_subdir6)
self.add_device_cmd("nvme show-regs %(dev)s", whitelist='nvme.*',
devices='block', subdir=_subdir7)

for cmd, dir in zip(nvme_commands, subdirs):
self.add_device_cmd(cmd, whitelist='nvme.*',
devices='block', subdir=dir)

# vim: set et ts=4 sw=4 :
25 changes: 13 additions & 12 deletions sos/report/plugins/scsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ class Scsi(Plugin, IndependentPlugin):
profiles = ('storage', 'hardware')

def setup(self):
_subdir1 = "udevadm_info_scsihosts"
_subdir2 = "sg_inq_devices"
_subdir3 = "sg_persist_devices"
_subdir1 = "udevadm_scsi"
_subdir2 = "sg_persists_inq"

self.add_copy_spec([
"/proc/scsi",
Expand Down Expand Up @@ -65,16 +64,18 @@ def setup(self):
"lsscsi -L"
])

scsi_hosts = glob("/sys/class/scsi_host/*")
self.add_device_cmd("udevadm info -a %(dev)s", devices=scsi_hosts,
subdir=_subdir1)
self.add_device_cmd("sg_inq %(dev)s", devices=block,
whitelist=['sd.*'], subdir=_subdir2)

self.add_device_cmd([
scsi_persist_inq_cmds = [
"sg_persist --in -k -d %(dev)s",
"sg_persist --in -r -d %(dev)s",
"sg_persist --in -s -d %(dev)s"
], devices='block', whitelist=['sd.*'], subdir=_subdir3)
"sg_persist --in -s -d %(dev)s",
"sg_inq %(dev)s"
]

scsi_hosts = glob("/sys/class/scsi_host/*")
self.add_device_cmd("udevadm info -a %(dev)s",
devices=scsi_hosts, subdir=_subdir1)

self.add_device_cmd(scsi_persist_inq_cmds, devices='block',
whitelist=['sd.*'], subdir=_subdir2)

# vim: set et ts=4 sw=4 :

0 comments on commit 61dd005

Please sign in to comment.