diff --git a/sos/report/__init__.py b/sos/report/__init__.py index 591782eedd..41d79d2776 100644 --- a/sos/report/__init__.py +++ b/sos/report/__init__.py @@ -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() @@ -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() diff --git a/sos/report/plugins/scsi.py b/sos/report/plugins/scsi.py index 1589c20ac7..bf55a394ad 100644 --- a/sos/report/plugins/scsi.py +++ b/sos/report/plugins/scsi.py @@ -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",