aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man/en/sos-collect.16
-rw-r--r--man/en/sos-report.119
-rw-r--r--sos/collector/__init__.py4
-rw-r--r--sos/collector/sosnode.py6
-rw-r--r--sos/report/__init__.py36
5 files changed, 71 insertions, 0 deletions
diff --git a/man/en/sos-collect.1 b/man/en/sos-collect.1
index a1f6c10e..9b0a5d7b 100644
--- a/man/en/sos-collect.1
+++ b/man/en/sos-collect.1
@@ -11,6 +11,7 @@ sos collect \- Collect sosreports from multiple (cluster) nodes
[\-\-chroot CHROOT]
[\-\-case\-id CASE_ID]
[\-\-cluster\-type CLUSTER_TYPE]
+ [\-\-container\-runtime RUNTIME]
[\-e ENABLE_PLUGINS]
[--encrypt-key KEY]\fR
[--encrypt-pass PASS]\fR
@@ -113,6 +114,11 @@ Example: \fBsos collect --cluster-type=kubernetes\fR will force the kubernetes p
to be run, and thus set sosreport options and attempt to determine a list of nodes using
that profile.
.TP
+\fB\-\-container\-runtime\fR RUNTIME
+\fB sos report\fR option. Using this with \fBcollect\fR will pass this option thru
+to nodes with sos version 4.3 or later. This option controls the default container
+runtime plugins will use for collections. See \fBman sos-report\fR.
+.TP
\fB\-e\fR ENABLE_PLUGINS, \fB\-\-enable\-plugins\fR ENABLE_PLUGINS
Sosreport option. Use this to enable a plugin that would otherwise not be run.
diff --git a/man/en/sos-report.1 b/man/en/sos-report.1
index e8efc8f8..464a77e5 100644
--- a/man/en/sos-report.1
+++ b/man/en/sos-report.1
@@ -19,6 +19,7 @@ sos report \- Collect and package diagnostic and support data
[--plugin-timeout TIMEOUT]\fR
[--cmd-timeout TIMEOUT]\fR
[--namespaces NAMESPACES]\fR
+ [--container-runtime RUNTIME]\fR
[-s|--sysroot SYSROOT]\fR
[-c|--chroot {auto|always|never}\fR
[--tmp-dir directory]\fR
@@ -299,6 +300,24 @@ Use '0' (default) for no limit - all namespaces will be used for collections.
Note that specific plugins may provide a similar `namespaces` plugin option. If
the plugin option is used, it will override this option.
+.TP
+.B \--container-runtime RUNTIME
+Force the use of the specified RUNTIME as the default runtime that plugins will
+use to collect data from and about containers and container images. By default,
+the setting of \fBauto\fR results in the local policy determining what runtime
+will be the default runtime (in configurations where multiple runtimes are installed
+and active).
+
+If no container runtimes are active, this option is ignored. If there are runtimes
+active, but not one with a name matching RUNTIME, sos will abort.
+
+Setting this to \fBnone\fR, \fBoff\fR, or \fBdisabled\fR will cause plugins to
+\fBNOT\fR leverage any active runtimes for collections. Note that if disabled, plugins
+specifically for runtimes (e.g. the podman or docker plugins) will still collect
+general data about the runtime, but will not inspect existing containers or images.
+
+Default: 'auto' (policy determined)
+.TP
.B \--case-id NUMBER
Specify a case identifier to associate with the archive.
Identifiers may include alphanumeric characters, commas and periods ('.').
diff --git a/sos/collector/__init__.py b/sos/collector/__init__.py
index 42a7731d..3ad703d3 100644
--- a/sos/collector/__init__.py
+++ b/sos/collector/__init__.py
@@ -55,6 +55,7 @@ class SoSCollector(SoSComponent):
'clean': False,
'cluster_options': [],
'cluster_type': None,
+ 'container_runtime': 'auto',
'domains': [],
'enable_plugins': [],
'encrypt_key': '',
@@ -268,6 +269,9 @@ class SoSCollector(SoSComponent):
sos_grp.add_argument('--chroot', default='',
choices=['auto', 'always', 'never'],
help="chroot executed commands to SYSROOT")
+ sos_grp.add_argument("--container-runtime", default="auto",
+ help="Default container runtime to use for "
+ "collections. 'auto' for policy control.")
sos_grp.add_argument('-e', '--enable-plugins', action="extend",
help='Enable specific plugins for sosreport')
sos_grp.add_argument('-k', '--plugin-option', '--plugopts',
diff --git a/sos/collector/sosnode.py b/sos/collector/sosnode.py
index ab7f23cc..f5957e17 100644
--- a/sos/collector/sosnode.py
+++ b/sos/collector/sosnode.py
@@ -586,6 +586,12 @@ class SosNode():
sos_opts.append('--cmd-timeout=%s'
% quote(str(self.opts.cmd_timeout)))
+ if self.check_sos_version('4.3'):
+ if self.opts.container_runtime != 'auto':
+ sos_opts.append(
+ "--container-runtime=%s" % self.opts.container_runtime
+ )
+
self.update_cmd_from_cluster()
sos_cmd = sos_cmd.replace(
diff --git a/sos/report/__init__.py b/sos/report/__init__.py
index a6c72778..0daad82f 100644
--- a/sos/report/__init__.py
+++ b/sos/report/__init__.py
@@ -82,6 +82,7 @@ class SoSReport(SoSComponent):
'case_id': '',
'chroot': 'auto',
'clean': False,
+ 'container_runtime': 'auto',
'keep_binary_files': False,
'desc': '',
'domains': [],
@@ -187,6 +188,7 @@ class SoSReport(SoSComponent):
self.tempfile_util.clean()
self._exit(1)
+ self._check_container_runtime()
self._get_hardware_devices()
self._get_namespaces()
@@ -218,6 +220,9 @@ class SoSReport(SoSComponent):
dest="chroot", default='auto',
help="chroot executed commands to SYSROOT "
"[auto, always, never] (default=auto)")
+ report_grp.add_argument("--container-runtime", default="auto",
+ help="Default container runtime to use for "
+ "collections. 'auto' for policy control.")
report_grp.add_argument("--desc", "--description", type=str,
action="store", default="",
help="Description for a new preset",)
@@ -373,6 +378,37 @@ class SoSReport(SoSComponent):
}
# TODO: enumerate network devices, preferably with devtype info
+ def _check_container_runtime(self):
+ """Check the loaded container runtimes, and the policy default runtime
+ (if set), against any requested --container-runtime value. This can be
+ useful for systems that have multiple runtimes, such as RHCOS, but do
+ not have a clearly defined 'default' (or one that is determined based
+ entirely on configuration).
+ """
+ if self.opts.container_runtime != 'auto':
+ crun = self.opts.container_runtime.lower()
+ if crun in ['none', 'off', 'diabled']:
+ self.policy.runtimes = {}
+ self.soslog.info(
+ "Disabled all container runtimes per user option."
+ )
+ elif not self.policy.runtimes:
+ msg = ("WARNING: No container runtimes are active, ignoring "
+ "option to set default runtime to '%s'\n" % crun)
+ self.soslog.warn(msg)
+ elif crun not in self.policy.runtimes.keys():
+ valid = ', '.join(p for p in self.policy.runtimes.keys()
+ if p != 'default')
+ raise Exception("Cannot use container runtime '%s': no such "
+ "runtime detected. Available runtimes: %s"
+ % (crun, valid))
+ else:
+ self.policy.runtimes['default'] = self.policy.runtimes[crun]
+ self.soslog.info(
+ "Set default container runtime to '%s'"
+ % self.policy.runtimes['default'].name
+ )
+
def get_fibre_devs(self):
"""Enumerate a list of fibrechannel devices on this system so that
plugins can iterate over them