Skip to content

Commit

Permalink
[scsi-block-nvme] move per device data to
Browse files Browse the repository at this point in the history
subdirectories for storage commands

Signed-off-by: Nitin U. Yewale <[email protected]>
  • Loading branch information
NitinYewale committed Apr 22, 2023
1 parent 8e79f69 commit 2b03071
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
17 changes: 13 additions & 4 deletions sos/report/plugins/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Block(Plugin, IndependentPlugin):
files = ('/sys/block',)

def setup(self):
_subdir1 = "udevadm_block"
_subdir2 = "fdisk_parted"
self.add_forbidden_path("/sys/block/*/queue/iosched")

self.add_file_tags({
Expand Down Expand Up @@ -50,14 +52,21 @@ def setup(self):
"/sys/block/loop*/loop/",
])

cmds = [
"parted -s %(dev)s unit s print",
udevadm_cmds = [
"udevadm info %(dev)s",
"udevadm info -a %(dev)s"
]
self.add_device_cmd(cmds, devices='block', blacklist='ram.*')

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_cmds, devices='block', blacklist='ram.*',
subdir=_subdir2)
self.add_device_cmd("fdisk -l %(dev)s", blacklist="ram.*",
devices="block", tags="fdisk_l_sos")
devices="block", tags="fdisk_l_sos", subdir=_subdir2)

lsblk = self.collect_cmd_output("lsblk -f -a -l")
# for LUKS devices, collect cryptsetup luksDump
Expand Down
4 changes: 3 additions & 1 deletion sos/report/plugins/nvme.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Nvme(Plugin, IndependentPlugin):
kernel_mods = ('nvme', 'nvme_core')

def setup(self):
_subdir = "smart_ns_ctrl_fw_error_regs"
self.add_copy_spec("/etc/nvme/*")
self.add_cmd_output([
"nvme list",
Expand All @@ -44,6 +45,7 @@ def setup(self):
"nvme error-log %(dev)s",
"nvme show-regs %(dev)s"
]
self.add_device_cmd(cmds, devices='block', whitelist='nvme.*')
self.add_device_cmd(cmds, devices='block', whitelist='nvme.*',
subdir=_subdir)

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

def setup(self):
_subdir1 = "udevadm_scsi"
_subdir2 = "sg_persists_inq"
self.add_copy_spec([
"/proc/scsi",
"/etc/stinit.def",
Expand Down Expand Up @@ -62,13 +64,14 @@ def setup(self):
])

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

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

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

0 comments on commit 2b03071

Please sign in to comment.