Blame SOURCES/sos-bz1644021-brctl-deprecated.patch

fce3c4
From 4c377f04f571c2d265a564bb27961bac5fd4a854 Mon Sep 17 00:00:00 2001
fce3c4
From: Pavel Moravec <pmoravec@redhat.com>
fce3c4
Date: Mon, 5 Nov 2018 14:33:50 +0100
fce3c4
Subject: [PATCH] [networking] Replace "brctl: by "bridge" commands
fce3c4
fce3c4
As bridge-utils containing brctl command are being deprecated,
fce3c4
sosreport should call bridge command instead.
fce3c4
fce3c4
Although the mapping of the commands is not 1:1, the data collected
fce3c4
(together with few "ip .." commands) will remain the same.
fce3c4
fce3c4
Resolves: #1472
fce3c4
fce3c4
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
fce3c4
---
fce3c4
 sos/plugins/networking.py | 38 ++++++++------------------------------
fce3c4
 sos/plugins/xen.py        |  2 +-
fce3c4
 2 files changed, 9 insertions(+), 31 deletions(-)
fce3c4
fce3c4
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py
fce3c4
index fa3d0cda..5f532707 100644
fce3c4
--- a/sos/plugins/networking.py
fce3c4
+++ b/sos/plugins/networking.py
fce3c4
@@ -25,24 +25,6 @@ class Networking(Plugin):
fce3c4
     # switch to enable netstat "wide" (non-truncated) output mode
fce3c4
     ns_wide = "-W"
fce3c4
 
fce3c4
-    def get_bridge_name(self, brctl_file):
fce3c4
-        """Return a list for which items are bridge name according to the
fce3c4
-        output of brctl show stored in brctl_file.
fce3c4
-        """
fce3c4
-        out = []
fce3c4
-        try:
fce3c4
-            brctl_out = open(brctl_file).read()
fce3c4
-        except IOError:
fce3c4
-            return out
fce3c4
-        for line in brctl_out.splitlines():
fce3c4
-            if line.startswith("bridge name") \
fce3c4
-               or line.isspace() \
fce3c4
-               or line[:1].isspace():
fce3c4
-                continue
fce3c4
-            br_name, br_rest = line.split(None, 1)
fce3c4
-            out.append(br_name)
fce3c4
-        return out
fce3c4
-
fce3c4
     def get_eth_interfaces(self, ip_link_out):
fce3c4
         """Return a dictionary for which keys are ethernet interface
fce3c4
         names taken from the output of "ip -o link".
fce3c4
@@ -215,18 +197,14 @@ class Networking(Plugin):
fce3c4
                     "ethtool -g "+eth
fce3c4
                 ])
fce3c4
 
fce3c4
-        # brctl command will load bridge and related kernel modules
fce3c4
-        # if those modules are not loaded at the time of brctl command running
fce3c4
-        # This behaviour causes an unexpected configuration change for system.
fce3c4
-        # sosreport should aovid such situation.
fce3c4
-        if self.is_module_loaded("bridge"):
fce3c4
-            brctl_file = self.get_cmd_output_now("brctl show")
fce3c4
-            if brctl_file:
fce3c4
-                for br_name in self.get_bridge_name(brctl_file):
fce3c4
-                    self.add_cmd_output([
fce3c4
-                        "brctl showstp "+br_name,
fce3c4
-                        "brctl showmacs "+br_name
fce3c4
-                    ])
fce3c4
+        # Collect information about bridges (some data already collected via
fce3c4
+        # "ip .." commands)
fce3c4
+        self.add_cmd_output([
fce3c4
+            "bridge -s -s -d link show",
fce3c4
+            "bridge -s -s -d -t fdb show",
fce3c4
+            "bridge -s -s -d -t mdb show",
fce3c4
+            "bridge -d vlan show"
fce3c4
+        ])
fce3c4
 
fce3c4
         if self.get_option("traceroute"):
fce3c4
             self.add_cmd_output("/bin/traceroute -n %s" % self.trace_host)
fce3c4
diff --git a/sos/plugins/xen.py b/sos/plugins/xen.py
fce3c4
index 2ad8dae9..ace6c362 100644
fce3c4
--- a/sos/plugins/xen.py
fce3c4
+++ b/sos/plugins/xen.py
fce3c4
@@ -78,7 +78,7 @@ class Xen(Plugin, RedHatPlugin):
fce3c4
                 "xm info",
fce3c4
                 "xm list",
fce3c4
                 "xm list --long",
fce3c4
-                "brctl show"
fce3c4
+                "bridge link show"
fce3c4
             ])
fce3c4
             self.dom_collect_proc()
fce3c4
             if self.is_running_xenstored():
fce3c4
-- 
fce3c4
2.17.2
fce3c4