diff --git a/.gitignore b/.gitignore index 5e6b751..e94eaf0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/3.7.tar.gz +SOURCES/3.8.tar.gz diff --git a/.sos.metadata b/.sos.metadata index e1c0998..8c18b5f 100644 --- a/.sos.metadata +++ b/.sos.metadata @@ -1 +1 @@ -54d7ee7557c05c911e6e0bffa062347f66744f58 SOURCES/3.7.tar.gz +99c94319c6208edef8d852b9e84cbb045c01df5f SOURCES/3.8.tar.gz diff --git a/SOURCES/sos-3.7-centos-branding.patch b/SOURCES/sos-3.7-centos-branding.patch deleted file mode 100644 index 606118d..0000000 --- a/SOURCES/sos-3.7-centos-branding.patch +++ /dev/null @@ -1,107 +0,0 @@ -diff -uNrp sos-3.7.orig/sos/policies/redhat.py sos-3.7/sos/policies/redhat.py ---- sos-3.7.orig/sos/policies/redhat.py 2020-03-18 00:35:41.357473057 +0000 -+++ sos-3.7/sos/policies/redhat.py 2020-03-18 00:37:31.569721326 +0000 -@@ -31,9 +31,9 @@ OS_RELEASE = "/etc/os-release" - - - class RedHatPolicy(LinuxPolicy): -- distro = "Red Hat" -- vendor = "Red Hat" -- vendor_url = "http://www.redhat.com/" -+ distro = "CentOS" -+ vendor = "CentOS" -+ vendor_url = "http://www,centos.org/" - _redhat_release = '/etc/redhat-release' - _tmp_dir = "/var/tmp" - _rpmq_cmd = 'rpm -qa --queryformat "%{NAME}|%{VERSION}|%{RELEASE}\\n"' -@@ -92,9 +92,9 @@ class RedHatPolicy(LinuxPolicy): - - @classmethod - def check(cls): -- """This method checks to see if we are running on Red Hat. It must be -+ """This method checks to see if we are running on CentOS. It must be - overriden by concrete subclasses to return True when running on a -- Fedora, RHEL or other Red Hat distribution or False otherwise.""" -+ Fedora, RHEL or CentOS distribution or False otherwise.""" - return False - - def check_usrmove(self, pkgs): -@@ -185,7 +185,7 @@ class RedHatPolicy(LinuxPolicy): - return self.host_name() - - --# Container environment variables on Red Hat systems. -+# Container environment variables on CentOS systems. - ENV_CONTAINER = 'container' - ENV_HOST_SYSROOT = 'HOST' - -@@ -196,7 +196,7 @@ _cb_plugs = ['abrt', 'block', 'boot', 'd - 'hardware', 'host', 'kernel', 'logs', 'lvm2', 'memory', 'rpm', - 'process', 'systemd', 'yum', 'xfs'] - --RHEL_RELEASE_STR = "Red Hat Enterprise Linux" -+RHEL_RELEASE_STR = "CentOS Linux" - - RHV = "rhv" - RHV_DESC = "Red Hat Virtualization" -@@ -205,17 +205,17 @@ RHEL = "rhel" - RHEL_DESC = RHEL_RELEASE_STR - - RHOSP = "rhosp" --RHOSP_DESC = "Red Hat OpenStack Platform" -+RHOSP_DESC = "RDO" - RHOSP_OPTS = SoSOptions(plugopts=[ - 'process.lsof=off', - 'networking.ethtool_namespaces=False', - 'networking.namespaces=200']) - - RHOCP = "ocp" --RHOCP_DESC = "OpenShift Container Platform by Red Hat" -+RHOCP_DESC = "OpenShift" - - RH_SATELLITE = "satellite" --RH_SATELLITE_DESC = "Red Hat Satellite" -+RH_SATELLITE_DESC = "Satellite" - SAT_OPTS = SoSOptions(verify=True, plugopts=['apache.log=on']) - - CB = "cantboot" -@@ -253,9 +253,9 @@ No changes will be made to system config - - - class RHELPolicy(RedHatPolicy): -- distro = RHEL_RELEASE_STR -- vendor = "Red Hat" -- vendor_url = "https://access.redhat.com/support/" -+ distro = "CentOS Linux" -+ vendor = "CentOS" -+ vendor_url = "https://wiki.centos.org/" - msg = _("""\ - This command will collect diagnostic and configuration \ - information from this %(distro)s system and installed \ -@@ -274,7 +274,7 @@ support representative. - def check(cls): - """Test to see if the running host is a RHEL installation. - -- Checks for the presence of the "Red Hat Enterprise Linux" -+ Checks for the presence of the "CentOS Linux" - release string at the beginning of the NAME field in the - `/etc/os-release` file and returns ``True`` if it is - found, and ``False`` otherwise. -@@ -343,7 +343,7 @@ class CentOsPolicy(RHELPolicy): - - ATOMIC = "atomic" - ATOMIC_RELEASE_STR = "Atomic" --ATOMIC_DESC = "Red Hat Enterprise Linux Atomic Host" -+ATOMIC_DESC = "CentOS Linux Atomic Host" - - atomic_presets = { - ATOMIC: PresetDefaults(name=ATOMIC, desc=ATOMIC_DESC, note=NOTE_TIME, -@@ -352,7 +352,7 @@ atomic_presets = { - - - class RedHatAtomicPolicy(RHELPolicy): -- distro = "Red Hat Atomic Host" -+ distro = "CentOS Atomic Host" - msg = _("""\ - This command will collect diagnostic and configuration \ - information from this %(distro)s system. diff --git a/SOURCES/sos-bz1311129-sos-conf-disabled-plugins-manpages.patch b/SOURCES/sos-bz1311129-sos-conf-disabled-plugins-manpages.patch deleted file mode 100644 index bed3bde..0000000 --- a/SOURCES/sos-bz1311129-sos-conf-disabled-plugins-manpages.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 4cb21e2c16b55e7506a3cefd9148ba4bf49dbce1 Mon Sep 17 00:00:00 2001 -From: Pavel Moravec <pmoravec@redhat.com> -Date: Wed, 17 Apr 2019 13:17:24 +0200 -Subject: [PATCH] [sosreport] update sos.conf manpages by [general] section - description - -Since PR #1530, sosreport supports all command line options. Man pages -should document the enhancement. - -Resolves: #1652 - -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> ---- - man/en/sos.conf.5 | 38 ++++++++++++++++++++++++++++++++++---- - 1 file changed, 34 insertions(+), 4 deletions(-) - -diff --git a/man/en/sos.conf.5 b/man/en/sos.conf.5 -index b40a48e1..ad18d5f2 100644 ---- a/man/en/sos.conf.5 -+++ b/man/en/sos.conf.5 -@@ -6,19 +6,49 @@ sos.conf \- sosreport configuration - sosreport uses a configuration file at /etc/sos.conf. - .SH PARAMETERS - .sp --There are two sections in the sosreport configuration file: --plugins, and tunables. Options are set using 'ini'-style --\fBname = value\fP pairs. -+There are three sections in the sosreport configuration file: -+general, plugins and tunables. Options are set using 'ini'-style -+\fBname = value\fP pairs. Disabling/enabling a boolean option -+is done the same way like on command line (e.g. process.lsof=off). - - Some options accept a comma separated list of values. - -+Using options that dont expect a value (like all-logs or no-report) -+will result in enabling those options, regardless of value set. -+ -+Sections are parsed in the ordering: -+.br -+- \fB[general]\fP -+.br -+- \fB[plugins]\fP (disable) -+.br -+- \fB[plugins]\fP (enable) -+.br -+- \fB[tunables]\fP -+ -+.TP -+\fB[general]\fP -+<option> Sets (long) option value. Short options (i.e. z=auto) -+ are not supported. - .TP - \fB[plugins]\fP --disable Comma separated list of plugins to disable. -+disable Comma separated list of plugins to disable. -+.br -+enable Comma separated list of plugins to enable. - .TP - \fB[tunables]\fP - plugin.option Alter available options for defined plugin. - .SH EXAMPLES -+To use quiet and batch mode with 10 threads: -+.LP -+[general] -+.br -+batch=yes -+.br -+build=true -+.br -+threads=10 -+.sp - To disable the 'general' and 'filesys' plugins: - .LP - [plugins] --- -2.17.2 - -From 84822ff1bbe2d5543daa8059b0a2270c88e473d6 Mon Sep 17 00:00:00 2001 -From: Pavel Moravec <pmoravec@redhat.com> -Date: Wed, 17 Apr 2019 11:51:09 +0200 -Subject: [PATCH] [sosreport] initialize disabled plugins properly when parsing - sos.conf - -opts.noplugins is referred when parsing "tunables" section, so -the variable must be set to empty list every time. - -Resolves: #1651 - -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> ---- - sos/__init__.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sos/__init__.py b/sos/__init__.py -index dfc7ed5f..ed59025a 100644 ---- a/sos/__init__.py -+++ b/sos/__init__.py -@@ -250,8 +250,8 @@ class SoSOptions(object): - optlist.extend(SoSOptions._opt_to_args(opt, val)) - opts._merge_opts(argparser.parse_args(optlist), is_default) - -+ opts.noplugins = [] - if config.has_option("plugins", "disable"): -- opts.noplugins = [] - opts.noplugins.extend([plugin.strip() for plugin in - config.get("plugins", "disable").split(',')]) - --- -2.17.2 - diff --git a/SOURCES/sos-bz1630028-manpages-allow-system-changes.patch b/SOURCES/sos-bz1630028-manpages-allow-system-changes.patch new file mode 100644 index 0000000..fc1a27e --- /dev/null +++ b/SOURCES/sos-bz1630028-manpages-allow-system-changes.patch @@ -0,0 +1,41 @@ +From b103c4a9e0c93f18576205eee7b8e0989aaf559d Mon Sep 17 00:00:00 2001 +From: Pavel Moravec <pmoravec@redhat.com> +Date: Tue, 12 Nov 2019 19:12:45 +0100 +Subject: [PATCH] [man] describe --allow-system-changes (#1850) + +In #1435, --allow-system-changes option was added that is documented +in sosreport --help but not in manpages. + +Resolves: #1850 + +Signed-off-by: Pavel Moravec <pmoravec@redhat.com> +Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com> +--- + man/en/sosreport.1 | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/man/en/sosreport.1 b/man/en/sosreport.1 +index 649cba0..a885d56 100644 +--- a/man/en/sosreport.1 ++++ b/man/en/sosreport.1 +@@ -25,6 +25,7 @@ sosreport \- Collect and package diagnostic and support data + [--log-size]\fR + [--all-logs]\fR + [--since YYYYMMDD[HHMMSS]]\fR ++ [--allow-system-changes]\fR + [-z|--compression-type method]\fR + [--encrypt-key KEY]\fR + [--encrypt-pass PASS]\fR +@@ -160,6 +161,9 @@ increase the size of reports. + Limits the collection to logs newer than this date. + This also affects \--all-logs. Will pad with 0s if HHMMSS isn't specified. + .TP ++.B \--allow-system-changes ++Run commands even if they can change the system (e.g. load kernel modules). ++.TP + .B \-z, \--compression-type METHOD + Override the default compression type specified by the active policy. + .TP +-- +1.8.3.1 + diff --git a/SOURCES/sos-bz1639166-pcp-pmlogger-no-limit.patch b/SOURCES/sos-bz1639166-pcp-pmlogger-no-limit.patch deleted file mode 100644 index 8c12a1b..0000000 --- a/SOURCES/sos-bz1639166-pcp-pmlogger-no-limit.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 380737d0bf4021434db4d5e479f0b8a2aece6ec9 Mon Sep 17 00:00:00 2001 -From: Pavel Moravec <pmoravec@redhat.com> -Date: Thu, 4 Apr 2019 10:43:24 +0200 -Subject: [PATCH] [pcp] collect pmlogger without a sizelimit - -sizelimit=None defaults to --log-size, use sizelimit=0 instead - -Resolves: #1632 - -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> ---- - sos/plugins/pcp.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sos/plugins/pcp.py b/sos/plugins/pcp.py -index da7158a6..da2a6611 100644 ---- a/sos/plugins/pcp.py -+++ b/sos/plugins/pcp.py -@@ -130,7 +130,7 @@ class Pcp(Plugin, RedHatPlugin, DebianPlugin): - pmlogger_ls = self.get_cmd_output_now("ls -t1 %s" % path) - if pmlogger_ls: - for line in open(pmlogger_ls).read().splitlines(): -- self.add_copy_spec(line, sizelimit=None) -+ self.add_copy_spec(line, sizelimit=0) - files_collected = files_collected + 1 - if self.countlimit and files_collected == self.countlimit: - break --- -2.17.2 - diff --git a/SOURCES/sos-bz1656812-bump-release.patch b/SOURCES/sos-bz1656812-bump-release.patch deleted file mode 100644 index 0fead48..0000000 --- a/SOURCES/sos-bz1656812-bump-release.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 9b1f9472e7b0b8a993f635c8d4c757b59c46ed0f Mon Sep 17 00:00:00 2001 -From: "Bryn M. Reeves" <bmr@redhat.com> -Date: Wed, 27 Mar 2019 21:00:36 +0000 -Subject: [PATCH] [sos] bump release - -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos.spec | 2 +- - sos/__init__.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sos.spec b/sos.spec -index 95249670..68aedcfd 100644 ---- a/sos.spec -+++ b/sos.spec -@@ -2,7 +2,7 @@ - - Summary: A set of tools to gather troubleshooting information from a system - Name: sos --Version: 3.6 -+Version: 3.7 - Release: 1%{?dist} - Group: Applications/System - Source0: http://people.redhat.com/breeves/sos/releases/sos-%{version}.tar.gz -diff --git a/sos/__init__.py b/sos/__init__.py -index c436bd20..dfc7ed5f 100644 ---- a/sos/__init__.py -+++ b/sos/__init__.py -@@ -25,7 +25,7 @@ if six.PY3: - else: - from ConfigParser import ConfigParser, ParsingError, Error - --__version__ = "3.6" -+__version__ = "3.7" - - gettext_dir = "/usr/share/locale" - gettext_app = "sos" --- -2.17.2 - diff --git a/SOURCES/sos-bz1683904-option_to_limit_namespaces.patch b/SOURCES/sos-bz1683904-option_to_limit_namespaces.patch deleted file mode 100644 index 60aef4e..0000000 --- a/SOURCES/sos-bz1683904-option_to_limit_namespaces.patch +++ /dev/null @@ -1,185 +0,0 @@ -From c20bd8d489c45401db55cf89bf7d4d0f7623a4fe Mon Sep 17 00:00:00 2001 -From: Jan Jansky <jjansky@redhat.com> -Date: Thu, 6 Feb 2020 08:56:11 +0100 -Subject: [PATCH] [networking] options to limit namespaces - -* Added posibility to define namespaces with -parameter namespaces = "". Posible regexp -like "eth* ens4". -* Added inspect_namespaces which defines how -many namespaces should be inspected, by -default unlimited -* Added ethtool_namespaces variable which -is by default true and if set to false it -will not execute ethtool commands for -namespaces -* Changed options for OpenStack environment -where ethtool_namespaces=False and -inspect_namespaces = 200 - -Closes: #1916 - -Signed-off-by: Jan Jansky <jjansky@redhat.com> -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> ---- ---- a/sos/plugins/networking.py -+++ b/sos/plugins/networking.py -@@ -8,7 +8,7 @@ - - from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin - from os import listdir --import re -+from re import match - - - class Networking(Plugin): -@@ -17,10 +17,17 @@ - plugin_name = "networking" - profiles = ('network', 'hardware', 'system') - trace_host = "www.example.com" -- option_list = [( -+ option_list = [ - ("traceroute", "collect a traceroute to %s" % trace_host, "slow", -- False) -- )] -+ False), -+ ("namespace_pattern", "Specific namespaces pattern to be " + -+ "collected, namespaces pattern should be separated by whitespace " + -+ "as for example \"eth* ens2\"", "fast", ""), -+ ("namespaces", "Number of namespaces to collect, 0 for unlimited. " + -+ "Incompatible with the namespace_pattern plugin option", "slow", 0), -+ ("ethtool_namespaces", "Define if ethtool commands should be " + -+ "collected for namespaces", "slow", True) -+ ] - - # switch to enable netstat "wide" (non-truncated) output mode - ns_wide = "-W" -@@ -196,8 +203,41 @@ - # per-namespace. - ip_netns_file = self.get_cmd_output_now("ip netns") - cmd_prefix = "ip netns exec " -+ # Regex initialization outside of for loop - if ip_netns_file: -- for namespace in self.get_ip_netns(ip_netns_file): -+ if self.get_option("namespace_pattern"): -+ pattern = '(?:%s$)' % '$|'.join( -+ self.get_option("namespace_pattern").split() -+ ).replace('*', '.*') -+ out_ns = [] -+ with open(ip_netns_file, 'r') as file: -+ ip_netns = file.read() -+ for line in ip_netns.splitlines(): -+ # If there's no namespaces, no need to continue -+ if line.startswith("Object \"netns\" is unknown") \ -+ or line.isspace() \ -+ or line[:1].isspace(): -+ continue -+ -+ # if namespace_pattern defined, append only namespaces -+ # matching with pattern -+ if self.get_option("namespace_pattern"): -+ if bool(match(pattern, line)): -+ out_ns.append(line.partition(' ')[0]) -+ -+ # if namespaces is defined and namespace_pattern is not defined -+ # remove from out_ns namespaces with higher index than defined -+ elif self.get_option("namespaces") != 0: -+ out_ns.append(line.partition(' ')[0]) -+ if len(out_ns) == self.get_option("namespaces"): -+ self._log_warn("Limiting namespace iteration " + -+ "to first %s namespaces found" -+ % self.get_option("namespaces")) -+ break -+ else: -+ out_ns.append(line.partition(' ')[0]) -+ -+ for namespace in out_ns: - ns_cmd_prefix = cmd_prefix + namespace + " " - self.add_cmd_output([ - ns_cmd_prefix + "ip address show", -@@ -208,25 +248,27 @@ - ns_cmd_prefix + "netstat -s", - ns_cmd_prefix + "netstat %s -agn" % self.ns_wide - ]) -- -- # Devices that exist in a namespace use less ethtool -- # parameters. Run this per namespace. -- for namespace in self.get_ip_netns(ip_netns_file): -- ns_cmd_prefix = cmd_prefix + namespace + " " -- netns_netdev_list = self.call_ext_prog(ns_cmd_prefix + -+ # Collect ethtool commands only when ethtool_namespaces -+ # is set to true. -+ if self.get_option("ethtool_namespaces"): -+ # Devices that exist in a namespace use less ethtool -+ # parameters. Run this per namespace. -+ for namespace in out_ns: -+ ns_cmd_prefix = cmd_prefix + namespace + " " -+ netns_netdev_list = self.call_ext_prog(ns_cmd_prefix + - "ls -1 /sys/class/net/") -- for eth in netns_netdev_list['output'].splitlines(): -- # skip 'bonding_masters' file created when loading the -- # bonding module but the file does not correspond to -- # a device -- if eth == "bonding_masters": -- continue -- self.add_cmd_output([ -- ns_cmd_prefix + "ethtool " + eth, -- ns_cmd_prefix + "ethtool -i " + eth, -- ns_cmd_prefix + "ethtool -k " + eth, -- ns_cmd_prefix + "ethtool -S " + eth -- ]) -+ for eth in netns_netdev_list['output'].splitlines(): -+ # skip 'bonding_masters' file created when loading the -+ # bonding module but the file does not correspond to -+ # a device -+ if eth == "bonding_masters": -+ continue -+ self.add_cmd_output([ -+ ns_cmd_prefix + "ethtool " + eth, -+ ns_cmd_prefix + "ethtool -i " + eth, -+ ns_cmd_prefix + "ethtool -k " + eth, -+ ns_cmd_prefix + "ethtool -S " + eth -+ ]) - - return - ---- a/sos/policies/redhat.py -+++ b/sos/policies/redhat.py -@@ -192,8 +192,6 @@ - _opts_verify = SoSOptions(verify=True) - _opts_all_logs = SoSOptions(all_logs=True) - _opts_all_logs_verify = SoSOptions(all_logs=True, verify=True) --_opts_all_logs_no_lsof = SoSOptions(all_logs=True, -- plugopts=['process.lsof=off']) - _cb_plugs = ['abrt', 'block', 'boot', 'dnf', 'dracut', 'filesys', 'grub2', - 'hardware', 'host', 'kernel', 'logs', 'lvm2', 'memory', 'rpm', - 'process', 'systemd', 'yum', 'xfs'] -@@ -208,6 +206,10 @@ - - RHOSP = "rhosp" - RHOSP_DESC = "Red Hat OpenStack Platform" -+RHOSP_OPTS = SoSOptions(plugopts=[ -+ 'process.lsof=off', -+ 'networking.ethtool_namespaces=False', -+ 'networking.namespaces=200']) - - RHOCP = "ocp" - RHOCP_DESC = "OpenShift Container Platform by Red Hat" -@@ -221,7 +223,6 @@ - CB_OPTS = SoSOptions(verify=True, all_logs=True, onlyplugins=_cb_plugs) - CB_NOTE = ("Data collection will be limited to a boot-affecting scope") - --NOTE_SIZE = "This preset may increase report size" - NOTE_TIME = "This preset may increase report run time" - NOTE_SIZE_TIME = "This preset may increase report size and run time" - -@@ -229,8 +230,7 @@ - RHV: PresetDefaults(name=RHV, desc=RHV_DESC, note=NOTE_TIME, - opts=_opts_verify), - RHEL: PresetDefaults(name=RHEL, desc=RHEL_DESC), -- RHOSP: PresetDefaults(name=RHOSP, desc=RHOSP_DESC, note=NOTE_SIZE, -- opts=_opts_all_logs_no_lsof), -+ RHOSP: PresetDefaults(name=RHOSP, desc=RHOSP_DESC, opts=RHOSP_OPTS), - RHOCP: PresetDefaults(name=RHOCP, desc=RHOCP_DESC, note=NOTE_SIZE_TIME, - opts=_opts_all_logs_verify), - RH_SATELLITE: PresetDefaults(name=RH_SATELLITE, desc=RH_SATELLITE_DESC, diff --git a/SOURCES/sos-bz1697813-plugin-vs-command-timeouts.patch b/SOURCES/sos-bz1697813-plugin-vs-command-timeouts.patch deleted file mode 100644 index 00e896e..0000000 --- a/SOURCES/sos-bz1697813-plugin-vs-command-timeouts.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 7c8c45dad3481cfaae3d3af9c188218aa14a3a6a Mon Sep 17 00:00:00 2001 -From: Pavel Moravec <pmoravec@redhat.com> -Date: Tue, 9 Apr 2019 09:50:34 +0200 -Subject: [PATCH] [foreman,satellite] increase plugin default timeouts - -Those two plugins call commands with bigger timeouts than the default -plugin timeout is. That can unexpectedly kill the plugin execution when -the commands execution took longer than the plugin timeout (but within -cmd timeout). - -Resolves: #1642 - -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> ---- - sos/plugins/foreman.py | 1 + - sos/plugins/satellite.py | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/sos/plugins/foreman.py b/sos/plugins/foreman.py -index a1e937f3..8bcd26bd 100644 ---- a/sos/plugins/foreman.py -+++ b/sos/plugins/foreman.py -@@ -19,6 +19,7 @@ class Foreman(Plugin): - """ - - plugin_name = 'foreman' -+ plugin_timeout = 1800 - profiles = ('sysmgmt',) - packages = ('foreman', 'foreman-proxy') - option_list = [ -diff --git a/sos/plugins/satellite.py b/sos/plugins/satellite.py -index c50c2ec7..83733076 100644 ---- a/sos/plugins/satellite.py -+++ b/sos/plugins/satellite.py -@@ -14,6 +14,7 @@ class Satellite(Plugin, RedHatPlugin): - """ - - plugin_name = 'satellite' -+ plugin_timeout = 1200 - profiles = ('sysmgmt',) - verify_packages = ('spacewalk.*',) - satellite = False --- -2.17.2 - diff --git a/SOURCES/sos-bz1697854-plugopts-default-datatypes.patch b/SOURCES/sos-bz1697854-plugopts-default-datatypes.patch deleted file mode 100644 index a5d1036..0000000 --- a/SOURCES/sos-bz1697854-plugopts-default-datatypes.patch +++ /dev/null @@ -1,122 +0,0 @@ -From c71b41547442d23daf5c3bf88450151d13903214 Mon Sep 17 00:00:00 2001 -From: Pavel Moravec <pmoravec@redhat.com> -Date: Thu, 4 Apr 2019 13:54:18 +0200 -Subject: [PATCH] [maas,mysql,npm,pacemaker,postgresql] fix plugopts data types - -With new enforcement of implicit data type for plugin options, the -plugopts must have proper data types of default values and plugins must work -with them accordingly (in tests or so). - -Resolves: #1635 - -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> ---- - sos/plugins/maas.py | 6 +++--- - sos/plugins/mysql.py | 2 +- - sos/plugins/npm.py | 4 ++-- - sos/plugins/pacemaker.py | 4 ++-- - sos/plugins/postgresql.py | 6 +++--- - 5 files changed, 11 insertions(+), 11 deletions(-) - -diff --git a/sos/plugins/maas.py b/sos/plugins/maas.py -index f8305406..ea038e86 100644 ---- a/sos/plugins/maas.py -+++ b/sos/plugins/maas.py -@@ -21,10 +21,10 @@ class Maas(Plugin, UbuntuPlugin): - - option_list = [ - ('profile-name', -- 'The name with which you will later refer to this remote', '', False), -- ('url', 'The URL of the remote API', '', False), -+ 'The name with which you will later refer to this remote', '', ''), -+ ('url', 'The URL of the remote API', '', ''), - ('credentials', -- 'The credentials, also known as the API key', '', False) -+ 'The credentials, also known as the API key', '', '') - ] - - def _has_login_options(self): -diff --git a/sos/plugins/mysql.py b/sos/plugins/mysql.py -index 49bc4168..411d90b8 100644 ---- a/sos/plugins/mysql.py -+++ b/sos/plugins/mysql.py -@@ -22,7 +22,7 @@ class Mysql(Plugin): - - option_list = [ - ("dbuser", "username for database dumps", "", "mysql"), -- ("dbpass", "password for database dumps" + pw_warn_text, "", False), -+ ("dbpass", "password for database dumps" + pw_warn_text, "", ""), - ("dbdump", "collect a database dump", "", False) - ] - -diff --git a/sos/plugins/npm.py b/sos/plugins/npm.py -index 0fc95801..ca00d0c0 100644 ---- a/sos/plugins/npm.py -+++ b/sos/plugins/npm.py -@@ -25,7 +25,7 @@ class Npm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, SuSEPlugin): - option_list = [("project_path", - 'List npm modules of a project specified by path', - 'fast', -- 0)] -+ '')] - - # in Fedora, Debian, Ubuntu and Suse the package is called npm - packages = ('npm',) -@@ -79,7 +79,7 @@ class Npm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, SuSEPlugin): - self.add_string_as_file(json.dumps(output), outfn) - - def setup(self): -- if self.get_option("project_path") != 0: -+ if self.get_option("project_path"): - project_path = os.path.abspath(os.path.expanduser( - self.get_option("project_path"))) - self._get_npm_output("npm ls --json", "npm_ls_project", -diff --git a/sos/plugins/pacemaker.py b/sos/plugins/pacemaker.py -index a1b64ea5..940389ee 100644 ---- a/sos/plugins/pacemaker.py -+++ b/sos/plugins/pacemaker.py -@@ -25,7 +25,7 @@ class Pacemaker(Plugin): - ) - - option_list = [ -- ("crm_from", "specify the start time for crm_report", "fast", False), -+ ("crm_from", "specify the start time for crm_report", "fast", ''), - ("crm_scrub", "enable password scrubbing for crm_report", "", True), - ] - -@@ -87,7 +87,7 @@ class Pacemaker(Plugin): - # time in order to collect data. - crm_from = (datetime.today() - - timedelta(hours=72)).strftime("%Y-%m-%d %H:%m:%S") -- if self.get_option("crm_from") is not False: -+ if self.get_option("crm_from"): - if re.match(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}', - str(self.get_option("crm_from"))): - crm_from = self.get_option("crm_from") -diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py -index 1698b62f..a04dca8f 100644 ---- a/sos/plugins/postgresql.py -+++ b/sos/plugins/postgresql.py -@@ -31,7 +31,7 @@ class PostgreSQL(Plugin): - option_list = [ - ('pghome', 'PostgreSQL server home directory.', '', '/var/lib/pgsql'), - ('username', 'username for pg_dump', '', 'postgres'), -- ('password', 'password for pg_dump' + password_warn_text, '', False), -+ ('password', 'password for pg_dump' + password_warn_text, '', ''), - ('dbname', 'database name to dump for pg_dump', '', ''), - ('dbhost', 'database hostname/IP (do not use unix socket)', '', ''), - ('dbport', 'database server port number', '', '5432') -@@ -43,8 +43,8 @@ class PostgreSQL(Plugin): - # We're only modifying this for ourself and our children so - # there is no need to save and restore environment variables if - # the user decided to pass the password on the command line. -- if self.get_option("password") is not False: -- os.environ["PGPASSWORD"] = str(self.get_option("password")) -+ if self.get_option("password"): -+ os.environ["PGPASSWORD"] = self.get_option("password") - - if self.get_option("dbhost"): - cmd = "pg_dump -U %s -h %s -p %s -w -F t %s" % ( --- -2.17.2 - diff --git a/SOURCES/sos-bz1699381-gluster-skip-statedump-dirs.patch b/SOURCES/sos-bz1699381-gluster-skip-statedump-dirs.patch new file mode 100644 index 0000000..5f48848 --- /dev/null +++ b/SOURCES/sos-bz1699381-gluster-skip-statedump-dirs.patch @@ -0,0 +1,33 @@ +From a36c892e7a60ef5bba03e07c12ef1939fd2f0a45 Mon Sep 17 00:00:00 2001 +From: Pavel Moravec <pmoravec@redhat.com> +Date: Wed, 2 Oct 2019 16:55:05 +0200 +Subject: [PATCH] [gluster] process files only from a statedump dir + +Traversing statedump dir for statedump files must skip +subdirectories (where the dump files won't appear). + +Resolves: #1812 + +Signed-off-by: Pavel Moravec <pmoravec@redhat.com> +--- + sos/plugins/gluster.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/sos/plugins/gluster.py b/sos/plugins/gluster.py +index 101b0da2..ae770f07 100644 +--- a/sos/plugins/gluster.py ++++ b/sos/plugins/gluster.py +@@ -42,7 +42,9 @@ class Gluster(Plugin, RedHatPlugin): + + def wait_for_statedump(self, name_dir): + statedumps_present = 0 +- statedump_entries = os.listdir(name_dir) ++ statedump_entries = [ ++ f for f in os.listdir(name_dir) if os.path.isfile(f) ++ ] + for statedump_file in statedump_entries: + statedumps_present = statedumps_present+1 + ret = -1 +-- +2.21.0 + diff --git a/SOURCES/sos-bz1702802-openstack_instack-ansible-log.patch b/SOURCES/sos-bz1702802-openstack_instack-ansible-log.patch deleted file mode 100644 index 80a0bbf..0000000 --- a/SOURCES/sos-bz1702802-openstack_instack-ansible-log.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 1b9c2032149488a2372d188a8ed3251e364f41cf Mon Sep 17 00:00:00 2001 -From: Emilien Macchi <emilien@redhat.com> -Date: Wed, 24 Apr 2019 20:54:05 -0400 -Subject: [PATCH] [openstack_instack] add ansible.log - -Collect /var/lib/mistral/config-download-latest/ansible.log which is an -important log to be able to debug issues with Ansible playbooks. - -/var/lib/mistral/config-download-latest is a directory that exists -anyway on the undercloud and is the place where the ansible logs is -stored. - -Note: we don't want to collect the whole /var/lib/mistral because it -contains sensitive informations like username/passwords/endpoints. - -rhbz#1702806 -rhbz#1702802 - -Resolves: #1661 - -Signed-off-by: Emilien Macchi <emilien@redhat.com> -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/openstack_instack.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/sos/plugins/openstack_instack.py b/sos/plugins/openstack_instack.py -index e3470f5a..15e6c384 100644 ---- a/sos/plugins/openstack_instack.py -+++ b/sos/plugins/openstack_instack.py -@@ -22,7 +22,8 @@ NON_CONTAINERIZED_DEPLOY = [ - CONTAINERIZED_DEPLOY = [ - '/var/log/heat-launcher/', - '/home/stack/install-undercloud.log', -- '/home/stack/undercloud-install-*.tar.bzip2' -+ '/home/stack/undercloud-install-*.tar.bzip2', -+ '/var/lib/mistral/config-download-latest/ansible.log' - ] - - --- -2.17.2 - diff --git a/SOURCES/sos-bz1706060-vdsm-plugin.patch b/SOURCES/sos-bz1706060-vdsm-plugin.patch deleted file mode 100644 index 2ae0c5a..0000000 --- a/SOURCES/sos-bz1706060-vdsm-plugin.patch +++ /dev/null @@ -1,335 +0,0 @@ -From 1b4f8dfb8ac85708441faa3b2c2b9c2624dfa155 Mon Sep 17 00:00:00 2001 -From: "irit.go" <igoihman@redhat.com> -Date: Tue, 24 Jul 2018 11:01:55 +0300 -Subject: [PATCH 1/2] [Plugin] add get_process_pids() to return PIDs by process - name - -Signed-off-by: Irit Goihman igoihman@redhat.com -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/__init__.py | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py -index 4c8822b7..cdeda77a 100644 ---- a/sos/plugins/__init__.py -+++ b/sos/plugins/__init__.py -@@ -1389,6 +1389,22 @@ class Plugin(object): - return False - return status - -+ def get_process_pids(self, process): -+ """Returns PIDs of all processes with process name. -+ If the process doesn't exist, returns an empty list""" -+ pids = [] -+ cmd_line_glob = "/proc/[0-9]*/cmdline" -+ cmd_line_paths = glob.glob(cmd_line_glob) -+ for path in cmd_line_paths: -+ try: -+ with open(path, 'r') as f: -+ cmd_line = f.read().strip() -+ if process in cmd_line: -+ pids.append(path.split("/")[2]) -+ except IOError as e: -+ continue -+ return pids -+ - - class RedHatPlugin(object): - """Tagging class for Red Hat's Linux distributions""" --- -2.17.2 - - -From 0618db904dadb05fde70c181a5940989ac127fe2 Mon Sep 17 00:00:00 2001 -From: Irit Goihman <igoihman@redhat.com> -Date: Thu, 1 Feb 2018 16:44:32 +0200 -Subject: [PATCH 2/2] [plugins] add vdsm plugin - -Add a plugin for vdsm - -Resolves: #1205 - -Signed-off-by: Irit Goihman <igoihman@redhat.com> -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/vdsm.py | 146 ++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 146 insertions(+) - create mode 100644 sos/plugins/vdsm.py - -diff --git a/sos/plugins/vdsm.py b/sos/plugins/vdsm.py -new file mode 100644 -index 00000000..c648abbf ---- /dev/null -+++ b/sos/plugins/vdsm.py -@@ -0,0 +1,146 @@ -+# Copyright (C) 2018 Red Hat, Inc. -+ -+# 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. -+ -+from sos.plugins import Plugin, RedHatPlugin -+ -+import glob -+import json -+import re -+ -+ -+# This configuration is based on vdsm.storage.lvm.LVM_CONF_TEMPLATE. -+# -+# locking_type is set to 0 in order to match lvm sos commands. With this -+# configuration we don't take any locks, so we will never block because -+# there is a stuck lvm command. -+# locking_type=0 -+# -+# 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=[ '^/dev/mapper/' ] -+# filter=[ 'a|^/dev/mapper/.*|', 'r|.*|' ] -+LVM_CONFIG = """ -+global { -+ locking_type=0 -+ use_lvmetad=0 -+} -+devices { -+ preferred_names=["^/dev/mapper/"] -+ ignore_suspended_devices=1 -+ write_cache_state=0 -+ disable_after_error_count=3 -+ filter=["a|^/dev/mapper/.*|", "r|.*|"] -+} -+""" -+LVM_CONFIG = re.sub(r"\s+", " ", LVM_CONFIG).strip() -+ -+ -+class Vdsm(Plugin, RedHatPlugin): -+ """vdsm Plugin""" -+ -+ packages = ( -+ 'vdsm', -+ 'vdsm-client', -+ ) -+ -+ plugin_name = 'vdsm' -+ -+ def setup(self): -+ self.add_forbidden_path('/etc/pki/vdsm/keys/*') -+ self.add_forbidden_path('/etc/pki/vdsm/libvirt-spice/*-key.*') -+ self.add_forbidden_path('/etc/pki/libvirt/private/*') -+ -+ self.add_cmd_output('service vdsmd status') -+ -+ self.add_copy_spec([ -+ '/tmp/vds_installer*', -+ '/tmp/vds_bootstrap*', -+ '/etc/vdsm/*' -+ ]) -+ -+ limit = self.get_option('log_size') -+ -+ self.add_copy_spec('/var/log/vdsm/*', sizelimit=limit) -+ -+ self._add_vdsm_forbidden_paths() -+ self.add_copy_spec([ -+ '/var/run/vdsm/*', -+ '/usr/libexec/vdsm/hooks', -+ '/var/lib/vdsm' -+ ]) -+ -+ qemu_pids = self.get_process_pids('qemu-kvm') -+ if qemu_pids: -+ files = ["cmdline", "status", "mountstats"] -+ self.add_copy_spec([ -+ "/proc/%s/%s" % (pid, name) -+ for pid in qemu_pids -+ for name in files -+ ]) -+ self.add_cmd_output([ -+ "ls -ldZ /etc/vdsm", -+ "su vdsm -s sh -c 'tree -l /rhev/data-center'", -+ "su vdsm -s sh -c 'ls -lR /rhev/data-center'" -+ ]) -+ self.add_cmd_output([ -+ "lvm vgs -v -o +tags --config \'%s\'" % LVM_CONFIG, -+ "lvm lvs -v -o +tags --config \'%s\'" % LVM_CONFIG, -+ "lvm pvs -v -o +all --config \'%s\'" % LVM_CONFIG -+ ]) -+ -+ self.add_cmd_output([ -+ 'vdsm-client Host getCapabilities', -+ 'vdsm-client Host getStats', -+ 'vdsm-client Host getAllVmStats', -+ 'vdsm-client Host getVMFullList', -+ 'vdsm-client Host getDeviceList', -+ 'vdsm-client Host hostdevListByCaps', -+ 'vdsm-client Host getAllTasksInfo', -+ 'vdsm-client Host getAllTasksStatuses' -+ ]) -+ -+ try: -+ res = self.call_ext_prog( -+ 'vdsm-client Host getConnectedStoragePools' -+ ) -+ if res['status'] == 0: -+ pools = json.loads(res['output']) -+ for pool in pools: -+ self.add_cmd_output( -+ 'vdsm-client StoragePool getSpmStatus' -+ ' storagepoolID={}'.format(pool) -+ ) -+ except ValueError as e: -+ self._log_error( -+ 'vdsm-client Host getConnectedStoragePools: %s' % (e) -+ ) -+ -+ try: -+ res = self.call_ext_prog('vdsm-client Host getStorageDomains') -+ if res['status'] == 0: -+ sd_uuids = json.loads(res['output']) -+ dump_volume_chains_cmd = 'vdsm-tool dump-volume-chains %s' -+ self.add_cmd_output([ -+ dump_volume_chains_cmd % uuid for uuid in sd_uuids -+ ]) -+ except ValueError as e: -+ self._log_error( -+ 'vdsm-client Host getStorageDomains: %s' % (e) -+ ) -+ -+ def _add_vdsm_forbidden_paths(self): -+ """Add confidential sysprep vfds under /var/run/vdsm to -+ forbidden paths """ -+ -+ for file_path in glob.glob("/var/run/vdsm/*"): -+ if file_path.endswith(('.vfd', '/isoUploader', '/storage')): -+ self.add_forbidden_path(file_path) --- -2.17.2 - -From 7141ebf3b2071c84286ced29154c33502c4da934 Mon Sep 17 00:00:00 2001 -From: Irit goihman <igoihman@redhat.com> -Date: Sun, 7 Apr 2019 14:03:55 +0300 -Subject: [PATCH] [vdsm] fix plugin docstring capitalisation - ---- - sos/plugins/vdsm.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sos/plugins/vdsm.py b/sos/plugins/vdsm.py -index c648abbf9..4549c372e 100644 ---- a/sos/plugins/vdsm.py -+++ b/sos/plugins/vdsm.py -@@ -45,7 +45,7 @@ - - - class Vdsm(Plugin, RedHatPlugin): -- """vdsm Plugin""" -+ """vdsm plugin""" - - packages = ( - 'vdsm', -From 208a1d9622dfa13d923882793cd19e9e6cf1e488 Mon Sep 17 00:00:00 2001 -From: Irit goihman <igoihman@redhat.com> -Date: Sun, 7 Apr 2019 14:04:48 +0300 -Subject: [PATCH] [vdsm] use metadata_read_only=1 for LVM2 commands - ---- - sos/plugins/vdsm.py | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/sos/plugins/vdsm.py b/sos/plugins/vdsm.py -index 4549c372e..913d49a53 100644 ---- a/sos/plugins/vdsm.py -+++ b/sos/plugins/vdsm.py -@@ -22,6 +22,10 @@ - # there is a stuck lvm command. - # locking_type=0 - # -+# To prevent modifications to volume group metadata (for e.g. due to a -+# automatically detected inconsistency), metadata_read_only is set to 1. -+# metadata_read_only=1 -+# - # use_lvmetad is set to 0 in order not to show cached, old lvm metadata. - # use_lvmetad=0 - # -@@ -31,6 +35,7 @@ - LVM_CONFIG = """ - global { - locking_type=0 -+ metadata_read_only=1 - use_lvmetad=0 - } - devices { -From 97c21901ddb6f7d5e3169d1777983f784b103bc4 Mon Sep 17 00:00:00 2001 -From: Irit goihman <igoihman@redhat.com> -Date: Sun, 7 Apr 2019 14:05:30 +0300 -Subject: [PATCH] [vdsm] drop explicit size limiting - ---- - sos/plugins/vdsm.py | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/sos/plugins/vdsm.py b/sos/plugins/vdsm.py -index 913d49a53..2dc4b6bea 100644 ---- a/sos/plugins/vdsm.py -+++ b/sos/plugins/vdsm.py -@@ -72,9 +72,7 @@ def setup(self): - '/etc/vdsm/*' - ]) - -- limit = self.get_option('log_size') -- -- self.add_copy_spec('/var/log/vdsm/*', sizelimit=limit) -+ self.add_copy_spec('/var/log/vdsm/*') - - self._add_vdsm_forbidden_paths() - self.add_copy_spec([ -From cfaf930e58f4996919d0da6c356135cfce26dacb Mon Sep 17 00:00:00 2001 -From: Irit goihman <igoihman@redhat.com> -Date: Sun, 7 Apr 2019 14:13:59 +0300 -Subject: [PATCH] [vdsm] change filter - ---- - sos/plugins/vdsm.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sos/plugins/vdsm.py b/sos/plugins/vdsm.py -index 2dc4b6bea..ab5c6130b 100644 ---- a/sos/plugins/vdsm.py -+++ b/sos/plugins/vdsm.py -@@ -43,7 +43,7 @@ - ignore_suspended_devices=1 - write_cache_state=0 - disable_after_error_count=3 -- filter=["a|^/dev/mapper/.*|", "r|.*|"] -+ filter=["a|^/dev/disk/by-id/dm-uuid-mpath-|", "r|.+|"] - } - """ - LVM_CONFIG = re.sub(r"\s+", " ", LVM_CONFIG).strip() -From 2ebc04da53dc871c8dd5243567afa4f8592dca29 Mon Sep 17 00:00:00 2001 -From: Irit goihman <igoihman@redhat.com> -Date: Sun, 7 Apr 2019 14:14:32 +0300 -Subject: [PATCH] [vdsm] capture supervdsmd status - ---- - sos/plugins/vdsm.py | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sos/plugins/vdsm.py b/sos/plugins/vdsm.py -index ab5c6130b..ae9c17c96 100644 ---- a/sos/plugins/vdsm.py -+++ b/sos/plugins/vdsm.py -@@ -65,6 +65,7 @@ def setup(self): - self.add_forbidden_path('/etc/pki/libvirt/private/*') - - self.add_cmd_output('service vdsmd status') -+ self.add_cmd_output('service supervdsmd status') - - self.add_copy_spec([ - '/tmp/vds_installer*', diff --git a/SOURCES/sos-bz1711305-katello-qpid-certificate.patch b/SOURCES/sos-bz1711305-katello-qpid-certificate.patch deleted file mode 100644 index 3ca559a..0000000 --- a/SOURCES/sos-bz1711305-katello-qpid-certificate.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 166f712eb447f54f0e2c5396ea25f5bc11e3f519 Mon Sep 17 00:00:00 2001 -From: Pavel Moravec <pmoravec@redhat.com> -Date: Fri, 17 May 2019 15:55:05 +0200 -Subject: [PATCH] [katello] support both locations of qpid SSL certs - -Newer katello versions deploy certs for qpid to -/etc/pki/pulp/qpid/client.crt certs instead of -/etc/pki/katello/qpid_client_striped.crt . - -Sosreport should use either of the location that exists, to successfully -run few qpid-stat commands. - -Resolves: #1680 - -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> ---- - sos/plugins/katello.py | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/sos/plugins/katello.py b/sos/plugins/katello.py -index 0794fb4c..1ea52da8 100644 ---- a/sos/plugins/katello.py -+++ b/sos/plugins/katello.py -@@ -10,6 +10,7 @@ - - from sos.plugins import Plugin, RedHatPlugin - from pipes import quote -+import os.path - - - class Katello(Plugin, RedHatPlugin): -@@ -24,7 +25,12 @@ class Katello(Plugin, RedHatPlugin): - "/var/log/httpd/katello-reverse-proxy_error_ssl.log*" - ]) - -- cert = "/etc/pki/katello/qpid_client_striped.crt" -+ # certificate file location relies on katello version, it can be either -+ # /etc/pki/katello/qpid_client_striped.crt (for older versions) or -+ # /etc/pki/pulp/qpid/client.crt (for newer versions) -+ cert = "/etc/pki/pulp/qpid/client.crt" -+ if not os.path.isfile(cert): -+ cert = "/etc/pki/katello/qpid_client_striped.crt" - self.add_cmd_output([ - "qpid-stat -%s --ssl-certificate=%s -b amqps://localhost:5671" % - (opt, cert) for opt in "quc" --- -2.17.2 - diff --git a/SOURCES/sos-bz1736422-cmd-poll-performance.patch b/SOURCES/sos-bz1736422-cmd-poll-performance.patch deleted file mode 100644 index 7ab2e4c..0000000 --- a/SOURCES/sos-bz1736422-cmd-poll-performance.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 3253179b207c2616ce238e2bb765635fe59e6dd2 Mon Sep 17 00:00:00 2001 -From: Kazuhito Hagio <k-hagio@ab.jp.nec.com> -Date: Thu, 18 Jul 2019 09:58:56 -0400 -Subject: [PATCH] [utilities] Fix high CPU usage and slow command collection - -commit fc6721ac83c2 ("[Plugin] Terminate running commands when a plugin -exceeds timeout") introduced a polling method to sos_get_command_output() -but it is busy wait, and seems to increase the CPU usage and slow down -AsyncReader significantly. - -As a result, a command that outputs much data like journalctl takes -longer time, and the plugin times out. - -Inserting a sleep is a possible fix for this. - -Resolves: #1732 - -Signed-off-by: Kazuhito Hagio <k-hagio@ab.jp.nec.com> -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/utilities.py | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/sos/utilities.py b/sos/utilities.py -index 1737478f..c3d6ac20 100644 ---- a/sos/utilities.py -+++ b/sos/utilities.py -@@ -18,6 +18,7 @@ import errno - import shlex - import glob - import threading -+import time - - from contextlib import closing - from collections import deque -@@ -158,6 +159,7 @@ def sos_get_command_output(command, timeout=300, stderr=False, - if poller(): - p.terminate() - raise SoSTimeoutError -+ time.sleep(0.01) - stdout = reader.get_contents() - while p.poll() is None: - pass -@@ -248,7 +250,7 @@ class AsyncReader(threading.Thread): - # block until command completes or timesout (separate from the plugin - # hitting a timeout) - while self.running: -- pass -+ time.sleep(0.01) - if not self.binary: - return ''.join(ln.decode('utf-8', 'ignore') for ln in self.deque) - else: --- -2.21.0 - diff --git a/SOURCES/sos-bz1736424-timeouted-plugin-stop-further-collection.patch b/SOURCES/sos-bz1736424-timeouted-plugin-stop-further-collection.patch deleted file mode 100644 index 19da03a..0000000 --- a/SOURCES/sos-bz1736424-timeouted-plugin-stop-further-collection.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 8ad1f5977adfa11880aae4144d554ad1cc99ad63 Mon Sep 17 00:00:00 2001 -From: Pavel Moravec <pmoravec@redhat.com> -Date: Fri, 26 Jul 2019 11:44:53 +0200 -Subject: [PATCH] [plugins] Stop plugin execution after timeout hit - -When a plugin timeouts, it must stop collecting further data. Otherwise -a race issues with archive.finalize() can happen. - -So any data collection must be skipped if _timeout_hit is True. - -Resolves: #1736 - -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> ---- - sos/plugins/__init__.py | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py -index e5bb39ee..aa268d84 100644 ---- a/sos/plugins/__init__.py -+++ b/sos/plugins/__init__.py -@@ -652,6 +652,9 @@ class Plugin(object): - everything below it is recursively copied. A list of copied files are - saved for use later in preparing a report. - ''' -+ if self._timeout_hit: -+ return -+ - if self._is_forbidden_path(srcpath): - self._log_debug("skipping forbidden path '%s'" % srcpath) - return '' -@@ -852,6 +855,9 @@ class Plugin(object): - def get_command_output(self, prog, timeout=300, stderr=True, - chroot=True, runat=None, env=None, - binary=False, sizelimit=None): -+ if self._timeout_hit: -+ return -+ - if chroot or self.commons['cmdlineopts'].chroot == 'always': - root = self.sysroot - else: -@@ -1012,6 +1018,9 @@ class Plugin(object): - """Execute a command and save the output to a file for inclusion in the - report. - """ -+ if self._timeout_hit: -+ return -+ - start = time() - - result = self.get_command_output(exe, timeout=timeout, stderr=stderr, -@@ -1201,6 +1210,8 @@ class Plugin(object): - - def _collect_strings(self): - for string, file_name in self.copy_strings: -+ if self._timeout_hit: -+ return - content = '' - if string: - content = string.splitlines()[0] --- -2.21.0 - diff --git a/SOURCES/sos-bz1744555-ovn-plugins-containerized.patch b/SOURCES/sos-bz1744555-ovn-plugins-containerized.patch new file mode 100644 index 0000000..7b3dbfe --- /dev/null +++ b/SOURCES/sos-bz1744555-ovn-plugins-containerized.patch @@ -0,0 +1,264 @@ +From cc6374914a47eb3777c5b8306506df43522a31e0 Mon Sep 17 00:00:00 2001 +From: Daniel Alvarez <dalvarez@redhat.com> +Date: Thu, 18 Jul 2019 14:08:27 +0200 +Subject: [PATCH 1/4] [ovn_central] add additional show commands + +This patch is adding 'show' commands for both OVN +NorthBound and SouthBound databases. + +Signed-off-by: Daniel Alvarez <dalvarez@redhat.com> +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/ovn_central.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sos/plugins/ovn_central.py b/sos/plugins/ovn_central.py +index e0585687..2d252625 100644 +--- a/sos/plugins/ovn_central.py ++++ b/sos/plugins/ovn_central.py +@@ -57,6 +57,8 @@ class OVNCentral(Plugin): + + # Some user-friendly versions of DB output + cmds = [ ++ 'ovn-nbctl show', ++ 'ovn-sbctl show', + 'ovn-sbctl lflow-list', + 'ovn-nbctl get-ssl', + 'ovn-nbctl get-connection', +-- +2.21.0 + + +From 5fd4e850ad9a6636d0fb206954e8ab016584974d Mon Sep 17 00:00:00 2001 +From: Daniel Alvarez <dalvarez@redhat.com> +Date: Wed, 11 Sep 2019 16:19:15 +0100 +Subject: [PATCH 2/4] [ovn_host] fix Open_vSwitch table name + +Signed-off-by: Daniel Alvarez <dalvarez@redhat.com> +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/ovn_host.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sos/plugins/ovn_host.py b/sos/plugins/ovn_host.py +index 54251627..ba35d87e 100644 +--- a/sos/plugins/ovn_host.py ++++ b/sos/plugins/ovn_host.py +@@ -35,7 +35,7 @@ class OVNHost(Plugin): + self.add_cmd_output([ + 'ovs-ofctl -O OpenFlow13 dump-flows br-int', + 'ovs-vsctl list-br', +- 'ovs-vsctl list OpenVswitch', ++ 'ovs-vsctl list Open_vSwitch', + ]) + + self.add_journal(units="ovn-controller") +-- +2.21.0 + + +From 3c842046e9c4c5b371566347f51e5e242daf4f8d Mon Sep 17 00:00:00 2001 +From: Daniel Alvarez <dalvarez@redhat.com> +Date: Tue, 23 Jul 2019 12:44:07 +0200 +Subject: [PATCH 3/4] [ovn_central] Add support to containerized setups + +This patch is adding support in ovn_central plugin to containerized +setups. + +Now it's detecting if the OVN central services are running in +container and execute the relevant commands inside it. The support +covers both podman and docker runtimes. + +Signed-off-by: Daniel Alvarez <dalvarez@redhat.com> +--- + sos/plugins/ovn_central.py | 94 ++++++++++++++++++++++++++++---------- + 1 file changed, 69 insertions(+), 25 deletions(-) + +diff --git a/sos/plugins/ovn_central.py b/sos/plugins/ovn_central.py +index 2d252625..a9fcdf33 100644 +--- a/sos/plugins/ovn_central.py ++++ b/sos/plugins/ovn_central.py +@@ -19,30 +19,64 @@ class OVNCentral(Plugin): + """ + plugin_name = "ovn_central" + profiles = ('network', 'virt') +- +- def add_database_output(self, filename, cmds, ovn_cmd, skip=[]): ++ _container_runtime = None ++ _container_name = None ++ ++ def get_tables_from_schema(self, filename, skip=[]): ++ if self._container_name: ++ cmd = "%s exec %s cat %s" % ( ++ self._container_runtime, self._container_name, filename) ++ res = self.get_command_output(cmd) ++ if res['status'] != 0: ++ self._log_error("Could not retrieve DB schema file from " ++ "container %s" % self._container_name) ++ return ++ try: ++ db = json.loads(res['output']) ++ except Exception: ++ self._log_error("Cannot parse JSON file %s" % filename) ++ return ++ else: ++ try: ++ with open(filename, 'r') as f: ++ try: ++ db = json.load(f) ++ except Exception: ++ self._log_error( ++ "Cannot parse JSON file %s" % filename) ++ return ++ except IOError as ex: ++ self._log_error( ++ "Could not open DB schema file %s: %s" % (filename, ex)) ++ return + try: +- with open(filename, 'r') as f: +- try: +- db = json.load(f) +- except Exception: +- # If json can't be parsed, then exit early +- self._log_error("Cannot parse JSON file %s" % filename) +- return +- try: +- for table in six.iterkeys(db['tables']): +- if table not in skip: +- cmds.append('%s list %s' % (ovn_cmd, table)) +- except AttributeError: +- self._log_error("DB schema %s has no 'tables' key" % +- filename) +- return +- except IOError as ex: +- self._log_error("Could not open DB schema file %s: %s" % (filename, +- ex)) +- return ++ return [table for table in six.iterkeys( ++ db['tables']) if table not in skip] ++ except AttributeError: ++ self._log_error("DB schema %s has no 'tables' key" % filename) ++ ++ def add_database_output(self, tables, cmds, ovn_cmd): ++ for table in tables: ++ cmds.append('%s list %s' % (ovn_cmd, table)) ++ ++ def running_in_container(self): ++ for runtime in ["podman", "docker"]: ++ container_status = self.get_command_output(runtime + " ps") ++ if container_status['status'] == 0: ++ for line in container_status['output'].splitlines(): ++ if "ovn-dbs-bundle" in line: ++ self._container_name = line.split()[-1] ++ self._container_runtime = runtime ++ return True ++ return False ++ ++ def check_enabled(self): ++ return (self.running_in_container() or ++ super(OVNCentral, self).check_enabled()) + + def setup(self): ++ containerized = self.running_in_container() ++ + ovs_rundir = os.environ.get('OVS_RUNDIR') + for pidfile in ['ovnnb_db.pid', 'ovnsb_db.pid', 'ovn-northd.pid']: + self.add_copy_spec([ +@@ -68,10 +102,20 @@ class OVNCentral(Plugin): + + schema_dir = '/usr/share/openvswitch' + +- self.add_database_output(os.path.join(schema_dir, 'ovn-nb.ovsschema'), +- cmds, 'ovn-nbctl') +- self.add_database_output(os.path.join(schema_dir, 'ovn-sb.ovsschema'), +- cmds, 'ovn-sbctl', ['Logical_Flow']) ++ nb_tables = self.get_tables_from_schema(os.path.join( ++ schema_dir, 'ovn-nb.ovsschema')) ++ sb_tables = self.get_tables_from_schema(os.path.join( ++ schema_dir, 'ovn-sb.ovsschema'), ['Logical_Flow']) ++ ++ self.add_database_output(nb_tables, cmds, 'ovn-nbctl') ++ self.add_database_output(sb_tables, cmds, 'ovn-sbctl') ++ ++ # If OVN is containerized, we need to run the above commands inside ++ # the container. ++ if containerized: ++ cmds = ['%s exec %s %s' % (self._container_runtime, ++ self._container_name, ++ cmd) for cmd in cmds] + + self.add_cmd_output(cmds) + +-- +2.21.0 + + +From a895bf4096f1dbd71c9dbd4defb47783f4ef9840 Mon Sep 17 00:00:00 2001 +From: Daniel Alvarez <dalvarez@redhat.com> +Date: Thu, 25 Jul 2019 11:42:16 +0200 +Subject: [PATCH 4/4] [ovn_host] Add support for containerized setups + +Prior to this patch, ovn_host was disabled on containerized +setups due to the fact that ovn-controller package is not +installed in the host. + +This patch fixes it by checking if the ovn-controller process +is running. + +Resolves: #1767 + +Signed-off-by: Daniel Alvarez <dalvarez@redhat.com> +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/ovn_host.py | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/sos/plugins/ovn_host.py b/sos/plugins/ovn_host.py +index ba35d87e..5225f010 100644 +--- a/sos/plugins/ovn_host.py ++++ b/sos/plugins/ovn_host.py +@@ -12,6 +12,15 @@ import os + from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin + + ++pidfile = 'ovn-controller.pid' ++pid_paths = [ ++ '/var/lib/openvswitch/ovn', ++ '/usr/local/var/run/openvswitch', ++ '/var/run/openvswitch', ++ '/run/openvswitch' ++] ++ ++ + class OVNHost(Plugin): + """ OVN Controller + """ +@@ -19,13 +28,6 @@ class OVNHost(Plugin): + profiles = ('network', 'virt') + + def setup(self): +- pidfile = 'ovn-controller.pid' +- pid_paths = [ +- '/var/lib/openvswitch/ovn', +- '/usr/local/var/run/openvswitch', +- '/var/run/openvswitch', +- '/run/openvswitch' +- ] + if os.environ.get('OVS_RUNDIR'): + pid_paths.append(os.environ.get('OVS_RUNDIR')) + self.add_copy_spec([os.path.join(pp, pidfile) for pp in pid_paths]) +@@ -40,6 +42,11 @@ class OVNHost(Plugin): + + self.add_journal(units="ovn-controller") + ++ def check_enabled(self): ++ return (any([os.path.isfile( ++ os.path.join(pp, pidfile)) for pp in pid_paths]) or ++ super(OVNHost, self).check_enabled()) ++ + + class RedHatOVNHost(OVNHost, RedHatPlugin): + +-- +2.21.0 + diff --git a/SOURCES/sos-bz1751576-gluster-deployment-cleanup-logs.patch b/SOURCES/sos-bz1751576-gluster-deployment-cleanup-logs.patch deleted file mode 100644 index e0337b2..0000000 --- a/SOURCES/sos-bz1751576-gluster-deployment-cleanup-logs.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 8203bdeb77ac0d3f32f1a88304b9a34de66ae7b6 Mon Sep 17 00:00:00 2001 -From: Gobinda Das <godas@redhat.com> -Date: Sat, 10 Aug 2019 13:36:36 +0530 -Subject: [PATCH] [ovirt_hosted_engine] Add gluster deployment and cleanup log - -Resolves: #1748 - -Signed-off-by: Gobinda Das <godas@redhat.com> -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> ---- - sos/plugins/ovirt_hosted_engine.py | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/sos/plugins/ovirt_hosted_engine.py b/sos/plugins/ovirt_hosted_engine.py -index 3d1bfe36c..fefc02947 100644 ---- a/sos/plugins/ovirt_hosted_engine.py -+++ b/sos/plugins/ovirt_hosted_engine.py -@@ -48,6 +48,12 @@ def setup(self): - '/var/log/ovirt-hosted-engine-ha/agent.log', - '/var/log/ovirt-hosted-engine-ha/broker.log', - ]) -+ -+ # Add gluster deployment and cleanup log -+ self.add_copy_spec([ -+ '/var/log/cockpit/ovirt-dashboard' -+ ]) -+ - # Add older ovirt-hosted-engine-ha log files only if requested - if self.get_option('all_logs'): - self.add_copy_spec(self.HA_LOG_GLOB) diff --git a/SOURCES/sos-bz1751577-vdsm-fix-shell-commands.patch b/SOURCES/sos-bz1751577-vdsm-fix-shell-commands.patch deleted file mode 100644 index c0949fa..0000000 --- a/SOURCES/sos-bz1751577-vdsm-fix-shell-commands.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0c83c8245ffab2ff3f568078651553f59ef475bb Mon Sep 17 00:00:00 2001 -From: Martin Perina <mperina@redhat.com> -Date: Wed, 21 Aug 2019 11:17:44 +0200 -Subject: [PATCH] [vdsm]: Fix executing shell commands - -During review process of [1] it was suggested to replace '/bin/sh' with -just 'sh', but unfortunately this change caused an error to not include -information about VDSM mount points as described in [2]. This fix -restores previous state and add full path to shell executions. - -[1] https://github.com/sosreport/sos/pull/1205 -[2] https://bugzilla.redhat.com/1743304 - -Resolves: #1761 - -Signed-off-by: Martin Perina <mperina@redhat.com> -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> ---- - sos/plugins/vdsm.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sos/plugins/vdsm.py b/sos/plugins/vdsm.py -index 35eec5093..c4e2af5f6 100644 ---- a/sos/plugins/vdsm.py -+++ b/sos/plugins/vdsm.py -@@ -93,8 +93,8 @@ def setup(self): - ]) - self.add_cmd_output([ - "ls -ldZ /etc/vdsm", -- "su vdsm -s sh -c 'tree -l /rhev/data-center'", -- "su vdsm -s sh -c 'ls -lR /rhev/data-center'" -+ "su vdsm -s /bin/sh -c 'tree -l /rhev/data-center'", -+ "su vdsm -s /bin/sh -c 'ls -lR /rhev/data-center'" - ]) - self.add_cmd_output([ - "lvm vgs -v -o +tags --config \'%s\'" % LVM_CONFIG, diff --git a/SOURCES/sos-bz1751578-ovn-plugins-containerized.patch b/SOURCES/sos-bz1751578-ovn-plugins-containerized.patch deleted file mode 100644 index 7b3dbfe..0000000 --- a/SOURCES/sos-bz1751578-ovn-plugins-containerized.patch +++ /dev/null @@ -1,264 +0,0 @@ -From cc6374914a47eb3777c5b8306506df43522a31e0 Mon Sep 17 00:00:00 2001 -From: Daniel Alvarez <dalvarez@redhat.com> -Date: Thu, 18 Jul 2019 14:08:27 +0200 -Subject: [PATCH 1/4] [ovn_central] add additional show commands - -This patch is adding 'show' commands for both OVN -NorthBound and SouthBound databases. - -Signed-off-by: Daniel Alvarez <dalvarez@redhat.com> -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/ovn_central.py | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/sos/plugins/ovn_central.py b/sos/plugins/ovn_central.py -index e0585687..2d252625 100644 ---- a/sos/plugins/ovn_central.py -+++ b/sos/plugins/ovn_central.py -@@ -57,6 +57,8 @@ class OVNCentral(Plugin): - - # Some user-friendly versions of DB output - cmds = [ -+ 'ovn-nbctl show', -+ 'ovn-sbctl show', - 'ovn-sbctl lflow-list', - 'ovn-nbctl get-ssl', - 'ovn-nbctl get-connection', --- -2.21.0 - - -From 5fd4e850ad9a6636d0fb206954e8ab016584974d Mon Sep 17 00:00:00 2001 -From: Daniel Alvarez <dalvarez@redhat.com> -Date: Wed, 11 Sep 2019 16:19:15 +0100 -Subject: [PATCH 2/4] [ovn_host] fix Open_vSwitch table name - -Signed-off-by: Daniel Alvarez <dalvarez@redhat.com> -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/ovn_host.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sos/plugins/ovn_host.py b/sos/plugins/ovn_host.py -index 54251627..ba35d87e 100644 ---- a/sos/plugins/ovn_host.py -+++ b/sos/plugins/ovn_host.py -@@ -35,7 +35,7 @@ class OVNHost(Plugin): - self.add_cmd_output([ - 'ovs-ofctl -O OpenFlow13 dump-flows br-int', - 'ovs-vsctl list-br', -- 'ovs-vsctl list OpenVswitch', -+ 'ovs-vsctl list Open_vSwitch', - ]) - - self.add_journal(units="ovn-controller") --- -2.21.0 - - -From 3c842046e9c4c5b371566347f51e5e242daf4f8d Mon Sep 17 00:00:00 2001 -From: Daniel Alvarez <dalvarez@redhat.com> -Date: Tue, 23 Jul 2019 12:44:07 +0200 -Subject: [PATCH 3/4] [ovn_central] Add support to containerized setups - -This patch is adding support in ovn_central plugin to containerized -setups. - -Now it's detecting if the OVN central services are running in -container and execute the relevant commands inside it. The support -covers both podman and docker runtimes. - -Signed-off-by: Daniel Alvarez <dalvarez@redhat.com> ---- - sos/plugins/ovn_central.py | 94 ++++++++++++++++++++++++++++---------- - 1 file changed, 69 insertions(+), 25 deletions(-) - -diff --git a/sos/plugins/ovn_central.py b/sos/plugins/ovn_central.py -index 2d252625..a9fcdf33 100644 ---- a/sos/plugins/ovn_central.py -+++ b/sos/plugins/ovn_central.py -@@ -19,30 +19,64 @@ class OVNCentral(Plugin): - """ - plugin_name = "ovn_central" - profiles = ('network', 'virt') -- -- def add_database_output(self, filename, cmds, ovn_cmd, skip=[]): -+ _container_runtime = None -+ _container_name = None -+ -+ def get_tables_from_schema(self, filename, skip=[]): -+ if self._container_name: -+ cmd = "%s exec %s cat %s" % ( -+ self._container_runtime, self._container_name, filename) -+ res = self.get_command_output(cmd) -+ if res['status'] != 0: -+ self._log_error("Could not retrieve DB schema file from " -+ "container %s" % self._container_name) -+ return -+ try: -+ db = json.loads(res['output']) -+ except Exception: -+ self._log_error("Cannot parse JSON file %s" % filename) -+ return -+ else: -+ try: -+ with open(filename, 'r') as f: -+ try: -+ db = json.load(f) -+ except Exception: -+ self._log_error( -+ "Cannot parse JSON file %s" % filename) -+ return -+ except IOError as ex: -+ self._log_error( -+ "Could not open DB schema file %s: %s" % (filename, ex)) -+ return - try: -- with open(filename, 'r') as f: -- try: -- db = json.load(f) -- except Exception: -- # If json can't be parsed, then exit early -- self._log_error("Cannot parse JSON file %s" % filename) -- return -- try: -- for table in six.iterkeys(db['tables']): -- if table not in skip: -- cmds.append('%s list %s' % (ovn_cmd, table)) -- except AttributeError: -- self._log_error("DB schema %s has no 'tables' key" % -- filename) -- return -- except IOError as ex: -- self._log_error("Could not open DB schema file %s: %s" % (filename, -- ex)) -- return -+ return [table for table in six.iterkeys( -+ db['tables']) if table not in skip] -+ except AttributeError: -+ self._log_error("DB schema %s has no 'tables' key" % filename) -+ -+ def add_database_output(self, tables, cmds, ovn_cmd): -+ for table in tables: -+ cmds.append('%s list %s' % (ovn_cmd, table)) -+ -+ def running_in_container(self): -+ for runtime in ["podman", "docker"]: -+ container_status = self.get_command_output(runtime + " ps") -+ if container_status['status'] == 0: -+ for line in container_status['output'].splitlines(): -+ if "ovn-dbs-bundle" in line: -+ self._container_name = line.split()[-1] -+ self._container_runtime = runtime -+ return True -+ return False -+ -+ def check_enabled(self): -+ return (self.running_in_container() or -+ super(OVNCentral, self).check_enabled()) - - def setup(self): -+ containerized = self.running_in_container() -+ - ovs_rundir = os.environ.get('OVS_RUNDIR') - for pidfile in ['ovnnb_db.pid', 'ovnsb_db.pid', 'ovn-northd.pid']: - self.add_copy_spec([ -@@ -68,10 +102,20 @@ class OVNCentral(Plugin): - - schema_dir = '/usr/share/openvswitch' - -- self.add_database_output(os.path.join(schema_dir, 'ovn-nb.ovsschema'), -- cmds, 'ovn-nbctl') -- self.add_database_output(os.path.join(schema_dir, 'ovn-sb.ovsschema'), -- cmds, 'ovn-sbctl', ['Logical_Flow']) -+ nb_tables = self.get_tables_from_schema(os.path.join( -+ schema_dir, 'ovn-nb.ovsschema')) -+ sb_tables = self.get_tables_from_schema(os.path.join( -+ schema_dir, 'ovn-sb.ovsschema'), ['Logical_Flow']) -+ -+ self.add_database_output(nb_tables, cmds, 'ovn-nbctl') -+ self.add_database_output(sb_tables, cmds, 'ovn-sbctl') -+ -+ # If OVN is containerized, we need to run the above commands inside -+ # the container. -+ if containerized: -+ cmds = ['%s exec %s %s' % (self._container_runtime, -+ self._container_name, -+ cmd) for cmd in cmds] - - self.add_cmd_output(cmds) - --- -2.21.0 - - -From a895bf4096f1dbd71c9dbd4defb47783f4ef9840 Mon Sep 17 00:00:00 2001 -From: Daniel Alvarez <dalvarez@redhat.com> -Date: Thu, 25 Jul 2019 11:42:16 +0200 -Subject: [PATCH 4/4] [ovn_host] Add support for containerized setups - -Prior to this patch, ovn_host was disabled on containerized -setups due to the fact that ovn-controller package is not -installed in the host. - -This patch fixes it by checking if the ovn-controller process -is running. - -Resolves: #1767 - -Signed-off-by: Daniel Alvarez <dalvarez@redhat.com> -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/ovn_host.py | 21 ++++++++++++++------- - 1 file changed, 14 insertions(+), 7 deletions(-) - -diff --git a/sos/plugins/ovn_host.py b/sos/plugins/ovn_host.py -index ba35d87e..5225f010 100644 ---- a/sos/plugins/ovn_host.py -+++ b/sos/plugins/ovn_host.py -@@ -12,6 +12,15 @@ import os - from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin - - -+pidfile = 'ovn-controller.pid' -+pid_paths = [ -+ '/var/lib/openvswitch/ovn', -+ '/usr/local/var/run/openvswitch', -+ '/var/run/openvswitch', -+ '/run/openvswitch' -+] -+ -+ - class OVNHost(Plugin): - """ OVN Controller - """ -@@ -19,13 +28,6 @@ class OVNHost(Plugin): - profiles = ('network', 'virt') - - def setup(self): -- pidfile = 'ovn-controller.pid' -- pid_paths = [ -- '/var/lib/openvswitch/ovn', -- '/usr/local/var/run/openvswitch', -- '/var/run/openvswitch', -- '/run/openvswitch' -- ] - if os.environ.get('OVS_RUNDIR'): - pid_paths.append(os.environ.get('OVS_RUNDIR')) - self.add_copy_spec([os.path.join(pp, pidfile) for pp in pid_paths]) -@@ -40,6 +42,11 @@ class OVNHost(Plugin): - - self.add_journal(units="ovn-controller") - -+ def check_enabled(self): -+ return (any([os.path.isfile( -+ os.path.join(pp, pidfile)) for pp in pid_paths]) or -+ super(OVNHost, self).check_enabled()) -+ - - class RedHatOVNHost(OVNHost, RedHatPlugin): - --- -2.21.0 - diff --git a/SOURCES/sos-bz1757662-kernel-trace-disabled.patch b/SOURCES/sos-bz1757662-kernel-trace-disabled.patch new file mode 100644 index 0000000..6ff44d6 --- /dev/null +++ b/SOURCES/sos-bz1757662-kernel-trace-disabled.patch @@ -0,0 +1,81 @@ +From 55949fb88c492eec542c69157a8763ddb3555345 Mon Sep 17 00:00:00 2001 +From: MIZUTA Takeshi <mizuta.takeshi@fujitsu.com> +Date: Thu, 6 Jun 2019 18:42:40 +0900 +Subject: [PATCH] [plugins] Change forbidden_path from partial-match to + exact-match + +forbidden_path is evaluated on partial-match. +However, it will be correct to evaluate on exact-match. + +Closes: #1692 +Resolves: #1695 + +Signed-off-by: MIZUTA Takeshi <mizuta.takeshi@fujitsu.com> +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/__init__.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py +index 56af847a..41f4f58c 100644 +--- a/sos/plugins/__init__.py ++++ b/sos/plugins/__init__.py +@@ -64,7 +64,7 @@ def _mangle_command(command, name_max): + + + def _path_in_path_list(path, path_list): +- return any(p in path for p in path_list) ++ return any(p == path for p in path_list) + + + def _node_type(st): +-- +2.21.0 + +From d2d5b9da6d4af7ead8a47468db0bbfcc8fb2b5bf Mon Sep 17 00:00:00 2001 +From: Pavel Moravec <pmoravec@redhat.com> +Date: Thu, 26 Sep 2019 10:50:18 +0200 +Subject: [PATCH] [kernel] Don't collect trace file by default + +Updates the plugin to don't collect trace file by default. Collecting +trace file may take a lot of time, so trace file is not collected +by default, and use the new plug-in option when collecting. + +Original author: MIZUTA Takeshi <mizuta.takeshi@fujitsu.com> + +Closes: #1688 +Resolves: #1800 + +Signed-off-by: Pavel Moravec <pmoravec@redhat.com> +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/kernel.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py +index bf3c3dea..b498f55e 100644 +--- a/sos/plugins/kernel.py ++++ b/sos/plugins/kernel.py +@@ -23,7 +23,8 @@ class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): + sys_module = '/sys/module' + + option_list = [ +- ("with-timer", "gather /proc/timer* statistics", "slow", False) ++ ("with-timer", "gather /proc/timer* statistics", "slow", False), ++ ("trace", "gather /sys/kernel/debug/tracing/trace file", "slow", False) + ] + + def get_bpftool_prog_ids(self, prog_file): +@@ -139,6 +139,9 @@ class Kernel(Plugin, RedHatPlugin, Debia + # and may also cause softlockups + self.add_copy_spec("/proc/timer*") + ++ if not self.get_option("trace"): ++ self.add_forbidden_path("/sys/kernel/debug/tracing/trace") ++ + # collect list of eBPF programs and maps and their dumps + prog_file = self.get_cmd_output_now("bpftool -j prog list") + for prog_id in self.get_bpftool_prog_ids(prog_file): +-- +2.21.0 + diff --git a/SOURCES/sos-bz1760737-kernel-trace-disabled.patch b/SOURCES/sos-bz1760737-kernel-trace-disabled.patch deleted file mode 100644 index 6ff44d6..0000000 --- a/SOURCES/sos-bz1760737-kernel-trace-disabled.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 55949fb88c492eec542c69157a8763ddb3555345 Mon Sep 17 00:00:00 2001 -From: MIZUTA Takeshi <mizuta.takeshi@fujitsu.com> -Date: Thu, 6 Jun 2019 18:42:40 +0900 -Subject: [PATCH] [plugins] Change forbidden_path from partial-match to - exact-match - -forbidden_path is evaluated on partial-match. -However, it will be correct to evaluate on exact-match. - -Closes: #1692 -Resolves: #1695 - -Signed-off-by: MIZUTA Takeshi <mizuta.takeshi@fujitsu.com> -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/__init__.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py -index 56af847a..41f4f58c 100644 ---- a/sos/plugins/__init__.py -+++ b/sos/plugins/__init__.py -@@ -64,7 +64,7 @@ def _mangle_command(command, name_max): - - - def _path_in_path_list(path, path_list): -- return any(p in path for p in path_list) -+ return any(p == path for p in path_list) - - - def _node_type(st): --- -2.21.0 - -From d2d5b9da6d4af7ead8a47468db0bbfcc8fb2b5bf Mon Sep 17 00:00:00 2001 -From: Pavel Moravec <pmoravec@redhat.com> -Date: Thu, 26 Sep 2019 10:50:18 +0200 -Subject: [PATCH] [kernel] Don't collect trace file by default - -Updates the plugin to don't collect trace file by default. Collecting -trace file may take a lot of time, so trace file is not collected -by default, and use the new plug-in option when collecting. - -Original author: MIZUTA Takeshi <mizuta.takeshi@fujitsu.com> - -Closes: #1688 -Resolves: #1800 - -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/kernel.py | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py -index bf3c3dea..b498f55e 100644 ---- a/sos/plugins/kernel.py -+++ b/sos/plugins/kernel.py -@@ -23,7 +23,8 @@ class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): - sys_module = '/sys/module' - - option_list = [ -- ("with-timer", "gather /proc/timer* statistics", "slow", False) -+ ("with-timer", "gather /proc/timer* statistics", "slow", False), -+ ("trace", "gather /sys/kernel/debug/tracing/trace file", "slow", False) - ] - - def get_bpftool_prog_ids(self, prog_file): -@@ -139,6 +139,9 @@ class Kernel(Plugin, RedHatPlugin, Debia - # and may also cause softlockups - self.add_copy_spec("/proc/timer*") - -+ if not self.get_option("trace"): -+ self.add_forbidden_path("/sys/kernel/debug/tracing/trace") -+ - # collect list of eBPF programs and maps and their dumps - prog_file = self.get_cmd_output_now("bpftool -j prog list") - for prog_id in self.get_bpftool_prog_ids(prog_file): --- -2.21.0 - diff --git a/SOURCES/sos-bz1767445-interim-sysroot-forbidden-paths.patch b/SOURCES/sos-bz1767445-interim-sysroot-forbidden-paths.patch new file mode 100644 index 0000000..e75653a --- /dev/null +++ b/SOURCES/sos-bz1767445-interim-sysroot-forbidden-paths.patch @@ -0,0 +1,447 @@ +From 9a0ab16793a8388b2c3d3909fd3a087c5b6296d4 Mon Sep 17 00:00:00 2001 +From: Pavel Moravec <pmoravec@redhat.com> +Date: Fri, 1 Nov 2019 12:13:23 -0400 +Subject: [PATCH 01/10] [Plugin] remove invalid {strip/join}_sysroot() + +Do not strip the sysroot path prefix when calling _do_copy_path() +for a symlink target and do not add the sysroot prefix when +testing for a forbidden path. + +Related: #1842 + +Signed-off-by: Pavel Moravec <pmoravec@redhat.com> +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/__init__.py | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py +index e75ec82e..4f1b73ce 100644 +--- a/sos/plugins/__init__.py ++++ b/sos/plugins/__init__.py +@@ -731,7 +731,7 @@ class Plugin(object): + + # skip recursive copying of symlink pointing to itself. + if (absdest != srcpath): +- self._do_copy_path(self.strip_sysroot(absdest)) ++ self._do_copy_path(absdest) + else: + self._log_debug("link '%s' points to itself, skipping target..." + % linkdest) +@@ -758,8 +758,6 @@ class Plugin(object): + return None + + def _is_forbidden_path(self, path): +- if self.use_sysroot(): +- path = self.join_sysroot(path) + return _path_in_path_list(path, self.forbidden_paths) + + def _copy_node(self, path, st): +-- +2.21.0 + + +From aeeebf126fc9fdb0fd8c3b01418bef742bce78c3 Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" <bmr@redhat.com> +Date: Fri, 1 Nov 2019 12:22:51 -0400 +Subject: [PATCH 02/10] [Plugin] fix destination paths in _do_copy_path() + +The path used to copy special device nodes and directories in +_do_copy_path() should be the destination path in the archive +(without sysroot prefix), and not the source path in the host +file system that includes this prefix. + +Related: #1842 + +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/__init__.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py +index 4f1b73ce..60fbeaf7 100644 +--- a/sos/plugins/__init__.py ++++ b/sos/plugins/__init__.py +@@ -721,8 +721,12 @@ class Plugin(object): + return + else: + if stat.S_ISDIR(st.st_mode) and os.access(srcpath, os.R_OK): +- self._copy_dir(srcpath) +- return ++ # copy empty directory ++ if not os.listdir(srcpath): ++ self.archive.add_dir(dest) ++ return ++ self._copy_dir(dest) ++ return + + # handle special nodes (block, char, fifo, socket) + if not (stat.S_ISREG(st.st_mode) or stat.S_ISDIR(st.st_mode)): +@@ -808,7 +808,7 @@ class Plugin(object): + ntype = _node_type(st) + self._log_debug("creating %s node at archive:'%s'" + % (ntype, dest)) +- self._copy_node(srcpath, st) ++ self._copy_node(dest, st) + return + + # if we get here, it's definitely a regular file (not a symlink or dir) +-- +2.21.0 + + +From 05f3d5bda8f548459fabcd38f2d087d6ecef98a2 Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" <bmr@redhat.com> +Date: Fri, 1 Nov 2019 12:25:09 -0400 +Subject: [PATCH 03/10] [kernel] remove trailing directory globs in forbidden + paths + +Since the forbidden path test now uses an exact match the trailing +globs ("/some/directory/path/to/exclude/*") used to exclude trace +related directories from collection lead to a failure to properly +blacklist these files: + +The glob is expanded, for e.g.: + + "/sys/kernel/debug/tracing/per_cpu/*" + +Expands to unclude a 'cpuN' sub-directory for each CPU present on +the machine. These expanded paths are then added to the forbidden +paths list for the plugin: + + /sys/kernel/debug/tracing/per_cpu/cpu0 + /sys/kernel/debug/tracing/per_cpu/cpu1 + ... + +When an attempt is made to collect the entire "per_cpu" directory +a check is made for the full "/sys/kernel/debug/tracing/per_cpu" +path against each entry in the forbidden paths list. Since this is +a prefix of the actual paths stored no match is returned and the +collection is permitted. + +Remove the trailing globs from these directory paths and prevent +any collection of the directories they reference by the plugin. + +Related: #1842 + +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/kernel.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py +index 88b14689..5c852143 100644 +--- a/sos/plugins/kernel.py ++++ b/sos/plugins/kernel.py +@@ -89,9 +89,9 @@ class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): + self.add_forbidden_path([ + '/sys/kernel/debug/tracing/trace_pipe', + '/sys/kernel/debug/tracing/README', +- '/sys/kernel/debug/tracing/trace_stat/*', +- '/sys/kernel/debug/tracing/per_cpu/*', +- '/sys/kernel/debug/tracing/events/*', ++ '/sys/kernel/debug/tracing/trace_stat', ++ '/sys/kernel/debug/tracing/per_cpu', ++ '/sys/kernel/debug/tracing/events', + '/sys/kernel/debug/tracing/free_buffer', + '/sys/kernel/debug/tracing/trace_marker', + '/sys/kernel/debug/tracing/trace_marker_raw', +-- +2.21.0 + + +From 801c71b33dcfeaa980baa9f377b721bdd26aa5e8 Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" <bmr@redhat.com> +Date: Fri, 1 Nov 2019 16:53:29 +0000 +Subject: [PATCH 04/10] [tests] fix test_copy_dir_forbidden_path + +Rather than call just Plugin.setup() and Plugin._do_copy_path(), +add an add_copy_spec() call to the mock plugin setup() method, +and invoke copying by calling the Plugin.collect() method. + +Related: #1845 + +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + tests/plugin_tests.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py +index b8760429..6522fe14 100644 +--- a/tests/plugin_tests.py ++++ b/tests/plugin_tests.py +@@ -81,6 +81,7 @@ class ForbiddenMockPlugin(Plugin): + plugin_name = "forbidden" + + def setup(self): ++ self.add_copy_spec("tests") + self.add_forbidden_path("tests") + + +@@ -235,7 +236,7 @@ class PluginTests(unittest.TestCase): + }) + p.archive = MockArchive() + p.setup() +- p._do_copy_path("tests") ++ p.collect() + self.assertEquals(p.archive.m, {}) + + +-- +2.21.0 + + + +From 68f4d7cc7adde00171af842b5bc808f41d888a87 Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" <bmr@redhat.com> +Date: Mon, 4 Nov 2019 10:48:01 +0000 +Subject: [PATCH 06/10] [Plugin] improve _copy_dir() variable naming + +Directory entries found in _copy_dir() may be either files or +sub-directories: reflect this in the names of local variables. + +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/__init__.py | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py +index 240fe9f1..1a1464c1 100644 +--- a/sos/plugins/__init__.py ++++ b/sos/plugins/__init__.py +@@ -738,10 +738,11 @@ class Plugin(object): + + def _copy_dir(self, srcpath): + try: +- for afile in os.listdir(srcpath): ++ for name in os.listdir(srcpath): + self._log_debug("recursively adding '%s' from '%s'" +- % (afile, srcpath)) +- self._do_copy_path(os.path.join(srcpath, afile), dest=None) ++ % (name, srcpath)) ++ path = os.path.join(srcpath, name) ++ self._do_copy_path(path) + except OSError as e: + if e.errno == errno.ELOOP: + msg = "Too many levels of symbolic links copying" +-- +2.21.0 + + +From ad3adef07c32aee5bdd438706c6c1d4590ff8297 Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" <bmr@redhat.com> +Date: Mon, 4 Nov 2019 14:13:00 +0000 +Subject: [PATCH 07/10] [ceph] fix directory blacklist style + +Plugins must use 'path/to/exclude' rather than 'path/to/exclude/*' +in order to omit a directory and all its content from the report. + +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/ceph.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sos/plugins/ceph.py b/sos/plugins/ceph.py +index 6e340c69..43284bc8 100644 +--- a/sos/plugins/ceph.py ++++ b/sos/plugins/ceph.py +@@ -103,8 +103,8 @@ class Ceph(Plugin, RedHatPlugin, UbuntuPlugin): + "/var/lib/ceph/*keyring*", + "/var/lib/ceph/*/*keyring*", + "/var/lib/ceph/*/*/*keyring*", +- "/var/lib/ceph/osd/*", +- "/var/lib/ceph/mon/*", ++ "/var/lib/ceph/osd", ++ "/var/lib/ceph/mon", + # Excludes temporary ceph-osd mount location like + # /var/lib/ceph/tmp/mnt.XXXX from sos collection. + "/var/lib/ceph/tmp/*mnt*", +-- +2.21.0 + + +From 4d1576b04d35902ce44d26d6a5b2219e6f9c175a Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" <bmr@redhat.com> +Date: Mon, 4 Nov 2019 14:15:55 +0000 +Subject: [PATCH 09/10] [openstack_octavia] fix directory blacklist style + +Plugins must use 'path/to/exclude' rather than 'path/to/exclude/*' +in order to omit a directory and all its content from the report. + +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/openstack_octavia.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sos/plugins/openstack_octavia.py b/sos/plugins/openstack_octavia.py +index b97c83fa..ccdcd4c9 100644 +--- a/sos/plugins/openstack_octavia.py ++++ b/sos/plugins/openstack_octavia.py +@@ -30,7 +30,7 @@ class OpenStackOctavia(Plugin): + ]) + + # don't collect certificates +- self.add_forbidden_path("/etc/octavia/certs/") ++ self.add_forbidden_path("/etc/octavia/certs") + + # logs + if self.get_option("all_logs"): +-- +2.21.0 + + +From 1fd194191a56c51052f0c24ddeb3bbf9088ae0ca Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" <bmr@redhat.com> +Date: Mon, 4 Nov 2019 14:16:13 +0000 +Subject: [PATCH 10/10] [vdsm] fix directory blacklist style + +Plugins must use 'path/to/exclude' rather than 'path/to/exclude/*' +in order to omit a directory and all its content from the report. + +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/vdsm.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sos/plugins/vdsm.py b/sos/plugins/vdsm.py +index b2a1ca58..69672643 100644 +--- a/sos/plugins/vdsm.py ++++ b/sos/plugins/vdsm.py +@@ -60,9 +60,9 @@ class Vdsm(Plugin, RedHatPlugin): + plugin_name = 'vdsm' + + def setup(self): +- self.add_forbidden_path('/etc/pki/vdsm/keys/*') ++ self.add_forbidden_path('/etc/pki/vdsm/keys') + self.add_forbidden_path('/etc/pki/vdsm/libvirt-spice/*-key.*') +- self.add_forbidden_path('/etc/pki/libvirt/private/*') ++ self.add_forbidden_path('/etc/pki/libvirt/private') + + self.add_cmd_output('service vdsmd status') + self.add_cmd_output('service supervdsmd status') +-- +2.21.0 + +From 87dbc4d961d9e98f4e8b7b54010800ff3bdb5a73 Mon Sep 17 00:00:00 2001 +From: Jake Hunsaker <jhunsake@redhat.com> +Date: Mon, 11 Nov 2019 12:43:01 -0500 +Subject: [PATCH] [Plugin|Policy] Only call lsmod once and standardize kmod + checks + +This commit makes two changes to how sos deals with kernel modules and +their state during a run of sosreport. + +First, no longer call `lsmod` for every individual plugin during its +enablement check. Instead, call `lsmod` only once during `Policy` +initialization, and cache the output for later checks. + +Second, have `Plugin.is_module_loaded()` check for kmod presence in the +saved policy class attr for kernel_mods, rather than checking through +`/proc/modules`. Have the plugin enablement checks now also use +`is_module_loaded()` to standardize with how `SoSPredicate`s are +checked. + +Note that this change results in a significant performance increase for +sos initialization times in a RHEL 7 container. + +Resolves: #1854 + +Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> +--- + sos/plugins/__init__.py | 13 +++---------- + sos/policies/__init__.py | 8 +++++--- + 2 files changed, 8 insertions(+), 13 deletions(-) + +diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py +index 1a1464c11..b7a47b6a4 100644 +--- a/sos/plugins/__init__.py ++++ b/sos/plugins/__init__.py +@@ -1170,11 +1170,8 @@ + sizelimit=sizelimit) + + def is_module_loaded(self, module_name): +- """Return whether specified moudle as module_name is loaded or not""" +- if len(grep("^" + module_name + " ", "/proc/modules")) == 0: +- return False +- else: +- return True ++ """Return whether specified module as module_name is loaded or not""" ++ return module_name in self.policy.kernel_mods + + # For adding output + def add_alert(self, alertstring): +@@ -1408,15 +1408,11 @@ + return True + + def _check_plugin_triggers(self, files, packages, commands, services): +- kernel_mods = self.policy.lsmod() +- +- def have_kmod(kmod): +- return kmod in kernel_mods + + return (any(os.path.exists(fname) for fname in files) or + any(self.is_installed(pkg) for pkg in packages) or + any(is_executable(cmd) for cmd in commands) or +- any(have_kmod(kmod) for kmod in self.kernel_mods) or ++ any(self.is_module_loaded(mod) for mod in self.kernel_mods) or + any(self.is_service(svc) for svc in services)) + + def default_enabled(self): + +diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py +index a19daf227..f4aa31801 100644 +--- a/sos/policies/__init__.py ++++ b/sos/policies/__init__.py +@@ -822,6 +822,7 @@ class LinuxPolicy(Policy): + + def __init__(self, sysroot=None): + super(LinuxPolicy, self).__init__(sysroot=sysroot) ++ self.init_kernel_modules() + if self.init == 'systemd': + self.init_system = SystemdInit() + else: +@@ -874,11 +875,12 @@ def get_local_name(self): + def sanitize_filename(self, name): + return re.sub(r"[^-a-z,A-Z.0-9]", "", name) + +- def lsmod(self): +- """Return a list of kernel module names as strings. ++ def init_kernel_modules(self): ++ """Obtain a list of loaded kernel modules to reference later for plugin ++ enablement and SoSPredicate checks + """ + lines = shell_out("lsmod", timeout=0).splitlines() +- return [line.split()[0].strip() for line in lines] ++ self.kernel_mods = [line.split()[0].strip() for line in lines] + + def pre_work(self): + # this method will be called before the gathering begins + +From c4182ebd52af523261d2e7ef75affbb88eaf31fb Mon Sep 17 00:00:00 2001 +From: "Bryn M. Reeves" <bmr@redhat.com> +Date: Mon, 4 Nov 2019 10:45:15 +0000 +Subject: [PATCH 05/10] [Plugin] use correct source path when copying + directories + +Signed-off-by: Bryn M. Reeves <bmr@redhat.com> +--- + sos/plugins/__init__.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py +index 60fbeaf7..240fe9f1 100644 +--- a/sos/plugins/__init__.py ++++ b/sos/plugins/__init__.py +@@ -725,7 +725,7 @@ class Plugin(object): + if not os.listdir(srcpath): + self.archive.add_dir(dest) + return +- self._copy_dir(dest) ++ self._copy_dir(srcpath) + return + + # handle special nodes (block, char, fifo, socket) +-- +2.21.0 + + diff --git a/SOURCES/sos-bz1769259-interim-sysroot-forbidden-paths.patch b/SOURCES/sos-bz1769259-interim-sysroot-forbidden-paths.patch deleted file mode 100644 index 48eb9f0..0000000 --- a/SOURCES/sos-bz1769259-interim-sysroot-forbidden-paths.patch +++ /dev/null @@ -1,569 +0,0 @@ -From 9a0ab16793a8388b2c3d3909fd3a087c5b6296d4 Mon Sep 17 00:00:00 2001 -From: Pavel Moravec <pmoravec@redhat.com> -Date: Fri, 1 Nov 2019 12:13:23 -0400 -Subject: [PATCH 01/10] [Plugin] remove invalid {strip/join}_sysroot() - -Do not strip the sysroot path prefix when calling _do_copy_path() -for a symlink target and do not add the sysroot prefix when -testing for a forbidden path. - -Related: #1842 - -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/__init__.py | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py -index e75ec82e..4f1b73ce 100644 ---- a/sos/plugins/__init__.py -+++ b/sos/plugins/__init__.py -@@ -731,7 +731,7 @@ class Plugin(object): - - # skip recursive copying of symlink pointing to itself. - if (absdest != srcpath): -- self._do_copy_path(self.strip_sysroot(absdest)) -+ self._do_copy_path(absdest) - else: - self._log_debug("link '%s' points to itself, skipping target..." - % linkdest) -@@ -758,8 +758,6 @@ class Plugin(object): - return None - - def _is_forbidden_path(self, path): -- if self.use_sysroot(): -- path = self.join_sysroot(path) - return _path_in_path_list(path, self.forbidden_paths) - - def _copy_node(self, path, st): --- -2.21.0 - - -From aeeebf126fc9fdb0fd8c3b01418bef742bce78c3 Mon Sep 17 00:00:00 2001 -From: "Bryn M. Reeves" <bmr@redhat.com> -Date: Fri, 1 Nov 2019 12:22:51 -0400 -Subject: [PATCH 02/10] [Plugin] fix destination paths in _do_copy_path() - -The path used to copy special device nodes and directories in -_do_copy_path() should be the destination path in the archive -(without sysroot prefix), and not the source path in the host -file system that includes this prefix. - -Related: #1842 - -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/__init__.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py -index 4f1b73ce..60fbeaf7 100644 ---- a/sos/plugins/__init__.py -+++ b/sos/plugins/__init__.py -@@ -721,8 +721,12 @@ class Plugin(object): - return - else: - if stat.S_ISDIR(st.st_mode) and os.access(srcpath, os.R_OK): -- self._copy_dir(srcpath) -- return -+ # copy empty directory -+ if not os.listdir(srcpath): -+ self.archive.add_dir(dest) -+ return -+ self._copy_dir(dest) -+ return - - # handle special nodes (block, char, fifo, socket) - if not (stat.S_ISREG(st.st_mode) or stat.S_ISDIR(st.st_mode)): -@@ -808,7 +808,7 @@ class Plugin(object): - ntype = _node_type(st) - self._log_debug("creating %s node at archive:'%s'" - % (ntype, dest)) -- self._copy_node(srcpath, st) -+ self._copy_node(dest, st) - return - - # if we get here, it's definitely a regular file (not a symlink or dir) --- -2.21.0 - - -From 05f3d5bda8f548459fabcd38f2d087d6ecef98a2 Mon Sep 17 00:00:00 2001 -From: "Bryn M. Reeves" <bmr@redhat.com> -Date: Fri, 1 Nov 2019 12:25:09 -0400 -Subject: [PATCH 03/10] [kernel] remove trailing directory globs in forbidden - paths - -Since the forbidden path test now uses an exact match the trailing -globs ("/some/directory/path/to/exclude/*") used to exclude trace -related directories from collection lead to a failure to properly -blacklist these files: - -The glob is expanded, for e.g.: - - "/sys/kernel/debug/tracing/per_cpu/*" - -Expands to unclude a 'cpuN' sub-directory for each CPU present on -the machine. These expanded paths are then added to the forbidden -paths list for the plugin: - - /sys/kernel/debug/tracing/per_cpu/cpu0 - /sys/kernel/debug/tracing/per_cpu/cpu1 - ... - -When an attempt is made to collect the entire "per_cpu" directory -a check is made for the full "/sys/kernel/debug/tracing/per_cpu" -path against each entry in the forbidden paths list. Since this is -a prefix of the actual paths stored no match is returned and the -collection is permitted. - -Remove the trailing globs from these directory paths and prevent -any collection of the directories they reference by the plugin. - -Related: #1842 - -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/kernel.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py -index 88b14689..5c852143 100644 ---- a/sos/plugins/kernel.py -+++ b/sos/plugins/kernel.py -@@ -89,9 +89,9 @@ class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): - self.add_forbidden_path([ - '/sys/kernel/debug/tracing/trace_pipe', - '/sys/kernel/debug/tracing/README', -- '/sys/kernel/debug/tracing/trace_stat/*', -- '/sys/kernel/debug/tracing/per_cpu/*', -- '/sys/kernel/debug/tracing/events/*', -+ '/sys/kernel/debug/tracing/trace_stat', -+ '/sys/kernel/debug/tracing/per_cpu', -+ '/sys/kernel/debug/tracing/events', - '/sys/kernel/debug/tracing/free_buffer', - '/sys/kernel/debug/tracing/trace_marker', - '/sys/kernel/debug/tracing/trace_marker_raw', --- -2.21.0 - - -From 801c71b33dcfeaa980baa9f377b721bdd26aa5e8 Mon Sep 17 00:00:00 2001 -From: "Bryn M. Reeves" <bmr@redhat.com> -Date: Fri, 1 Nov 2019 16:53:29 +0000 -Subject: [PATCH 04/10] [tests] fix test_copy_dir_forbidden_path - -Rather than call just Plugin.setup() and Plugin._do_copy_path(), -add an add_copy_spec() call to the mock plugin setup() method, -and invoke copying by calling the Plugin.collect() method. - -Related: #1845 - -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - tests/plugin_tests.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py -index b8760429..6522fe14 100644 ---- a/tests/plugin_tests.py -+++ b/tests/plugin_tests.py -@@ -81,6 +81,7 @@ class ForbiddenMockPlugin(Plugin): - plugin_name = "forbidden" - - def setup(self): -+ self.add_copy_spec("tests") - self.add_forbidden_path("tests") - - -@@ -235,7 +236,7 @@ class PluginTests(unittest.TestCase): - }) - p.archive = MockArchive() - p.setup() -- p._do_copy_path("tests") -+ p.collect() - self.assertEquals(p.archive.m, {}) - - --- -2.21.0 - - -From c4182ebd52af523261d2e7ef75affbb88eaf31fb Mon Sep 17 00:00:00 2001 -From: "Bryn M. Reeves" <bmr@redhat.com> -Date: Mon, 4 Nov 2019 10:45:15 +0000 -Subject: [PATCH 05/10] [Plugin] use correct source path when copying - directories - -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/__init__.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py -index 60fbeaf7..240fe9f1 100644 ---- a/sos/plugins/__init__.py -+++ b/sos/plugins/__init__.py -@@ -725,7 +725,7 @@ class Plugin(object): - if not os.listdir(srcpath): - self.archive.add_dir(dest) - return -- self._copy_dir(dest) -+ self._copy_dir(srcpath) - return - - # handle special nodes (block, char, fifo, socket) --- -2.21.0 - - -From 68f4d7cc7adde00171af842b5bc808f41d888a87 Mon Sep 17 00:00:00 2001 -From: "Bryn M. Reeves" <bmr@redhat.com> -Date: Mon, 4 Nov 2019 10:48:01 +0000 -Subject: [PATCH 06/10] [Plugin] improve _copy_dir() variable naming - -Directory entries found in _copy_dir() may be either files or -sub-directories: reflect this in the names of local variables. - -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/__init__.py | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py -index 240fe9f1..1a1464c1 100644 ---- a/sos/plugins/__init__.py -+++ b/sos/plugins/__init__.py -@@ -738,10 +738,11 @@ class Plugin(object): - - def _copy_dir(self, srcpath): - try: -- for afile in os.listdir(srcpath): -+ for name in os.listdir(srcpath): - self._log_debug("recursively adding '%s' from '%s'" -- % (afile, srcpath)) -- self._do_copy_path(os.path.join(srcpath, afile), dest=None) -+ % (name, srcpath)) -+ path = os.path.join(srcpath, name) -+ self._do_copy_path(path) - except OSError as e: - if e.errno == errno.ELOOP: - msg = "Too many levels of symbolic links copying" --- -2.21.0 - - -From ad3adef07c32aee5bdd438706c6c1d4590ff8297 Mon Sep 17 00:00:00 2001 -From: "Bryn M. Reeves" <bmr@redhat.com> -Date: Mon, 4 Nov 2019 14:13:00 +0000 -Subject: [PATCH 07/10] [ceph] fix directory blacklist style - -Plugins must use 'path/to/exclude' rather than 'path/to/exclude/*' -in order to omit a directory and all its content from the report. - -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/ceph.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sos/plugins/ceph.py b/sos/plugins/ceph.py -index 6e340c69..43284bc8 100644 ---- a/sos/plugins/ceph.py -+++ b/sos/plugins/ceph.py -@@ -103,8 +103,8 @@ class Ceph(Plugin, RedHatPlugin, UbuntuPlugin): - "/var/lib/ceph/*keyring*", - "/var/lib/ceph/*/*keyring*", - "/var/lib/ceph/*/*/*keyring*", -- "/var/lib/ceph/osd/*", -- "/var/lib/ceph/mon/*", -+ "/var/lib/ceph/osd", -+ "/var/lib/ceph/mon", - # Excludes temporary ceph-osd mount location like - # /var/lib/ceph/tmp/mnt.XXXX from sos collection. - "/var/lib/ceph/tmp/*mnt*", --- -2.21.0 - - -From 4d1576b04d35902ce44d26d6a5b2219e6f9c175a Mon Sep 17 00:00:00 2001 -From: "Bryn M. Reeves" <bmr@redhat.com> -Date: Mon, 4 Nov 2019 14:15:55 +0000 -Subject: [PATCH 09/10] [openstack_octavia] fix directory blacklist style - -Plugins must use 'path/to/exclude' rather than 'path/to/exclude/*' -in order to omit a directory and all its content from the report. - -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/openstack_octavia.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sos/plugins/openstack_octavia.py b/sos/plugins/openstack_octavia.py -index b97c83fa..ccdcd4c9 100644 ---- a/sos/plugins/openstack_octavia.py -+++ b/sos/plugins/openstack_octavia.py -@@ -30,7 +30,7 @@ class OpenStackOctavia(Plugin): - ]) - - # don't collect certificates -- self.add_forbidden_path("/etc/octavia/certs/") -+ self.add_forbidden_path("/etc/octavia/certs") - - # logs - if self.get_option("all_logs"): --- -2.21.0 - - -From 1fd194191a56c51052f0c24ddeb3bbf9088ae0ca Mon Sep 17 00:00:00 2001 -From: "Bryn M. Reeves" <bmr@redhat.com> -Date: Mon, 4 Nov 2019 14:16:13 +0000 -Subject: [PATCH 10/10] [vdsm] fix directory blacklist style - -Plugins must use 'path/to/exclude' rather than 'path/to/exclude/*' -in order to omit a directory and all its content from the report. - -Signed-off-by: Bryn M. Reeves <bmr@redhat.com> ---- - sos/plugins/vdsm.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sos/plugins/vdsm.py b/sos/plugins/vdsm.py -index b2a1ca58..69672643 100644 ---- a/sos/plugins/vdsm.py -+++ b/sos/plugins/vdsm.py -@@ -60,9 +60,9 @@ class Vdsm(Plugin, RedHatPlugin): - plugin_name = 'vdsm' - - def setup(self): -- self.add_forbidden_path('/etc/pki/vdsm/keys/*') -+ self.add_forbidden_path('/etc/pki/vdsm/keys') - self.add_forbidden_path('/etc/pki/vdsm/libvirt-spice/*-key.*') -- self.add_forbidden_path('/etc/pki/libvirt/private/*') -+ self.add_forbidden_path('/etc/pki/libvirt/private') - - self.add_cmd_output('service vdsmd status') - self.add_cmd_output('service supervdsmd status') --- -2.21.0 - -From 87dbc4d961d9e98f4e8b7b54010800ff3bdb5a73 Mon Sep 17 00:00:00 2001 -From: Jake Hunsaker <jhunsake@redhat.com> -Date: Mon, 11 Nov 2019 12:43:01 -0500 -Subject: [PATCH] [Plugin|Policy] Only call lsmod once and standardize kmod - checks - -This commit makes two changes to how sos deals with kernel modules and -their state during a run of sosreport. - -First, no longer call `lsmod` for every individual plugin during its -enablement check. Instead, call `lsmod` only once during `Policy` -initialization, and cache the output for later checks. - -Second, have `Plugin.is_module_loaded()` check for kmod presence in the -saved policy class attr for kernel_mods, rather than checking through -`/proc/modules`. Have the plugin enablement checks now also use -`is_module_loaded()` to standardize with how `SoSPredicate`s are -checked. - -Note that this change results in a significant performance increase for -sos initialization times in a RHEL 7 container. - -Resolves: #1854 - -Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> ---- - sos/plugins/__init__.py | 13 +++---------- - sos/policies/__init__.py | 8 +++++--- - 2 files changed, 8 insertions(+), 13 deletions(-) - -diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py -index 1a1464c1..b7a47b6a 100644 ---- a/sos/plugins/__init__.py -+++ b/sos/plugins/__init__.py -@@ -1036,11 +1036,8 @@ class Plugin(object): - sizelimit=sizelimit) - - def is_module_loaded(self, module_name): -- """Return whether specified moudle as module_name is loaded or not""" -- if len(grep("^" + module_name + " ", "/proc/modules")) == 0: -- return False -- else: -- return True -+ """Return whether specified module as module_name is loaded or not""" -+ return module_name in self.policy.kernel_mods - - # For adding output - def add_alert(self, alertstring): -@@ -1541,15 +1538,11 @@ class Plugin(object): - return True - - def _check_plugin_triggers(self, files, packages, commands, services): -- kernel_mods = self.policy.lsmod() -- -- def have_kmod(kmod): -- return kmod in kernel_mods - - return (any(os.path.exists(fname) for fname in files) or - any(self.is_installed(pkg) for pkg in packages) or - any(is_executable(cmd) for cmd in commands) or -- any(have_kmod(kmod) for kmod in self.kernel_mods) or -+ any(self.is_module_loaded(mod) for mod in self.kernel_mods) or - any(self.is_service(svc) for svc in services)) - - def default_enabled(self): -diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py -index a19daf22..f4aa3180 100644 ---- a/sos/policies/__init__.py -+++ b/sos/policies/__init__.py -@@ -822,6 +822,7 @@ class LinuxPolicy(Policy): - - def __init__(self, sysroot=None): - super(LinuxPolicy, self).__init__(sysroot=sysroot) -+ self.init_kernel_modules() - if self.init == 'systemd': - self.init_system = SystemdInit() - else: -@@ -874,11 +875,12 @@ class LinuxPolicy(Policy): - def sanitize_filename(self, name): - return re.sub(r"[^-a-z,A-Z.0-9]", "", name) - -- def lsmod(self): -- """Return a list of kernel module names as strings. -+ def init_kernel_modules(self): -+ """Obtain a list of loaded kernel modules to reference later for plugin -+ enablement and SoSPredicate checks - """ - lines = shell_out("lsmod", timeout=0).splitlines() -- return [line.split()[0].strip() for line in lines] -+ self.kernel_mods = [line.split()[0].strip() for line in lines] - - def pre_work(self): - # this method will be called before the gathering begins --- -2.21.0 - -From 3006f467e6e3908193d28d76bddcc372c4b98875 Mon Sep 17 00:00:00 2001 -From: Pavel Moravec <pmoravec@redhat.com> -Date: Tue, 9 Jul 2019 13:35:28 +0200 -Subject: [PATCH] [archive] Handle checking container sysroot in - _make_leading_paths - -Previously, in _make_leading_paths(), checking host file paths did not -account for non / sysroots, for situations where sos is run in a -container and the host's / is actually mounted under /host for example. -This would lead to copy errors when trying to copy symlinks. - -This method now will use sysroot if one is set, thus avoiding copy -errors. - -Resolves: #1705 - -Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> -Signed-off-by: Pavel Moravec <pmoravec@redhat.com> ---- - sos/archive.py | 17 +++++++++++++---- - sos/sosreport.py | 4 ++-- - tests/archive_tests.py | 3 ++- - 3 files changed, 17 insertions(+), 7 deletions(-) - -diff --git a/sos/archive.py b/sos/archive.py -index dcd6908d..7ab36ce4 100644 ---- a/sos/archive.py -+++ b/sos/archive.py -@@ -139,12 +139,13 @@ class FileCacheArchive(Archive): - _archive_root = "" - _archive_name = "" - -- def __init__(self, name, tmpdir, policy, threads, enc_opts): -+ def __init__(self, name, tmpdir, policy, threads, enc_opts, sysroot): - self._name = name - self._tmp_dir = tmpdir - self._policy = policy - self._threads = threads - self.enc_opts = enc_opts -+ self.sysroot = sysroot - self._archive_root = os.path.join(tmpdir, name) - with self._path_lock: - os.makedirs(self._archive_root, 0o700) -@@ -156,6 +157,13 @@ class FileCacheArchive(Archive): - name = name.lstrip(os.sep) - return (os.path.join(self._archive_root, name)) - -+ def join_sysroot(self, path): -+ if path.startswith(self.sysroot): -+ return path -+ if path[0] == os.sep: -+ path = path[1:] -+ return os.path.join(self.sysroot, path) -+ - def _make_leading_paths(self, src, mode=0o700): - """Create leading path components - -@@ -191,7 +199,8 @@ class FileCacheArchive(Archive): - src_dir = src - else: - # Host file path -- src_dir = src if os.path.isdir(src) else os.path.split(src)[0] -+ src_dir = (src if os.path.isdir(self.join_sysroot(src)) -+ else os.path.split(src)[0]) - - # Build a list of path components in root-to-leaf order. - path = src_dir -@@ -675,9 +684,9 @@ class TarFileArchive(FileCacheArchive): - method = None - _with_selinux_context = False - -- def __init__(self, name, tmpdir, policy, threads, enc_opts): -+ def __init__(self, name, tmpdir, policy, threads, enc_opts, sysroot): - super(TarFileArchive, self).__init__(name, tmpdir, policy, threads, -- enc_opts) -+ enc_opts, sysroot) - self._suffix = "tar" - self._archive_name = os.path.join(tmpdir, self.name()) - -diff --git a/sos/sosreport.py b/sos/sosreport.py -index cd61b625..04cb8615 100644 ---- a/sos/sosreport.py -+++ b/sos/sosreport.py -@@ -379,12 +379,12 @@ class SoSReport(object): - auto_archive = self.policy.get_preferred_archive() - self.archive = auto_archive(archive_name, self.tmpdir, - self.policy, self.opts.threads, -- enc_opts) -+ enc_opts, self.sysroot) - - else: - self.archive = TarFileArchive(archive_name, self.tmpdir, - self.policy, self.opts.threads, -- enc_opts) -+ enc_opts, self.sysroot) - - self.archive.set_debug(True if self.opts.debug else False) - -diff --git a/tests/archive_tests.py b/tests/archive_tests.py -index e5b329b5..350220b9 100644 ---- a/tests/archive_tests.py -+++ b/tests/archive_tests.py -@@ -20,7 +20,7 @@ class TarFileArchiveTest(unittest.TestCase): - def setUp(self): - self.tmpdir = tempfile.mkdtemp() - enc = {'encrypt': False} -- self.tf = TarFileArchive('test', self.tmpdir, Policy(), 1, enc) -+ self.tf = TarFileArchive('test', self.tmpdir, Policy(), 1, enc, '/') - - def tearDown(self): - shutil.rmtree(self.tmpdir) -@@ -113,6 +113,7 @@ class TarFileArchiveTest(unittest.TestCase): - def test_compress(self): - self.tf.finalize("auto") - -+ - if __name__ == "__main__": - unittest.main() - --- -2.21.0 - diff --git a/SOURCES/sos-bz1781148-foreman-psql-dynflow-explicit-cast.patch b/SOURCES/sos-bz1781148-foreman-psql-dynflow-explicit-cast.patch new file mode 100644 index 0000000..c0217ce --- /dev/null +++ b/SOURCES/sos-bz1781148-foreman-psql-dynflow-explicit-cast.patch @@ -0,0 +1,119 @@ +From 5fbbc63c5e41eab4fe34e3bb2c76abf26023bd55 Mon Sep 17 00:00:00 2001 +From: Pavel Moravec <pmoravec@redhat.com> +Date: Mon, 9 Dec 2019 13:22:34 +0100 +Subject: [PATCH] [foreman] cast dynflow_execution_plans.uuid as varchar + +Due to a change in foreman DB scheme, we must explicitly cast +dynflow_execution_plans.uuid as a varchar since foreman-tasks +0.15.5 . + +The explicit casting works well on older versions as well. + +Resolves: #1882 + +Signed-off-by: Pavel Moravec <pmoravec@redhat.com> +--- + sos/plugins/foreman.py | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/sos/plugins/foreman.py b/sos/plugins/foreman.py +index c8ed2850..c1546eae 100644 +--- a/sos/plugins/foreman.py ++++ b/sos/plugins/foreman.py +@@ -176,22 +176,24 @@ class Foreman(Plugin): + dyncmd = ( + 'select dynflow_execution_plans.* from foreman_tasks_tasks join ' + 'dynflow_execution_plans on (foreman_tasks_tasks.external_id = ' +- 'dynflow_execution_plans.uuid) where foreman_tasks_tasks.' ++ 'dynflow_execution_plans.uuid::varchar) where foreman_tasks_tasks.' + 'started_at > NOW() - interval %s' % quote(months) + ) + + dactioncmd = ( + 'select dynflow_actions.* from foreman_tasks_tasks join ' + 'dynflow_actions on (foreman_tasks_tasks.external_id = ' +- 'dynflow_actions.execution_plan_uuid) where foreman_tasks_tasks.' +- 'started_at > NOW() - interval %s' % quote(months) ++ 'dynflow_actions.execution_plan_uuid::varchar) where ' ++ 'foreman_tasks_tasks.started_at > NOW() - interval %s' ++ % quote(months) + ) + + dstepscmd = ( + 'select dynflow_steps.* from foreman_tasks_tasks join ' + 'dynflow_steps on (foreman_tasks_tasks.external_id = ' +- 'dynflow_steps.execution_plan_uuid) where foreman_tasks_tasks.' +- 'started_at > NOW() - interval %s' % quote(months) ++ 'dynflow_steps.execution_plan_uuid::varchar) where ' ++ 'foreman_tasks_tasks.started_at > NOW() - interval %s' ++ % quote(months) + ) + + # Populate this dict with DB queries that should be saved directly as +-- +2.21.0 + +From 40cfbd26a64d33cd3ed87edbf8d2b248d339ad9b Mon Sep 17 00:00:00 2001 +From: Pavel Moravec <pmoravec@redhat.com> +Date: Thu, 5 Dec 2019 14:26:03 +0100 +Subject: [PATCH] [plugins] improve heuristic for applying --since to + logarchives + +logarchive_pattern treats some configs (e.g. /etc/dbus-1) as log +archives, causing --since option will skip collecting them. + +This patch just improves the heuristic by claiming nothing under /etc +is a logarchive, and adds a warning to sosreport help. + +Improves: #1847 + +Signed-off-by: Pavel Moravec <pmoravec@redhat.com> +--- + man/en/sosreport.1 | 7 +++++-- + sos/plugins/__init__.py | 5 ++++- + 2 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/man/en/sosreport.1 b/man/en/sosreport.1 +index a885d563..75819b6e 100644 +--- a/man/en/sosreport.1 ++++ b/man/en/sosreport.1 +@@ -158,8 +158,11 @@ and including logs in non-default locations. This option may significantly + increase the size of reports. + .TP + .B \--since YYYYMMDD[HHMMSS] +-Limits the collection to logs newer than this date. +-This also affects \--all-logs. Will pad with 0s if HHMMSS isn't specified. ++Limits the collection of log archives to those newer than this date. A log ++archive is any file not found in /etc, that has either a numeric or a ++compression-type file extension for example ".zip". ".1", ".gz" etc.). ++This also affects \--all-logs. The date string will be padded with zeros ++if HHMMSS is not specified. + .TP + .B \--allow-system-changes + Run commands even if they can change the system (e.g. load kernel modules). +diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py +index b7a47b6a..44ae413d 100644 +--- a/sos/plugins/__init__.py ++++ b/sos/plugins/__init__.py +@@ -917,6 +917,7 @@ class Plugin(object): + since = self.get_option('since') + + logarchive_pattern = re.compile(r'.*((\.(zip|gz|bz2|xz))|[-.][\d]+)$') ++ configfile_pattern = re.compile(r"^%s/*" % self.join_sysroot("etc")) + + if not self.test_predicate(pred=pred): + self._log_info("skipped copy spec '%s' due to predicate (%s)" % +@@ -962,7 +963,9 @@ class Plugin(object): + """ When --since is passed, or maxage is coming from the + plugin, we need to filter out older files """ + +- if logarchive_pattern.search(path) is None: ++ # skip config files or not-logarchive files from the filter ++ if ((logarchive_pattern.search(path) is None) or ++ (configfile_pattern.search(path) is not None)): + return True + filetime = datetime.fromtimestamp(getmtime(path)) + if ((since and filetime < since) or +-- +2.21.0 + diff --git a/SPECS/sos.spec b/SPECS/sos.spec index bcf9a11..df55c45 100644 --- a/SPECS/sos.spec +++ b/SPECS/sos.spec @@ -1,8 +1,8 @@ %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} Summary: A set of tools to gather troubleshooting information from a system Name: sos -Version: 3.7 -Release: 11%{?dist} +Version: 3.8 +Release: 6%{?dist} Group: Applications/System Source0: https://github.com/sosreport/sos/archive/%{version}.tar.gz License: GPLv2+ @@ -19,23 +19,12 @@ Requires: python2-futures Obsoletes: sos-plugins-openstack Conflicts: vdsm <= 4.30.17 Patch0: skip-generating-doc.patch -Patch1: sos-bz1656812-bump-release.patch -Patch2: sos-bz1639166-pcp-pmlogger-no-limit.patch -Patch3: sos-bz1697854-plugopts-default-datatypes.patch -Patch4: sos-bz1697813-plugin-vs-command-timeouts.patch -Patch5: sos-bz1311129-sos-conf-disabled-plugins-manpages.patch -Patch6: sos-bz1702802-openstack_instack-ansible-log.patch -Patch7: sos-bz1706060-vdsm-plugin.patch -Patch8: sos-bz1711305-katello-qpid-certificate.patch -Patch9: sos-bz1736424-timeouted-plugin-stop-further-collection.patch -Patch10: sos-bz1736422-cmd-poll-performance.patch -Patch11: sos-bz1751576-gluster-deployment-cleanup-logs.patch -Patch12: sos-bz1751577-vdsm-fix-shell-commands.patch -Patch13: sos-bz1751578-ovn-plugins-containerized.patch -Patch14: sos-bz1760737-kernel-trace-disabled.patch -Patch15: sos-bz1769259-interim-sysroot-forbidden-paths.patch -Patch16: sos-bz1683904-option_to_limit_namespaces.patch -Patch17: sos-3.7-centos-branding.patch +Patch1: sos-bz1744555-ovn-plugins-containerized.patch +Patch2: sos-bz1757662-kernel-trace-disabled.patch +Patch3: sos-bz1699381-gluster-skip-statedump-dirs.patch +Patch4: sos-bz1767445-interim-sysroot-forbidden-paths.patch +Patch5: sos-bz1630028-manpages-allow-system-changes.patch +Patch6: sos-bz1781148-foreman-psql-dynflow-explicit-cast.patch %description Sos is a set of tools that gathers information about system @@ -49,20 +38,9 @@ support technicians and developers. %patch1 -p1 %patch2 -p1 %patch3 -p1 -%patch4 -p1 +%patch4 -p1 %patch5 -p1 %patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -%patch17 -p1 %build make @@ -86,38 +64,36 @@ rm -rf ${RPM_BUILD_ROOT} %config(noreplace) %{_sysconfdir}/sos.conf %changelog -* Tue Mar 17 2020 CentOS Sources <bugs@centos.org> - 3.7-11.el7.centos -- Roll in CentOS Branding +* Wed Dec 11 2019 Pavel Moravec <pmoravec@redhat.com> = 3.8-6 +- [foreman] cast dynflow_execution_plans.uuid as varchar + Resolves: bz1781148 -* Wed Feb 19 2020 Jan Jansky <jjansky@redhat.com> = 3.7-11 -- [networking] options to limit namespaces - Resolves: bz1683904 - -* Tue Nov 12 2019 Pavel Moravec <pmoravec@redhat.com> = 3.7-10 -- [archive] Handle checking sysroot in _make_leading_paths - Resolves: bz1769259 - -* Wed Nov 06 2019 Pavel Moravec <pmoravec@redhat.com> = 3.7-9 +* Fri Nov 22 2019 Jan Jansky <jjansky@redhat.com> = 3.8-5 - [Plugin, kernel] interim sysroot fixes - Resolves: bz1769259 + Resolves: bz1767445 -* Fri Oct 11 2019 Pavel Moravec <pmoravec@redhat.com> = 3.7-8 +* Thu Nov 14 2019 Jan Jansky <jjansky@redhat.com> = 3.8-4 +- [man] describe --allow-system-changes + Resolves: bz1630028 + +* Wed Oct 09 2019 Pavel Moravec <pmoravec@redhat.com> = 3.8-3 +- [gluster] process files only from a statedump dir + Resolves: bz1699381 - [kernel] Don't collect trace file by default - Resolves: bz1760737 + Resolves: bz1757662 -* Thu Sep 12 2019 Pavel Moravec <pmoravec@redhat.com> = 3.7-7 -- [ovirt_hosted_engine] Add gluster deployment and cleanup log - Resolves: bz1751576 -- [vdsm]: Fix executing shell commands - Resolves: bz1751577 +* Thu Sep 12 2019 Pavel Moravec <pmoravec@redhat.com> = 3.8-2 - [ovn_*] Add support to containerized setups, add commands - Resolves: bz1751578 + Resolves: bz1744555 + +* Tue Aug 27 2019 Pavel Moravec <pmoravec@redhat.com> = 3.8-1 +- New upstream release sos-3.8 * Thu Aug 01 2019 Pavel Moravec <pmoravec@redhat.com> = 3.7-6 - [utilities] Fix high CPU usage and slow command collection - Resolves: bz1736422 + Resolves: bz1733367 - [sosreport,plugins] Stop plugin execution after timeout hit - Resolves: bz1736424 + Resolves: bz1731007 * Tue Jun 25 2019 Pavel Moravec <pmoravec@redhat.com> = 3.7-5 - Updates to vdsm plugin