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

[plugins][scsi] Enhance data gathering of tape devices #3473

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
22 changes: 21 additions & 1 deletion sos/report/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ def _get_hardware_devices(self):
self.devices = {
'storage': {
'block': self._get_block_devs(),
'fibre': self._get_fibre_devs()
'fibre': self._get_fibre_devs(),
'tape': self._get_tape_devs(),
},
'network': self._get_network_devs(),
'namespaced_network': self._get_network_namespace_devices()
Expand Down Expand Up @@ -506,6 +507,25 @@ def _get_block_devs(self):
self.soslog.error("Could not get block device list: %s" % err)
return []

def _get_tape_devs(self):
"""Enumerate a list of tape devices on this system so that plugins
can iterate over them

These devices are used by add_device_cmd() in the Plugin class.
"""
try:
devs = []
devdirs = [
'scsi_tape',
'lin_tape'
]
for devdir in devdirs:
devs.extend(glob.glob(f"/sys/class/{devdir}/*"))
return devs
except Exception as err:
self.soslog.error(f"Could not get tape device list: {err}")
return []

def _get_namespaces(self):
self.namespaces = {
'network': self._get_network_namespaces()
Expand Down
1 change: 1 addition & 0 deletions sos/report/plugins/scsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ 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="tape")

self.add_device_cmd([
"sg_persist --in -k -d %(dev)s",
Expand Down