Blame SOURCES/sos-bz1917196-networking-ethtool-e-conditionally.patch

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