From 6eeef72ed73b995bcde7fba405997295ca84b0a9 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 17 2020 12:35:41 +0000 Subject: import sos-3.7-11.el7_7 --- diff --git a/SOURCES/sos-3.7-centos-branding.patch b/SOURCES/sos-3.7-centos-branding.patch deleted file mode 100644 index 429db6b..0000000 --- a/SOURCES/sos-3.7-centos-branding.patch +++ /dev/null @@ -1,106 +0,0 @@ -diff -uNrp sos-3.6.orig/sos/policies/redhat.py sos-3.6/sos/policies/redhat.py ---- sos-3.6.orig/sos/policies/redhat.py 2018-11-04 17:44:59.513116585 +0000 -+++ sos-3.6/sos/policies/redhat.py 2018-11-04 17:53:28.333731059 +0000 -@@ -32,9 +32,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' - -@@ -230,9 +230,9 @@ rhel_presets = { - - - 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 \ -@@ -262,7 +262,7 @@ No changes will be made to system config - 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. -@@ -324,7 +324,7 @@ No changes will be made to system config - - 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, -@@ -333,7 +333,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 -uNrp sos-3.7.orig/sos/policies/redhat.py sos-3.7/sos/policies/redhat.py ---- sos-3.7.orig/sos/policies/redhat.py 2019-08-07 15:24:23.198233507 +0000 -+++ sos-3.7/sos/policies/redhat.py 2019-08-07 15:29:08.324131718 +0000 -@@ -198,7 +198,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" -@@ -207,13 +207,13 @@ RHEL = "rhel" - RHEL_DESC = RHEL_RELEASE_STR - - RHOSP = "rhosp" --RHOSP_DESC = "Red Hat OpenStack Platform" -+RHOSP_DESC = "RDO" - - 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" diff --git a/SOURCES/sos-bz1683904-option_to_limit_namespaces.patch b/SOURCES/sos-bz1683904-option_to_limit_namespaces.patch new file mode 100644 index 0000000..60aef4e --- /dev/null +++ b/SOURCES/sos-bz1683904-option_to_limit_namespaces.patch @@ -0,0 +1,185 @@ +From c20bd8d489c45401db55cf89bf7d4d0f7623a4fe Mon Sep 17 00:00:00 2001 +From: Jan Jansky +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 +Signed-off-by: Pavel Moravec +--- +--- 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/SPECS/sos.spec b/SPECS/sos.spec index 45969cf..eef5ae5 100644 --- a/SPECS/sos.spec +++ b/SPECS/sos.spec @@ -2,7 +2,7 @@ Summary: A set of tools to gather troubleshooting information from a system Name: sos Version: 3.7 -Release: 10%{?dist} +Release: 11%{?dist} Group: Applications/System Source0: https://github.com/sosreport/sos/archive/%{version}.tar.gz License: GPLv2+ @@ -34,8 +34,7 @@ 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-3.7-centos-branding.patch - +Patch16: sos-bz1683904-option_to_limit_namespaces.patch %description Sos is a set of tools that gathers information about system @@ -85,8 +84,9 @@ rm -rf ${RPM_BUILD_ROOT} %config(noreplace) %{_sysconfdir}/sos.conf %changelog -* Tue Nov 26 2019 CentOS Sources - 3.7-10.el7.centos -- Roll in CentOS Branding +* Wed Feb 19 2020 Jan Jansky = 3.7-11 +- [networking] options to limit namespaces + Resolves: bz1683904 * Tue Nov 12 2019 Pavel Moravec = 3.7-10 - [archive] Handle checking sysroot in _make_leading_paths