Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scsi-block-nvme] move per device data to #3201

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions sos/report/plugins/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class Block(Plugin, IndependentPlugin):
files = ('/sys/block',)

def setup(self):
_subdir1 = "udevadm_block"
_subdir2 = "fdisk_parted"
Comment on lines +22 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to name the variables by their usage, e.g. fdisk_dir or similar.


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

self.add_file_tags({
Expand Down Expand Up @@ -50,14 +53,24 @@ 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"
]
Comment on lines +61 to +63
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the list contains just one item, we can directly use the command "parted -s .." in the add_device_cmd, like we do for fdisk -l .. few lines below, no?


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
38 changes: 32 additions & 6 deletions sos/report/plugins/nvme.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,50 @@ class Nvme(Plugin, IndependentPlugin):
kernel_mods = ('nvme', 'nvme_core')

def setup(self):
_subdir1 = "nvme_smartctl"
_subdir2 = "nvme_fw_smart_error_logs"

self.add_copy_spec("/etc/nvme/*")
self.add_cmd_output([
"nvme list",
"nvme list-subsys",
])

cmds = [
smartctl_cmds = [
"smartctl --all %(dev)s",
"smartctl --all %(dev)s -j",
"nvme list-ns %(dev)s",
"smartctl --all %(dev)s -j"
]

nvme_logs_cmds = [
"nvme fw-log %(dev)s",
"nvme smart-log %(dev)s",
"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 smart-log %(dev)s",
"nvme error-log %(dev)s",
"nvme show-regs %(dev)s"
]
self.add_device_cmd(cmds, devices='block', whitelist='nvme.*')

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)

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 :
17 changes: 12 additions & 5 deletions sos/report/plugins/scsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class Scsi(Plugin, IndependentPlugin):
profiles = ('storage', 'hardware')

def setup(self):
_subdir1 = "udevadm_scsi"
_subdir2 = "sg_persists_inq"
Comment on lines +32 to +33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise above, variable names and value names should be more intuitive.


self.add_copy_spec([
"/proc/scsi",
"/etc/stinit.def",
Expand Down Expand Up @@ -61,14 +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)

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",
"sg_inq %(dev)s"
], devices='block', whitelist=['sd.*'])
]

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 :