From a55680e6c8ac87fdf4ee3100717001c1f6f6a08b Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Thu, 9 Aug 2018 08:59:53 +0200
Subject: [PATCH 1/3] [process] make lsof execution optional
Make calling of lsof command optional (but enabled by default).
Also remove "collect lsof-threads when --all-logs" as all-logs
has nothing in common.
Resolves: #1394
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
sos/plugins/process.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sos/plugins/process.py b/sos/plugins/process.py
index 755eec8d..d1c455a5 100644
--- a/sos/plugins/process.py
+++ b/sos/plugins/process.py
@@ -17,6 +17,7 @@ class Process(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
profiles = ('system',)
option_list = [
+ ("lsof", "gathers information on all open files", "slow", True),
("lsof-threads", "gathers threads' open file info if supported",
"slow", False)
]
@@ -35,9 +36,10 @@ class Process(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
self.add_cmd_output("ps auxwww", root_symlink="ps")
self.add_cmd_output("pstree", root_symlink="pstree")
- self.add_cmd_output("lsof -b +M -n -l -c ''", root_symlink="lsof")
+ if self.get_option("lsof"):
+ self.add_cmd_output("lsof -b +M -n -l -c ''", root_symlink="lsof")
- if self.get_option("lsof-threads") or self.get_option("all_logs"):
+ if self.get_option("lsof-threads"):
self.add_cmd_output("lsof -b +M -n -l")
self.add_cmd_output([
--
2.17.1
From 48a1a00685c680ba9fbd5c9b10377e8d0551a926 Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Thu, 9 Aug 2018 18:11:38 +0200
Subject: [PATCH 2/3] [policies] RHOSP preset with -k process.lsof=off
Make lsof calls on OSP systems disabled by default.
Relevant to: #1395
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
sos/policies/redhat.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
index cfbf7808..ee687d46 100644
--- a/sos/policies/redhat.py
+++ b/sos/policies/redhat.py
@@ -192,6 +192,8 @@ ENV_HOST_SYSROOT = 'HOST'
_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'])
RHEL_RELEASE_STR = "Red Hat Enterprise Linux"
@@ -219,7 +221,7 @@ rhel_presets = {
opts=_opts_verify),
RHEL: PresetDefaults(name=RHEL, desc=RHEL_DESC),
RHOSP: PresetDefaults(name=RHOSP, desc=RHOSP_DESC, note=NOTE_SIZE,
- opts=_opts_all_logs),
+ opts=_opts_all_logs_no_lsof),
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,
--
2.17.1
From 84c30742254a536f70bb4217756416bcf0e8a51b Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Thu, 9 Aug 2018 18:14:56 +0200
Subject: [PATCH 3/3] [policies] enable RHOSP preset by presence of
rhosp-release package
Resolves: #1395
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
sos/policies/redhat.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
index ee687d46..5bfbade2 100644
--- a/sos/policies/redhat.py
+++ b/sos/policies/redhat.py
@@ -315,6 +315,8 @@ No changes will be made to system configuration.
# Package based checks
if self.pkg_by_name("satellite-common") is not None:
return self.find_preset(RH_SATELLITE)
+ if self.pkg_by_name("rhosp-release") is not None:
+ return self.find_preset(RHOSP)
# Vanilla RHEL is default
return self.find_preset(RHEL)
--
2.17.1