diff --git a/SOURCES/sos-bz2121774-vdsm-set-use_devicesfile-0.patch b/SOURCES/sos-bz2121774-vdsm-set-use_devicesfile-0.patch new file mode 100644 index 0000000..7881ce9 --- /dev/null +++ b/SOURCES/sos-bz2121774-vdsm-set-use_devicesfile-0.patch @@ -0,0 +1,43 @@ +From 7d1ee59fc659467e6860e72322e976ddc5c17db3 Mon Sep 17 00:00:00 2001 +From: Juan Orti Alcaine +Date: Mon, 6 Jun 2022 16:35:51 +0200 +Subject: [PATCH] [vdsm] Set LVM option use_devicesfile=0 + +Since RHV 4.4 SP1, vdsm configures LVM to use devicesfile, causing that +the LVM filter configuration used by sos is ignored. + +This change disables the use of the devicesfile, so that the information +of the devices used for RHV storage domains can be collected. + +Fixes: RHBZ#2093993 + +Signed-off-by: Juan Orti +--- + sos/report/plugins/vdsm.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/sos/report/plugins/vdsm.py b/sos/report/plugins/vdsm.py +index ee5befbb..146d223c 100644 +--- a/sos/report/plugins/vdsm.py ++++ b/sos/report/plugins/vdsm.py +@@ -29,7 +29,8 @@ import re + # use_lvmetad is set to 0 in order not to show cached, old lvm metadata. + # use_lvmetad=0 + # +-# preferred_names and filter config values are set to capture Vdsm devices. ++# preferred_names, use_devicesfile and filter config values are set to ++# capture Vdsm devices. + # preferred_names=[ '^/dev/mapper/' ] + # filter=[ 'a|^/dev/mapper/.*|', 'r|.*|' ] + LVM_CONFIG = """ +@@ -43,6 +44,7 @@ devices { + ignore_suspended_devices=1 + write_cache_state=0 + disable_after_error_count=3 ++ use_devicesfile=0 + filter=["a|^/dev/disk/by-id/dm-uuid-mpath-|", "r|.+|"] + } + """ +-- +2.27.0 + diff --git a/SOURCES/sos-bz2125656-plugin-make-forbidden-path-checks-more-efficient.patch b/SOURCES/sos-bz2125656-plugin-make-forbidden-path-checks-more-efficient.patch new file mode 100644 index 0000000..51ef2f7 --- /dev/null +++ b/SOURCES/sos-bz2125656-plugin-make-forbidden-path-checks-more-efficient.patch @@ -0,0 +1,133 @@ +From 1dc3625fabea7331570f713fd1c87ac812d72d92 Mon Sep 17 00:00:00 2001 +From: Jake Hunsaker +Date: Wed, 18 May 2022 13:39:38 -0400 +Subject: [PATCH] [Plugin] Make forbidden path checks more efficient + +Forbidden path checks have up until now worked by taking a given file +path (potentially with globs), expanding that against all discovered +files that actually exist on the system, and then comparing a potential +collection path against that list. + +While this works, and works reasonably fast for most scenarios, it isn't +very efficient and causes significant slow downs when a non-standard +configuration is in play - e.g. thousands of block devices which sos +would individually have to compare against tens of thousands of paths +for every path the `block` plugin wants to collect. + +Improve this by first not expanding the forbidden path globs, but taking +them as distinct patterns, translating from shell-style (to maintain +historical precedent of using globs to specify paths to be skipped) to +python regex patterns as needed. Second, use `re` to handle our pattern +matching for comparison against the distinct patterns provided by a +plugin to skip. + +Closes: #2938 + +Signed-off-by: Jake Hunsaker +--- + sos/report/plugins/__init__.py | 20 +++++++++----------- + sos/report/plugins/cgroups.py | 6 ++---- + sos/report/plugins/pulpcore.py | 2 +- + sos/report/plugins/rhui.py | 2 +- + 4 files changed, 13 insertions(+), 17 deletions(-) + +diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py +index 2a42e6b0..ba1397a8 100644 +--- a/sos/report/plugins/__init__.py ++++ b/sos/report/plugins/__init__.py +@@ -46,11 +46,6 @@ def _mangle_command(command, name_max): + return mangledname + + +-def _path_in_path_list(path, path_list): +- return any((p == path or path.startswith(os.path.abspath(p)+os.sep) +- for p in path_list)) +- +- + def _node_type(st): + """ return a string indicating the type of special node represented by + the stat buffer st (block, character, fifo, socket). +@@ -1407,7 +1402,9 @@ class Plugin(): + return None + + def _is_forbidden_path(self, path): +- return _path_in_path_list(path, self.forbidden_paths) ++ return any( ++ re.match(forbid, path) for forbid in self.forbidden_paths ++ ) + + def _is_policy_forbidden_path(self, path): + return any([ +@@ -1495,14 +1492,12 @@ class Plugin(): + 'symlink': "no" + }) + +- def add_forbidden_path(self, forbidden, recursive=False): ++ def add_forbidden_path(self, forbidden): + """Specify a path, or list of paths, to not copy, even if it's part of + an ``add_copy_spec()`` call + + :param forbidden: A filepath to forbid collection from + :type forbidden: ``str`` or a ``list`` of strings +- +- :param recursive: Should forbidden glob be applied recursively + """ + if isinstance(forbidden, str): + forbidden = [forbidden] +@@ -1244,8 +1244,11 @@ + + for forbid in forbidden: + self._log_info("adding forbidden path '%s'" % forbid) +- for path in glob.glob(forbid, recursive=recursive): +- self.forbidden_paths.append(path) ++ if "*" in forbid: ++ # calling translate() here on a dir-level path will break the ++ # re.match() call during path comparison ++ forbid = fnmatch.translate(forbid) ++ self.forbidden_paths.append(forbid) + + def get_all_options(self): + """return a list of all options selected""" +diff --git a/sos/report/plugins/cgroups.py b/sos/report/plugins/cgroups.py +index 6e2a6918..20d299cf 100644 +--- a/sos/report/plugins/cgroups.py ++++ b/sos/report/plugins/cgroups.py +@@ -30,6 +30,9 @@ + ]) + + self.add_cmd_output("systemd-cgls") ++ self.add_forbidden_path( ++ "/sys/fs/cgroup/memory/**/memory.kmem.slabinfo" ++ ) + + return + +diff --git a/sos/report/plugins/pulpcore.py b/sos/report/plugins/pulpcore.py +index 6c4237ca..f6bc194c 100644 +--- a/sos/report/plugins/pulpcore.py ++++ b/sos/report/plugins/pulpcore.py +@@ -89,7 +89,7 @@ + "/etc/pki/pulp/*" + ]) + # skip collecting certificate keys +- self.add_forbidden_path("/etc/pki/pulp/**/*.key", recursive=True) ++ self.add_forbidden_path("/etc/pki/pulp/**/*.key") + + self.add_cmd_output("rq info -u redis://localhost:6379/8", + env={"LC_ALL": "en_US.UTF-8"}, +diff --git a/sos/report/plugins/rhui.py b/sos/report/plugins/rhui.py +index add02461..8063fd51 100644 +--- a/sos/report/plugins/rhui.py ++++ b/sos/report/plugins/rhui.py +@@ -30,7 +30,7 @@ class Rhui(Plugin, RedHatPlugin): + "/var/log/rhui/*", + ]) + # skip collecting certificate keys +- self.add_forbidden_path("/etc/pki/rhui/**/*.key", recursive=True) ++ self.add_forbidden_path("/etc/pki/rhui/**/*.key") + + # call rhui-manager commands with 1m timeout and + # with an env. variable ensuring that "RHUI Username:" +-- +2.27.0 + diff --git a/SOURCES/sos-bz2129105-conver2rhel-add-archived-log-collection.patch b/SOURCES/sos-bz2129105-conver2rhel-add-archived-log-collection.patch new file mode 100644 index 0000000..e2b0472 --- /dev/null +++ b/SOURCES/sos-bz2129105-conver2rhel-add-archived-log-collection.patch @@ -0,0 +1,30 @@ +From f827192424f2a4b9b390816c10b08dff658e0d74 Mon Sep 17 00:00:00 2001 +From: Rodolfo Olivieri +Date: Mon, 25 Oct 2021 09:04:06 -0300 +Subject: [PATCH] [convert2rhel] Add archived log collection + +Convert2RHEL will now archive old logs to maintain the sake of simplicity, and for that, +we are including the archive directory to be collected as well. + +Signed-off-by: Rodolfo Olivieri +--- + sos/report/plugins/convert2rhel.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/sos/report/plugins/convert2rhel.py b/sos/report/plugins/convert2rhel.py +index 74d6d40e..a786f3c2 100644 +--- a/sos/report/plugins/convert2rhel.py ++++ b/sos/report/plugins/convert2rhel.py +@@ -21,7 +21,8 @@ class convert2rhel(Plugin, RedHatPlugin): + + self.add_copy_spec([ + "/var/log/convert2rhel/convert2rhel.log", +- "/var/log/convert2rhel/rpm_va.log" ++ "/var/log/convert2rhel/archive/convert2rhel-*.log", ++ "/var/log/convert2rhel/rpm_va.log", + ]) + + +-- +2.31.1 + diff --git a/SPECS/sos.spec b/SPECS/sos.spec index 6b2ea9b..9be5131 100644 --- a/SPECS/sos.spec +++ b/SPECS/sos.spec @@ -5,7 +5,7 @@ Summary: A set of tools to gather troubleshooting information from a system Name: sos Version: 4.2 -Release: 20%{?dist} +Release: 22%{?dist} Group: Applications/System Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz Source1: sos-audit-%{auditversion}.tgz @@ -47,6 +47,9 @@ Patch23: sos-bz2055547-honour-plugins-timeout-hardcoded.patch Patch24: sos-bz2071825-merged-8.6.z.patch Patch25: sos-bz2098639-ovirt-obfuscation_answer_file.patch Patch26: sos-bz2098643-crio-output-to-json.patch +Patch27: sos-bz2121774-vdsm-set-use_devicesfile-0.patch +Patch28: sos-bz2125656-plugin-make-forbidden-path-checks-more-efficient.patch +Patch29: sos-bz2129105-conver2rhel-add-archived-log-collection.patch %description Sos is a set of tools that gathers information about system @@ -83,6 +86,9 @@ support technicians and developers. %patch24 -p1 %patch25 -p1 %patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 %build %py3_build @@ -149,7 +155,21 @@ of the system. Currently storage and filesystem commands are audited. %ghost /etc/audit/rules.d/40-sos-storage.rules %changelog -* Fri Jul 24 2022 Jan Jansky = 4.2-20 +* Thu Sep 22 2022 Jan Jansky = 4.2-22 +- [vdsm] Set LVM option use_devicesfile=0 + Resolves: bz2121774 +- [Plugin] Make forbidden path checks more efficient + Resolves: bz2125656 +- [convert2rhel] Add archived log collection + Resolves: bz2129105 + +* Mon Sep 19 2022 Jan Jansky = 4.2-21 +- [vdsm] Set LVM option use_devicesfile=0 + Resolves: bz2121774 +- [Plugin] Make forbidden path checks more efficient + Resolves: bz2125656 + +* Fri Jul 22 2022 Jan Jansky = 4.2-20 - [ovirt] obfuscate answer file Resolves: bz2098639 - [crio] from output to json