Blame SOURCES/sos-bz1917074-networking_ethtool-e_conditionally_only.patch

c3caec
From 00a25deaba41cd34a2143b5324d22a7c35098c1c Mon Sep 17 00:00:00 2001
c3caec
From: Jan Jansky <jjansky@redhat.com>
c3caec
Date: Thu, 21 Jan 2021 09:48:29 +0100
c3caec
Subject: [PATCH] [networking] Collect 'ethtool -e <device>' conditionally only
c3caec
c3caec
EEPROM dump collection might hang on specific types of devices, or
c3caec
negatively impact the system otherwise. As a safe option, sos report
c3caec
should collect the command when explicitly asked via a plugopt only.
c3caec
c3caec
Related: #2376
c3caec
Resolved: #2380
c3caec
c3caec
Signed-off-by: Jan Jansky <jjansky@redhat.com>
c3caec
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
c3caec
---
c3caec
 sos/plugins/networking.py | 22 +++++++++++-----------
c3caec
 1 file changed, 11 insertions(+), 11 deletions(-)
c3caec
c3caec
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py
c3caec
index b04bb98..40f8b2f 100644
c3caec
--- a/sos/plugins/networking.py
c3caec
+++ b/sos/plugins/networking.py
c3caec
@@ -27,7 +27,8 @@ class Networking(Plugin):
c3caec
         ("namespaces", "Number of namespaces to collect, 0 for unlimited. " +
c3caec
          "Incompatible with the namespace_pattern plugin option", "slow", 0),
c3caec
         ("ethtool_namespaces", "Define if ethtool commands should be " +
c3caec
-         "collected for namespaces", "slow", True)
c3caec
+         "collected for namespaces", "slow", True),
c3caec
+        ("eepromdump", "collect 'ethtool -e' for all devices", "slow", False)
c3caec
     ]
c3caec
 
c3caec
     # switch to enable netstat "wide" (non-truncated) output mode
c3caec
@@ -186,16 +187,15 @@ class Networking(Plugin):
c3caec
                 "ethtool --show-eee " + eth
c3caec
             ])
c3caec
 
c3caec
-            # skip EEPROM collection for 'bnx2x' NICs as this command
c3caec
-            # can pause the NIC and is not production safe.
c3caec
-            bnx_output = {
c3caec
-                "cmd": "ethtool -i %s" % eth,
c3caec
-                "output": "bnx2x"
c3caec
-            }
c3caec
-            bnx_pred = SoSPredicate(self,
c3caec
-                                    cmd_outputs=bnx_output,
c3caec
-                                    required={'cmd_outputs': 'none'})
c3caec
-            self.add_cmd_output("ethtool -e %s" % eth, pred=bnx_pred)
c3caec
+            # skip EEPROM collection by default, as it might hang or
c3caec
+            # negatively impact the system on some device types
c3caec
+            if self.get_option("eepromdump"):
c3caec
+                cmd = "ethtool -e %s" % eth
c3caec
+                self._log_warn("WARNING (about to collect '%s'): collecting "
c3caec
+                               "an eeprom dump is known to cause certain NIC "
c3caec
+                               "drivers (e.g. bnx2x/tg3) to interrupt device "
c3caec
+                               "operation" % cmd)
c3caec
+                self.add_cmd_output(cmd)
c3caec
 
c3caec
         # Collect information about bridges (some data already collected via
c3caec
         # "ip .." commands)
c3caec
-- 
c3caec
1.8.3.1
c3caec