Merge branch 'c8' into a8

This commit is contained in:
eabdullin 2022-10-25 09:33:04 +00:00 committed by Stepan Oksanichenko
commit 565f929b55
4 changed files with 229 additions and 3 deletions

View File

@ -0,0 +1,43 @@
From 7d1ee59fc659467e6860e72322e976ddc5c17db3 Mon Sep 17 00:00:00 2001
From: Juan Orti Alcaine <jortialc@redhat.com>
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 <jortialc@redhat.com>
---
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

View File

@ -0,0 +1,133 @@
From 1dc3625fabea7331570f713fd1c87ac812d72d92 Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
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 <jhunsake@redhat.com>
---
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

View File

@ -0,0 +1,30 @@
From f827192424f2a4b9b390816c10b08dff658e0d74 Mon Sep 17 00:00:00 2001
From: Rodolfo Olivieri <rolivier@redhat.com>
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 <rolivier@redhat.com>
---
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

View File

@ -5,7 +5,7 @@
Summary: A set of tools to gather troubleshooting information from a system
Name: sos
Version: 4.2
Release: 20%{?dist}.alma
Release: 22%{?dist}.alma
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
# almalinux
Patch1000: sos-almalinux-branding.patch
@ -86,6 +89,9 @@ support technicians and developers.
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
# almalinux
%patch1000 -p1
@ -155,10 +161,24 @@ of the system. Currently storage and filesystem commands are audited.
%ghost /etc/audit/rules.d/40-sos-storage.rules
%changelog
* Wed Aug 03 2022 Andrew Lukoshko <alukoshko@almalinux.org> - 4.2-20.alma
* Tue Oct 25 2022 Andrew Lukoshko <alukoshko@almalinux.org> - 4.2-22.alma
- Debrand for AlmaLinux
* Fri Jul 24 2022 Jan Jansky <jjansky@redhat.com> = 4.2-20
* Thu Sep 22 2022 Jan Jansky <jjansky@redhat.com> = 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 <jjansky@redhat.com> = 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 <jjansky@redhat.com> = 4.2-20
- [ovirt] obfuscate answer file
Resolves: bz2098639
- [crio] from output to json