-
Notifications
You must be signed in to change notification settings - Fork 543
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,9 @@ 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 +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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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", | ||
|
@@ -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 : |
There was a problem hiding this comment.
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.