diff options
-rw-r--r-- | sos/plugins/__init__.py | 7 | ||||
-rw-r--r-- | sos/plugins/networking.py | 19 |
2 files changed, 19 insertions, 7 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index 6731b285..b34c3bbc 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -662,6 +662,13 @@ class Plugin(object): return os.path.join(self.archive.get_archive_path(), outfn) + 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 None + else: + return True + # For adding output def add_alert(self, alertstring): """Add an alert to the collection of alerts for this plugin. These diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py index f39f126b..c7ee76b5 100644 --- a/sos/plugins/networking.py +++ b/sos/plugins/networking.py @@ -191,13 +191,18 @@ class Networking(Plugin): "ethtool -g "+eth ]) - brctl_file = self.get_cmd_output_now("brctl show") - if brctl_file: - for br_name in self.get_bridge_name(brctl_file): - self.add_cmd_output([ - "brctl showstp "+br_name, - "brctl showmacs "+br_name - ]) + # brctl command will load bridge and related kernel modules + # if those modules are not loaded at the time of brctl command running + # This behaviour causes an unexpected configuration change for system. + # sosreport should aovid such situation. + if self.is_module_loaded("bridge"): + brctl_file = self.get_cmd_output_now("brctl show") + if brctl_file: + for br_name in self.get_bridge_name(brctl_file): + self.add_cmd_output([ + "brctl showstp "+br_name, + "brctl showmacs "+br_name + ]) if self.get_option("traceroute"): self.add_cmd_output("/bin/traceroute -n %s" % self.trace_host) |