diff options
author | Lukas Herbolt <lukas@herbolt.com> | 2024-02-27 11:20:51 +0100 |
---|---|---|
committer | Jake Hunsaker <jacob.r.hunsaker@gmail.com> | 2024-03-05 21:34:41 -0500 |
commit | 8cec60768490d00ba9d06a15d4588258c7aec269 (patch) | |
tree | 0c616d01e0dffeb178397d472be12d652cf8b373 | |
parent | 4401c4ee3224201291db6361bb2d870bd2718096 (diff) | |
download | sos-8cec60768490d00ba9d06a15d4588258c7aec269.tar.gz |
[report] Add new section fstype section under hardware devices
Add new section fstype section under hardware devices which lists
devices by filesystem, based on lsbl -nrpo output. Devices with no
filesystem are placed into unknown section and Ext2/3/4 are put into
section called ext4.
Signed-off-by: Lukas Herbolt <lukas@herbolt.com>
-rw-r--r-- | sos/report/__init__.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sos/report/__init__.py b/sos/report/__init__.py index 9bfce187..14288629 100644 --- a/sos/report/__init__.py +++ b/sos/report/__init__.py @@ -445,7 +445,8 @@ class SoSReport(SoSComponent): 'fibre': self._get_fibre_devs() }, 'network': self._get_network_devs(), - 'namespaced_network': self._get_network_namespace_devices() + 'namespaced_network': self._get_network_namespace_devices(), + 'fstype': self._get_devices_by_fstype() } def _check_container_runtime(self): @@ -680,6 +681,21 @@ class SoSReport(SoSComponent): out_ns.append(line.partition(' ')[0]) return out_ns + def _get_devices_by_fstype(self): + _dev_fstypes = {} + _devs = sos_get_command_output("lsblk -nrpo FSTYPE,NAME") + if _devs['status'] != 0: + return _dev_fstypes + for line in (_devs['output'].splitlines()): + helper = line.strip().split() + if len(helper) == 1: + helper.insert(0, 'unknown') + if "ext" in helper[0]: + helper[0] = 'ext4' + _dev_fstypes.setdefault(helper[0], []) + _dev_fstypes[helper[0]].append(helper[1]) + return _dev_fstypes + def get_commons(self): return { 'cmddir': self.cmddir, |