From 2b03071d277f53fce79f944adc2e405fb9cf2b83 Mon Sep 17 00:00:00 2001 From: "Nitin U. Yewale" Date: Sat, 22 Apr 2023 17:11:02 +0530 Subject: [PATCH] [scsi-block-nvme] move per device data to subdirectories for storage commands Signed-off-by: Nitin U. Yewale --- sos/report/plugins/block.py | 17 +++++++++++++---- sos/report/plugins/nvme.py | 4 +++- sos/report/plugins/scsi.py | 7 +++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/sos/report/plugins/block.py b/sos/report/plugins/block.py index 621c6010e6..91f47133de 100644 --- a/sos/report/plugins/block.py +++ b/sos/report/plugins/block.py @@ -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({ @@ -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 diff --git a/sos/report/plugins/nvme.py b/sos/report/plugins/nvme.py index 271cf31440..04e0c05bbf 100644 --- a/sos/report/plugins/nvme.py +++ b/sos/report/plugins/nvme.py @@ -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", @@ -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 : diff --git a/sos/report/plugins/scsi.py b/sos/report/plugins/scsi.py index 1589c20ac7..2f92a3f5e8 100644 --- a/sos/report/plugins/scsi.py +++ b/sos/report/plugins/scsi.py @@ -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", @@ -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 :