-
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] add scsi tapes cmd function #2463
[scsi] add scsi tapes cmd function #2463
Conversation
This commit adds the function get_tape_devs() and add_blockdev_cmd() so plugins can iterate over them. It's based on get_block_devs(). Signed-off-by: Jose Castillo <[email protected]>
This commit enables the capture of SCSI tape information via two commands: udevadm info -a <tape device> udevadm info <tape device> Signed-off-by: Jose Castillo <[email protected]>
967c9ba
to
6027bac
Compare
sos/report/plugins/__init__.py
Outdated
def add_tape_cmd(self, cmds, devices='tape', timeout=300, | ||
sizelimit=None, chroot=True, runat=None, env=None, | ||
binary=False, prepend_path=None, whitelist=[], | ||
blacklist=[], tags=[]): |
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.
Can't be add_blockdev_cmd
enhanced accordingly? As we basically duplicate its code here.
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.
That was my thought too, we can add tape
as a known keyword for devices
. Otherwise, this looks good and get_tape_devs()
is a nice addition.
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.
Ack to the direction but there seem to be a few stray hunks here?
sos/report/plugins/__init__.py
Outdated
blacklist=[], tags=[]): | ||
sizelimit=None, chroot=True, runat=None, env=None, | ||
binary=False, prepend_path=None, whitelist=[], | ||
blacklist=[], tags=[]): |
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.
This hunk of this patch seems to be fixing up some whitespace errors in the previous patch? It's better to just re-do the patches to avoid this kind of cross-patch dependency (git rebase -i
).
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.
Sorry, I jumped between the RHEL 7 server where I have the tapes, to test and code this, and the usual server where I send the PRs, and I noticed too late the mix
sos/report/__init__.py
Outdated
@@ -398,7 +398,6 @@ def get_tape_devs(self): | |||
self.soslog.error("Could not get tape device list: %s" % err) | |||
return [] | |||
|
|||
|
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's usually better to put clean ups (like non functional whitespace changes) into their own patches rather than tucking them away in another functional commit.
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.
Seems reasonable - one nit is that tape devices are typically character devices that support sequential access modes, rather than block devices that support random access. From the sos code side it's a minor detail, but it could be confusing for other readers of the code down the line if we don't clear this up.
sos/report/plugins/__init__.py
Outdated
_dev_tags = [] | ||
prepend_path = prepend_path or '/dev/' | ||
devices = self.devices['tape'] | ||
_dev_tags.append('block') |
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.
Tape devices are normally character devices not block devices.
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.
I missed this one when copying from the other block, sorry!
Yeah - it'd be a bit of a misnomer ( But agreed, the tag should be changed from |
Sure, but that isn't our only option - imho, if we are broadening the scope of |
OK, let me see if I can summarise my understanding. _get_hardware_devices() that calls one of these: get_fibre_devs() get_tape_devs() could become get_char_devs() to cover more chardevs in the future, and 'tape' be a part of it. Then: add_blockdev_cmd() that covers block devices, and deals with 'block' and 'fibre' And all these are wrappers into _add_device_cmd(), but I'm repeating code in add_tape_cmd()/add_chardev_cmd(). So, what Bryn proposes could look like this, right?
We only need to change 6 calls to add_blockdev_cmd(), and I think we cover them being by default block with the argument "devices='block'", right? sos/report/plugins/block.py: self.add_blockdev_cmd(cmds, blacklist='ram.') And I add add_tapedev_cmd() code into add_device_cmd(), like this:
So there's no code duplication, the function covers more kind of devices, and we open the door to being able to add just three lines in this function to support network devices (and obviously more code in other functions as well). |
@jcastill generally yes I believe we're on the same page. To summarize:
Personally I don't mind |
@TurboTurtle ok, shall I use this PR for all these changes, or do you prefer if I group them in another way? About get_tape_devs() vs get_char_devs(), perhaps for now tape is better, and more descriptive. If in the future we need to add other char devices, we can check if renaming is better than actually having another function. |
This PR is fine, just logically separate the changes in different commits. E.G. one for the |
This plugin reworks add_blockdev_cmd() to cover tape devices, in order to avoid duplicate code. It's been renamed as add_device_cmd() to reflect this change. It also updates the code of all plugins that used to call add_blockdev_cmd() to the new function name. Resolves: sosreport#2463 Signed-off-by: Jose Castillo <[email protected]>
Add get_tape_devs() function and other logic to iterate and gather information about tape devices. Related: sosreport#2463 Signed-off-by: Jose Castillo <[email protected]>
Capture udevadm info for tape devices. Related: sosreport#2463 Signed-off-by: Jose Castillo <[email protected]>
Add get_tape_devs() function and other logic to iterate and gather information about tape devices. Related: sosreport#2463 Signed-off-by: Jose Castillo <[email protected]>
Capture udevadm info for tape devices. Related: sosreport#2463 Signed-off-by: Jose Castillo <[email protected]>
This is now obsolete, with the changes to add_device_cmd() and other new improved functions. I'll send a new PR with the logic for tape devices soon. |
Capture udevadm info for tape devices. Related: sosreport#2463 Signed-off-by: Jose Castillo <[email protected]>
This commit enables the capture of SCSI tape
information via two commands:
udevadm info -a
udevadm info
It relies on two commits. The first one adds the required
commands in the scsi plugin, the second one adds the
function get_tape_devs() and add_blockdev_cmd() so
plugins can iterate over them. It's based on get_block_devs().
Resolves: #2463
Signed-off-by: Jose Castillo [email protected]
Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines
Closes: #ISSUENUMBER
included in an independent line?Resolves: #PRNUMBER
included in an independent line?