From 0ec5e73b15859ef2621d9178babcfad3d09e094a Mon Sep 17 00:00:00 2001 From: Jon Magrini Date: Wed, 22 Jan 2025 11:54:34 -0500 Subject: [PATCH 1/3] [openshift] Capture ls long listing for /mnt This plugin is used to collect Openshift LSO details. This expands the ceph_osd plugin since storage nodes by default are not setup for ceph access. When gathering data from an OpenShift node when LSO is in use, we currently do not collect the symlink data location for LSO, which is always under /mnt. Many times this directory has pointers/symlinks to paths instead of devices. Signed-off-by: Jon Magrini --- sos/report/plugins/openshift_lso.py | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 sos/report/plugins/openshift_lso.py diff --git a/sos/report/plugins/openshift_lso.py b/sos/report/plugins/openshift_lso.py new file mode 100644 index 0000000000..bf038d2bf7 --- /dev/null +++ b/sos/report/plugins/openshift_lso.py @@ -0,0 +1,41 @@ +# openshift_lso.py +# Copyright (C) 2007-2025 Red Hat, Inc., Jon Magrini + +# This file is part of the sos project: https://github.com/sosreport/sos +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# version 2 of the GNU General Public License. +# +# See the LICENSE file in the source distribution for further information. + +import os +from sos.report.plugins import (Plugin, RedHatPlugin) + +class OpenshiftLSO(Plugin, RedHatPlugin): + """ + This plugin is used to collect Openshift LSO details. This expands + the ceph_osd plugin since storage nodes by default are not setup for + ceph access. When gathering data from an OpenShift node when LSO is in use, + we currently do not collect the symlink data location for LSO, + which is always under /mnt (basically two layers lower, + but the names can change). This is useful in determining if LSO + is setup correctly when also having a must-gather output. + Many times the LSO directory has pointers to paths instead of devices. + This can cause issues with lost access to the OCP backend storage + used by OpenShift. + """ + + short_desc = 'Openshift LSO' + + plugin_name = "openshift_lso" + profiles = ('storage', 'openshift', 'ceph') + # Each node runs the ceph-osd daemon, + # which interacts with logical disks attached to the node. + files = ('/run/ceph/**/ceph-osd*') + + def setup(self): + self.add_cmd_output([ + 'ls -lanR /mnt' + ]) + From 55c423dda934f621aa497d1b867423a174d42def Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 22 Jan 2025 12:18:05 -0500 Subject: [PATCH 2/3] Update openshift_lso.py Removed unused import Removed whitespace per guidelines --- sos/report/plugins/openshift_lso.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sos/report/plugins/openshift_lso.py b/sos/report/plugins/openshift_lso.py index bf038d2bf7..62a517e464 100644 --- a/sos/report/plugins/openshift_lso.py +++ b/sos/report/plugins/openshift_lso.py @@ -9,7 +9,6 @@ # # See the LICENSE file in the source distribution for further information. -import os from sos.report.plugins import (Plugin, RedHatPlugin) class OpenshiftLSO(Plugin, RedHatPlugin): @@ -29,13 +28,12 @@ class OpenshiftLSO(Plugin, RedHatPlugin): short_desc = 'Openshift LSO' plugin_name = "openshift_lso" - profiles = ('storage', 'openshift', 'ceph') - # Each node runs the ceph-osd daemon, + profiles = ('storage', 'openshift', 'ceph') + # Each node runs the ceph-osd daemon, # which interacts with logical disks attached to the node. - files = ('/run/ceph/**/ceph-osd*') + files = '/run/ceph/**/ceph-osd*' - def setup(self): + def setup(self): self.add_cmd_output([ 'ls -lanR /mnt' ]) - From e1af567669d27d5bf4c9109d06db6501052f5b58 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 23 Jan 2025 13:12:30 -0500 Subject: [PATCH 3/3] Update openshift_lso.py cont. Further remove whitespace Replace add_cmd_output with add_dir_listing Pylint rated at 10/10 Signed-off-by: Jon Magrini --- sos/report/plugins/openshift_lso.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/sos/report/plugins/openshift_lso.py b/sos/report/plugins/openshift_lso.py index 62a517e464..abe4f3d46f 100644 --- a/sos/report/plugins/openshift_lso.py +++ b/sos/report/plugins/openshift_lso.py @@ -1,4 +1,3 @@ -# openshift_lso.py # Copyright (C) 2007-2025 Red Hat, Inc., Jon Magrini # This file is part of the sos project: https://github.com/sosreport/sos @@ -13,18 +12,18 @@ class OpenshiftLSO(Plugin, RedHatPlugin): """ - This plugin is used to collect Openshift LSO details. This expands + This plugin is used to collect Openshift LSO details. This expands the ceph_osd plugin since storage nodes by default are not setup for - ceph access. When gathering data from an OpenShift node when LSO is in use, - we currently do not collect the symlink data location for LSO, - which is always under /mnt (basically two layers lower, - but the names can change). This is useful in determining if LSO - is setup correctly when also having a must-gather output. - Many times the LSO directory has pointers to paths instead of devices. - This can cause issues with lost access to the OCP backend storage + ceph access. When gathering data from an OpenShift node when LSO is in use, + we currently do not collect the symlink data location for LSO, + which is always under /mnt (basically two layers lower, + but the names can change). This is useful in determining if LSO + is setup correctly when also having a must-gather output. + Many times the LSO directory has pointers to paths instead of devices. + This can cause issues with lost access to the OCP backend storage used by OpenShift. """ - + short_desc = 'Openshift LSO' plugin_name = "openshift_lso" @@ -34,6 +33,4 @@ class OpenshiftLSO(Plugin, RedHatPlugin): files = '/run/ceph/**/ceph-osd*' def setup(self): - self.add_cmd_output([ - 'ls -lanR /mnt' - ]) + self.add_dir_listing('/mnt', tags=['ls_mnt'], recursive=True)