Compare commits
2 Commits
imports/c8
...
c8
Author | SHA1 | Date | |
---|---|---|---|
|
d3d85322b2 | ||
|
c945055d10 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
SOURCES/sos-collector-1.7.tar.gz
|
SOURCES/sos-collector-1.8.tar.gz
|
||||||
|
@ -1 +1 @@
|
|||||||
5a4f3d843e90ac35af70c2da2e1b18a62df036c3 SOURCES/sos-collector-1.7.tar.gz
|
32b09cbab87d66d8b19f95db977c29f0fb828202 SOURCES/sos-collector-1.8.tar.gz
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
From 0bc831a07be6ae837cb9029943c57255c47b647f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
Date: Tue, 9 Apr 2019 12:59:03 -0400
|
|
||||||
Subject: [PATCH] [sosnode] Don't create a container if we're in a container
|
|
||||||
|
|
||||||
If sos-collector is being launched from a container on a containerized
|
|
||||||
host, we could potentially attempt to create a nested container.
|
|
||||||
|
|
||||||
This change means we treat a sos-collector run that is already in a
|
|
||||||
container as a "normal" host and don't attempt the containerized bits.
|
|
||||||
|
|
||||||
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
---
|
|
||||||
soscollector/sosnode.py | 19 ++++++++++++++++++-
|
|
||||||
1 file changed, 18 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/soscollector/sosnode.py b/soscollector/sosnode.py
|
|
||||||
index a040244..405d05d 100644
|
|
||||||
--- a/soscollector/sosnode.py
|
|
||||||
+++ b/soscollector/sosnode.py
|
|
||||||
@@ -68,10 +68,14 @@ class SosNode():
|
|
||||||
self.connected = False
|
|
||||||
self.close_ssh_session()
|
|
||||||
return None
|
|
||||||
+ if self.local:
|
|
||||||
+ if self.check_in_container():
|
|
||||||
+ self.host.containerized = False
|
|
||||||
self.log_debug("Host facts found to be %s" %
|
|
||||||
self.host.report_facts())
|
|
||||||
self.get_hostname()
|
|
||||||
- self.create_sos_container()
|
|
||||||
+ if self.host.containerized:
|
|
||||||
+ self.create_sos_container()
|
|
||||||
self._load_sos_info()
|
|
||||||
|
|
||||||
def _create_ssh_command(self):
|
|
||||||
@@ -84,6 +88,19 @@ class SosNode():
|
|
||||||
return '{:<{}} : {}'.format(self._hostname, self.config['hostlen'] + 1,
|
|
||||||
msg)
|
|
||||||
|
|
||||||
+ def check_in_container(self):
|
|
||||||
+ '''
|
|
||||||
+ Tries to identify if we are currently running in a container or not.
|
|
||||||
+ '''
|
|
||||||
+ if os.path.exists('/run/.containerenv'):
|
|
||||||
+ self.log_debug('Found /run/.containerenv. Running in container.')
|
|
||||||
+ return True
|
|
||||||
+ if os.environ.get('container') is not None:
|
|
||||||
+ self.log_debug("Found env var 'container'. Running in container")
|
|
||||||
+ return True
|
|
||||||
+ return False
|
|
||||||
+
|
|
||||||
+
|
|
||||||
def create_sos_container(self):
|
|
||||||
'''If the host is containerized, create the container we'll be using
|
|
||||||
'''
|
|
||||||
--
|
|
||||||
2.17.2
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
From a614ed8e5621f931d8ee76f1f59747a46144cb2d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
Date: Thu, 4 Apr 2019 14:19:13 -0400
|
|
||||||
Subject: [PATCH] [jbon] Fix typo in check_enabled()
|
|
||||||
|
|
||||||
Fixes a typo in the check_enabled() method that could potentially
|
|
||||||
prevent sos-collector from correctly determining the cluster type on
|
|
||||||
python3 under certain circumstances.
|
|
||||||
|
|
||||||
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
---
|
|
||||||
soscollector/clusters/jbon.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/soscollector/clusters/jbon.py b/soscollector/clusters/jbon.py
|
|
||||||
index 28552ff..ea85ddf 100644
|
|
||||||
--- a/soscollector/clusters/jbon.py
|
|
||||||
+++ b/soscollector/clusters/jbon.py
|
|
||||||
@@ -28,7 +28,7 @@ class jbon(Cluster):
|
|
||||||
def get_nodes(self):
|
|
||||||
return []
|
|
||||||
|
|
||||||
- def checK_enabled(self):
|
|
||||||
+ def check_enabled(self):
|
|
||||||
# This should never be called, but as insurance explicitly never
|
|
||||||
# allow this to be enabled via the determine_cluster() path
|
|
||||||
return False
|
|
||||||
--
|
|
||||||
2.17.2
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
From 76ca28dc5ce222d24086b387a448ceeb53055e4b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
Date: Wed, 15 May 2019 16:21:01 -0400
|
|
||||||
Subject: [PATCH] [sosnode] Properly quote commands that need a pty
|
|
||||||
|
|
||||||
When we run locally and need a pty, we need to quote the command and
|
|
||||||
launch it in a bash shell to function correctly with pexpect.spawn().
|
|
||||||
|
|
||||||
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
---
|
|
||||||
soscollector/sosnode.py | 3 +++
|
|
||||||
1 file changed, 3 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/soscollector/sosnode.py b/soscollector/sosnode.py
|
|
||||||
index 6c01471..fc42b94 100644
|
|
||||||
--- a/soscollector/sosnode.py
|
|
||||||
+++ b/soscollector/sosnode.py
|
|
||||||
@@ -366,6 +366,9 @@ class SosNode():
|
|
||||||
get_pty = True
|
|
||||||
if not self.local and not force_local:
|
|
||||||
cmd = "%s %s" % (self.ssh_cmd, quote(cmd))
|
|
||||||
+ else:
|
|
||||||
+ if get_pty:
|
|
||||||
+ cmd = "/bin/bash -c %s" % quote(cmd)
|
|
||||||
res = pexpect.spawn(cmd, encoding='utf-8')
|
|
||||||
if need_root:
|
|
||||||
if self.config['need_sudo']:
|
|
||||||
--
|
|
||||||
2.17.2
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
From 6dafb42064b06a80720c6017e2576aea9a7211de Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
Date: Tue, 9 Apr 2019 13:00:44 -0400
|
|
||||||
Subject: [PATCH] [redhat] Update RHCOS image
|
|
||||||
|
|
||||||
Updates the image used by RHCOS nodes to be the rhel8 image instead
|
|
||||||
of rhel7.
|
|
||||||
|
|
||||||
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
---
|
|
||||||
soscollector/hosts/redhat.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/soscollector/hosts/redhat.py b/soscollector/hosts/redhat.py
|
|
||||||
index 33cec1f..774ecec 100644
|
|
||||||
--- a/soscollector/hosts/redhat.py
|
|
||||||
+++ b/soscollector/hosts/redhat.py
|
|
||||||
@@ -66,7 +66,7 @@ class RedHatCoreOSHost(RedHatHost):
|
|
||||||
|
|
||||||
containerized = True
|
|
||||||
container_runtime = 'podman'
|
|
||||||
- container_image = 'registry.redhat.io/rhel7/support-tools'
|
|
||||||
+ container_image = 'registry.redhat.io/rhel8/support-tools'
|
|
||||||
sos_path_strip = '/host'
|
|
||||||
|
|
||||||
def check_enabled(self, rel_string):
|
|
||||||
--
|
|
||||||
2.17.2
|
|
||||||
|
|
@ -1,172 +0,0 @@
|
|||||||
From 9108f2f83613bce42e8be91bbe7fe91fd1b1763a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
Date: Thu, 18 Apr 2019 14:58:23 -0400
|
|
||||||
Subject: [PATCH] [sos-collector] Fix --list-options output
|
|
||||||
|
|
||||||
Fixes the output of --list-options to include layered profiles when
|
|
||||||
reporting base profile options.
|
|
||||||
|
|
||||||
Additionally adds output of the cluster types supported by the local
|
|
||||||
installation of sos-collector. Added cluster_name values to clusters
|
|
||||||
that were missing them.
|
|
||||||
|
|
||||||
Fixes: #22
|
|
||||||
|
|
||||||
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
---
|
|
||||||
soscollector/clusters/jbon.py | 1 +
|
|
||||||
soscollector/clusters/kubernetes.py | 1 +
|
|
||||||
soscollector/clusters/pacemaker.py | 1 +
|
|
||||||
soscollector/clusters/satellite.py | 1 +
|
|
||||||
soscollector/sos_collector.py | 40 +++++++++++++++++------------
|
|
||||||
5 files changed, 27 insertions(+), 17 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/soscollector/clusters/jbon.py b/soscollector/clusters/jbon.py
|
|
||||||
index ea85ddf..0c53093 100644
|
|
||||||
--- a/soscollector/clusters/jbon.py
|
|
||||||
+++ b/soscollector/clusters/jbon.py
|
|
||||||
@@ -23,6 +23,7 @@ class jbon(Cluster):
|
|
||||||
use the provided --nodes list
|
|
||||||
'''
|
|
||||||
|
|
||||||
+ cluster_name = 'Just a Bunch Of Nodes (no cluster)'
|
|
||||||
packages = None
|
|
||||||
|
|
||||||
def get_nodes(self):
|
|
||||||
diff --git a/soscollector/clusters/kubernetes.py b/soscollector/clusters/kubernetes.py
|
|
||||||
index e18ee71..32bc68b 100644
|
|
||||||
--- a/soscollector/clusters/kubernetes.py
|
|
||||||
+++ b/soscollector/clusters/kubernetes.py
|
|
||||||
@@ -19,6 +19,7 @@ from soscollector.clusters import Cluster
|
|
||||||
|
|
||||||
class kubernetes(Cluster):
|
|
||||||
|
|
||||||
+ cluster_name = 'Community Kubernetes'
|
|
||||||
packages = ('kubernetes-master',)
|
|
||||||
sos_plugins = ['kubernetes']
|
|
||||||
sos_plugin_options = {'kubernetes.all': 'on'}
|
|
||||||
diff --git a/soscollector/clusters/pacemaker.py b/soscollector/clusters/pacemaker.py
|
|
||||||
index 778d8ae..be6c09e 100644
|
|
||||||
--- a/soscollector/clusters/pacemaker.py
|
|
||||||
+++ b/soscollector/clusters/pacemaker.py
|
|
||||||
@@ -18,6 +18,7 @@ from soscollector.clusters import Cluster
|
|
||||||
|
|
||||||
class pacemaker(Cluster):
|
|
||||||
|
|
||||||
+ cluster_name = 'Pacemaker High Availability Cluster Manager'
|
|
||||||
sos_plugins = ['pacemaker']
|
|
||||||
packages = ('pacemaker',)
|
|
||||||
option_list = [
|
|
||||||
diff --git a/soscollector/clusters/satellite.py b/soscollector/clusters/satellite.py
|
|
||||||
index ccdfefb..2c5c73d 100644
|
|
||||||
--- a/soscollector/clusters/satellite.py
|
|
||||||
+++ b/soscollector/clusters/satellite.py
|
|
||||||
@@ -20,6 +20,7 @@ from soscollector.clusters import Cluster
|
|
||||||
class satellite(Cluster):
|
|
||||||
"""Red Hat Satellite 6"""
|
|
||||||
|
|
||||||
+ cluster_name = 'Red Hat Satellite 6'
|
|
||||||
packages = ('satellite', 'satellite-installer')
|
|
||||||
|
|
||||||
def _psql_cmd(self, query):
|
|
||||||
diff --git a/soscollector/sos_collector.py b/soscollector/sos_collector.py
|
|
||||||
index 54410a2..5b31602 100644
|
|
||||||
--- a/soscollector/sos_collector.py
|
|
||||||
+++ b/soscollector/sos_collector.py
|
|
||||||
@@ -218,19 +218,28 @@ class SosCollector():
|
|
||||||
|
|
||||||
def list_options(self):
|
|
||||||
'''Display options for available clusters'''
|
|
||||||
+
|
|
||||||
+ sys.stdout.write('\nThe following clusters are supported by this '
|
|
||||||
+ 'installation\n')
|
|
||||||
+ sys.stdout.write('Use the short name with --cluster-type or cluster '
|
|
||||||
+ 'options (-c)\n\n')
|
|
||||||
+ for cluster in sorted(self.clusters, key=lambda x: self.clusters[x]):
|
|
||||||
+ sys.stdout.write(" {:<15} {:30}\n".format(
|
|
||||||
+ cluster,
|
|
||||||
+ self.clusters[cluster].cluster_name))
|
|
||||||
+
|
|
||||||
_opts = {}
|
|
||||||
for _cluster in self.clusters:
|
|
||||||
for opt in self.clusters[_cluster].options:
|
|
||||||
if opt.name not in _opts.keys():
|
|
||||||
_opts[opt.name] = opt
|
|
||||||
else:
|
|
||||||
- clust = _opts[opt.name].cluster
|
|
||||||
- if any(c in opt.cluster for c in clust):
|
|
||||||
- _opts[opt.name].cluster = ','.join(clust)
|
|
||||||
- else:
|
|
||||||
- _opts[opt.name] = opt
|
|
||||||
- print('\nThe following cluster options are available:\n')
|
|
||||||
- print('{:25} {:15} {:<10} {:10} {:<}'.format(
|
|
||||||
+ for clust in opt.cluster:
|
|
||||||
+ if clust not in _opts[opt.name].cluster:
|
|
||||||
+ _opts[opt.name].cluster.append(clust)
|
|
||||||
+
|
|
||||||
+ sys.stdout.write('\nThe following cluster options are available:\n\n')
|
|
||||||
+ sys.stdout.write(' {:25} {:15} {:<10} {:10} {:<}\n'.format(
|
|
||||||
'Cluster',
|
|
||||||
'Option Name',
|
|
||||||
'Type',
|
|
||||||
@@ -239,20 +248,17 @@ class SosCollector():
|
|
||||||
))
|
|
||||||
|
|
||||||
for _opt in sorted(_opts, key=lambda x: _opts[x].cluster):
|
|
||||||
- _clus = None
|
|
||||||
opt = _opts[_opt]
|
|
||||||
- if isinstance(opt.cluster, list):
|
|
||||||
- _clus = opt.cluster[0]
|
|
||||||
- optln = '{:25} {:15} {:<10} {:<10} {:<10}'.format(
|
|
||||||
- _clus or opt.cluster,
|
|
||||||
+ optln = ' {:25} {:15} {:<10} {:<10} {:<10}\n'.format(
|
|
||||||
+ ', '.join(c for c in sorted(opt.cluster)),
|
|
||||||
opt.name,
|
|
||||||
opt.opt_type.__name__,
|
|
||||||
str(opt.value),
|
|
||||||
- opt.description
|
|
||||||
- )
|
|
||||||
- print(optln)
|
|
||||||
- print('\nOptions take the form of cluster.name=value'
|
|
||||||
- '\nE.G. "ovirt.no-database=True" or "pacemaker.offline=False"')
|
|
||||||
+ opt.description)
|
|
||||||
+ sys.stdout.write(optln)
|
|
||||||
+ sys.stdout.write('\nOptions take the form of cluster.name=value'
|
|
||||||
+ '\nE.G. "ovirt.no-database=True" or '
|
|
||||||
+ '"pacemaker.offline=False"\n')
|
|
||||||
|
|
||||||
def delete_tmp_dir(self):
|
|
||||||
'''Removes the temp directory and all collected sosreports'''
|
|
||||||
--
|
|
||||||
2.17.2
|
|
||||||
|
|
||||||
From 70faf097e9d36898cfc624e9e57f46eea25d321c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
Date: Tue, 2 Jul 2019 12:35:14 -0400
|
|
||||||
Subject: [PATCH] [sos-collector] Remove key sorting on cluster list
|
|
||||||
|
|
||||||
On python3, using the cluster key on sorting the list was causing an
|
|
||||||
exception. After testing, it appears a normal keyless sort still gives
|
|
||||||
us the desired effect, so remove the key sorting.
|
|
||||||
|
|
||||||
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
---
|
|
||||||
soscollector/sos_collector.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/soscollector/sos_collector.py b/soscollector/sos_collector.py
|
|
||||||
index a691219..d0a598f 100644
|
|
||||||
--- a/soscollector/sos_collector.py
|
|
||||||
+++ b/soscollector/sos_collector.py
|
|
||||||
@@ -223,7 +223,7 @@ class SosCollector():
|
|
||||||
'installation\n')
|
|
||||||
sys.stdout.write('Use the short name with --cluster-type or cluster '
|
|
||||||
'options (-c)\n\n')
|
|
||||||
- for cluster in sorted(self.clusters, key=lambda x: self.clusters[x]):
|
|
||||||
+ for cluster in sorted(self.clusters):
|
|
||||||
sys.stdout.write(" {:<15} {:30}\n".format(
|
|
||||||
cluster,
|
|
||||||
self.clusters[cluster].cluster_name))
|
|
||||||
--
|
|
||||||
2.17.2
|
|
||||||
|
|
@ -1,234 +0,0 @@
|
|||||||
From fb8c2af36672b5868f504bae0704392f9e9b44a5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
Date: Fri, 12 Apr 2019 14:45:01 -0400
|
|
||||||
Subject: [PATCH 1/3] [clusters] Add a cluster_name class member for better
|
|
||||||
identification
|
|
||||||
|
|
||||||
Adds a cluster_name class member to Cluster() so that clusters may
|
|
||||||
specify a well-defined name beyond the name/acronym used to enable the
|
|
||||||
cluster manually.
|
|
||||||
|
|
||||||
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
---
|
|
||||||
soscollector/clusters/__init__.py | 9 +++++++++
|
|
||||||
soscollector/sos_collector.py | 3 +--
|
|
||||||
soscollector/sosnode.py | 1 -
|
|
||||||
3 files changed, 10 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/soscollector/clusters/__init__.py b/soscollector/clusters/__init__.py
|
|
||||||
index b9d2418..c1bd360 100644
|
|
||||||
--- a/soscollector/clusters/__init__.py
|
|
||||||
+++ b/soscollector/clusters/__init__.py
|
|
||||||
@@ -26,6 +26,7 @@ class Cluster(object):
|
|
||||||
sos_plugins = []
|
|
||||||
sos_plugin_options = {}
|
|
||||||
sos_preset = ''
|
|
||||||
+ cluster_name = None
|
|
||||||
|
|
||||||
def __init__(self, config):
|
|
||||||
'''This is the class that cluster profile should subclass in order to
|
|
||||||
@@ -50,6 +51,14 @@ class Cluster(object):
|
|
||||||
self.options = []
|
|
||||||
self._get_options()
|
|
||||||
|
|
||||||
+ @classmethod
|
|
||||||
+ def name(cls):
|
|
||||||
+ '''Returns the cluster's name as a string.
|
|
||||||
+ '''
|
|
||||||
+ if cls.cluster_name:
|
|
||||||
+ return cls.cluster_name
|
|
||||||
+ return cls.__name__.lower()
|
|
||||||
+
|
|
||||||
def _get_options(self):
|
|
||||||
'''Loads the options defined by a cluster and sets the default value'''
|
|
||||||
for opt in self.option_list:
|
|
||||||
diff --git a/soscollector/sos_collector.py b/soscollector/sos_collector.py
|
|
||||||
index fee48ab..54410a2 100644
|
|
||||||
--- a/soscollector/sos_collector.py
|
|
||||||
+++ b/soscollector/sos_collector.py
|
|
||||||
@@ -554,8 +554,7 @@ this utility or remote systems that it connects to.
|
|
||||||
break
|
|
||||||
|
|
||||||
self.config['cluster'] = cluster
|
|
||||||
- name = str(cluster.__class__.__name__).lower()
|
|
||||||
- self.config['cluster_type'] = name
|
|
||||||
+ self.config['cluster_type'] = cluster.name()
|
|
||||||
self.log_info(
|
|
||||||
'Cluster type set to %s' % self.config['cluster_type'])
|
|
||||||
break
|
|
||||||
diff --git a/soscollector/sosnode.py b/soscollector/sosnode.py
|
|
||||||
index 405d05d..3aba0bf 100644
|
|
||||||
--- a/soscollector/sosnode.py
|
|
||||||
+++ b/soscollector/sosnode.py
|
|
||||||
@@ -100,7 +100,6 @@ class SosNode():
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
-
|
|
||||||
def create_sos_container(self):
|
|
||||||
'''If the host is containerized, create the container we'll be using
|
|
||||||
'''
|
|
||||||
--
|
|
||||||
2.17.2
|
|
||||||
|
|
||||||
|
|
||||||
From 8d94e9ee9162c1b7676822958a94dfcd727d6dc8 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
Date: Fri, 12 Apr 2019 14:47:31 -0400
|
|
||||||
Subject: [PATCH 2/3] [clusters] Add cluster_name where appropriate
|
|
||||||
|
|
||||||
Adds a cluster_name to a few of the existing cluster profiles.
|
|
||||||
|
|
||||||
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
---
|
|
||||||
soscollector/clusters/kubernetes.py | 1 +
|
|
||||||
soscollector/clusters/ovirt.py | 2 ++
|
|
||||||
2 files changed, 3 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/soscollector/clusters/kubernetes.py b/soscollector/clusters/kubernetes.py
|
|
||||||
index c5c2094..e18ee71 100644
|
|
||||||
--- a/soscollector/clusters/kubernetes.py
|
|
||||||
+++ b/soscollector/clusters/kubernetes.py
|
|
||||||
@@ -52,6 +52,7 @@ class kubernetes(Cluster):
|
|
||||||
|
|
||||||
class openshift(kubernetes):
|
|
||||||
|
|
||||||
+ cluster_name = 'OpenShift Container Platform'
|
|
||||||
packages = ('atomic-openshift',)
|
|
||||||
sos_preset = 'ocp'
|
|
||||||
cmd = 'oc'
|
|
||||||
diff --git a/soscollector/clusters/ovirt.py b/soscollector/clusters/ovirt.py
|
|
||||||
index 0a074ca..18cbf2e 100644
|
|
||||||
--- a/soscollector/clusters/ovirt.py
|
|
||||||
+++ b/soscollector/clusters/ovirt.py
|
|
||||||
@@ -23,6 +23,7 @@ from getpass import getpass
|
|
||||||
|
|
||||||
class ovirt(Cluster):
|
|
||||||
|
|
||||||
+ cluster_name = 'oVirt'
|
|
||||||
packages = ('ovirt-engine',)
|
|
||||||
|
|
||||||
option_list = [
|
|
||||||
@@ -122,6 +123,7 @@ class ovirt(Cluster):
|
|
||||||
|
|
||||||
class rhv(ovirt):
|
|
||||||
|
|
||||||
+ cluster_name = 'Red Hat Virtualization'
|
|
||||||
packages = ('rhevm', 'rhvm')
|
|
||||||
sos_preset = 'rhv'
|
|
||||||
|
|
||||||
--
|
|
||||||
2.17.2
|
|
||||||
|
|
||||||
|
|
||||||
From 4606699e9a460ebd6345444ae915ff8384619ed3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
Date: Tue, 16 Apr 2019 15:41:33 -0400
|
|
||||||
Subject: [PATCH 3/3] [ovirt] Add RHHI-V support
|
|
||||||
|
|
||||||
Adds support for RHHI-V environments which are RHV environments that
|
|
||||||
also use the hypervisors as gluster nodes. The new 'rhhi_virt' cluster
|
|
||||||
profile will be enabled when sos-collector is run against an environment
|
|
||||||
that is _both_ RHV and has nodes listed in the 'gluster_server' table in
|
|
||||||
the RHV database. Note that this means if community oVirt is in use, the
|
|
||||||
gluster bits enabled by 'rhhi_virt' will not be enabled for the oVirt
|
|
||||||
cluster type.
|
|
||||||
|
|
||||||
Included with this change is making DB queries more programmatic, and
|
|
||||||
making minor stylistic changes to the main query used by get_nodes() to
|
|
||||||
allow easier reading of the SQL query being built.
|
|
||||||
|
|
||||||
Finally, remove an unused import of getpass.
|
|
||||||
|
|
||||||
Resolves: #21
|
|
||||||
|
|
||||||
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
|
||||||
---
|
|
||||||
soscollector/clusters/ovirt.py | 44 ++++++++++++++++++++++++++--------
|
|
||||||
1 file changed, 34 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/soscollector/clusters/ovirt.py b/soscollector/clusters/ovirt.py
|
|
||||||
index 18cbf2e..8697d2e 100644
|
|
||||||
--- a/soscollector/clusters/ovirt.py
|
|
||||||
+++ b/soscollector/clusters/ovirt.py
|
|
||||||
@@ -18,13 +18,13 @@ import fnmatch
|
|
||||||
|
|
||||||
from pipes import quote
|
|
||||||
from soscollector.clusters import Cluster
|
|
||||||
-from getpass import getpass
|
|
||||||
|
|
||||||
|
|
||||||
class ovirt(Cluster):
|
|
||||||
|
|
||||||
- cluster_name = 'oVirt'
|
|
||||||
+ cluster_name = 'Community oVirt'
|
|
||||||
packages = ('ovirt-engine',)
|
|
||||||
+ db_exec = '/usr/share/ovirt-engine/dbscripts/engine-psql.sh -c'
|
|
||||||
|
|
||||||
option_list = [
|
|
||||||
('no-database', False, 'Do not collect a database dump'),
|
|
||||||
@@ -33,6 +33,14 @@ class ovirt(Cluster):
|
|
||||||
('no-hypervisors', False, 'Do not collect from hypervisors')
|
|
||||||
]
|
|
||||||
|
|
||||||
+ def _run_db_query(self, query):
|
|
||||||
+ '''
|
|
||||||
+ Wrapper for running DB queries on the master. Any scrubbing of the
|
|
||||||
+ query should be done _before_ passing the query to this method.
|
|
||||||
+ '''
|
|
||||||
+ cmd = "%s %s" % (self.db_exec, quote(query))
|
|
||||||
+ return self.exec_master_cmd(cmd, need_root=True)
|
|
||||||
+
|
|
||||||
def _sql_scrub(self, val):
|
|
||||||
'''
|
|
||||||
Manually sanitize SQL queries since we can't leave this up to the
|
|
||||||
@@ -58,18 +66,16 @@ class ovirt(Cluster):
|
|
||||||
def format_db_cmd(self):
|
|
||||||
cluster = self._sql_scrub(self.get_option('cluster'))
|
|
||||||
datacenter = self._sql_scrub(self.get_option('datacenter'))
|
|
||||||
- query = ("select host_name from vds_static where cluster_id in "
|
|
||||||
- "(select cluster_id from cluster where name like '%s'"
|
|
||||||
- " and storage_pool_id in (select id from storage_pool "
|
|
||||||
- "where name like '%s'))" % (cluster, datacenter))
|
|
||||||
- self.dbcmd = ('/usr/share/ovirt-engine/dbscripts/engine-psql.sh '
|
|
||||||
- '-c {}'.format(quote(query)))
|
|
||||||
- self.log_debug('Query command for ovirt DB set to: %s' % self.dbcmd)
|
|
||||||
+ self.dbquery = ("SELECT host_name from vds_static where cluster_id in "
|
|
||||||
+ "(select cluster_id FROM cluster WHERE name like '%s'"
|
|
||||||
+ " and storage_pool_id in (SELECT id FROM storage_pool "
|
|
||||||
+ "WHERE name like '%s'))" % (cluster, datacenter))
|
|
||||||
+ self.log_debug('Query command for ovirt DB set to: %s' % self.dbquery)
|
|
||||||
|
|
||||||
def get_nodes(self):
|
|
||||||
if self.get_option('no-hypervisors'):
|
|
||||||
return []
|
|
||||||
- res = self.exec_master_cmd(self.dbcmd, need_root=True)
|
|
||||||
+ res = self._run_db_query(self.dbquery)
|
|
||||||
if res['status'] == 0:
|
|
||||||
nodes = res['stdout'].splitlines()[2:-1]
|
|
||||||
return [n.split('(')[0].strip() for n in nodes]
|
|
||||||
@@ -134,3 +140,21 @@ class rhv(ovirt):
|
|
||||||
return 'rhvh'
|
|
||||||
else:
|
|
||||||
return 'rhelh'
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+class rhhi_virt(rhv):
|
|
||||||
+
|
|
||||||
+ cluster_name = 'Red Hat Hyperconverged Infrastructure - Virtualization'
|
|
||||||
+ sos_plugins = ('gluster',)
|
|
||||||
+ sos_plugin_options = {'gluster.dump': 'on'}
|
|
||||||
+ sos_preset = 'rhv'
|
|
||||||
+
|
|
||||||
+ def check_enabled(self):
|
|
||||||
+ return (self.master.is_installed('rhvm') and self._check_for_rhhiv())
|
|
||||||
+
|
|
||||||
+ def _check_for_rhhiv(self):
|
|
||||||
+ ret = self._run_db_query('SELECT count(server_id) FROM gluster_server')
|
|
||||||
+ if ret['status'] == 0:
|
|
||||||
+ # if there are any entries in this table, RHHI-V is in use
|
|
||||||
+ return ret['stdout'].splitlines()[2].strip() != '0'
|
|
||||||
+ return False
|
|
||||||
--
|
|
||||||
2.17.2
|
|
||||||
|
|
76
SOURCES/sos-collector-temp-location.patch
Normal file
76
SOURCES/sos-collector-temp-location.patch
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
From ac9a24c90cdbaca79951854da1f37d8a10ac8cb9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jake Hunsaker <jhunsake@redhat.com>
|
||||||
|
Date: Thu, 3 Oct 2019 11:58:04 -0400
|
||||||
|
Subject: [PATCH 1/2] [soscollector] Enable --all-logs option
|
||||||
|
|
||||||
|
The --all-logs option, while exposed via sos-collector, was not actually
|
||||||
|
being passed to sosreport on the remote nodes.
|
||||||
|
|
||||||
|
Now --all-logs is properly passed to sosreport as intended.
|
||||||
|
|
||||||
|
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
||||||
|
---
|
||||||
|
soscollector/sos_collector.py | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/soscollector/sos_collector.py b/soscollector/sos_collector.py
|
||||||
|
index 19dc368..55cd0ae 100644
|
||||||
|
--- a/soscollector/sos_collector.py
|
||||||
|
+++ b/soscollector/sos_collector.py
|
||||||
|
@@ -502,6 +502,8 @@ this utility or remote systems that it connects to.
|
||||||
|
quote(self.config['case_id']))
|
||||||
|
if self.config['alloptions']:
|
||||||
|
self.config['sos_cmd'] += ' --alloptions'
|
||||||
|
+ if self.config['all_logs']:
|
||||||
|
+ self.config['sos_cmd'] += ' --all-logs'
|
||||||
|
if self.config['verify']:
|
||||||
|
self.config['sos_cmd'] += ' --verify'
|
||||||
|
if self.config['log_size']:
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
||||||
|
|
||||||
|
From 0f599189909a6f07e148e68aeee7048c12808e37 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jake Hunsaker <jhunsake@redhat.com>
|
||||||
|
Date: Thu, 3 Oct 2019 11:54:18 -0400
|
||||||
|
Subject: [PATCH 2/2] [soscollector] Revert temp directory to /var/tmp
|
||||||
|
|
||||||
|
A previous commit inadvertantly changed the default temp directory to be
|
||||||
|
created under /tmp instead of /var/tmp. This commit fixes that and
|
||||||
|
returns the default location to /var/tmp.
|
||||||
|
|
||||||
|
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
||||||
|
---
|
||||||
|
soscollector/configuration.py | 2 +-
|
||||||
|
soscollector/sos_collector.py | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/soscollector/configuration.py b/soscollector/configuration.py
|
||||||
|
index 1c8baa1..c6f1ce3 100644
|
||||||
|
--- a/soscollector/configuration.py
|
||||||
|
+++ b/soscollector/configuration.py
|
||||||
|
@@ -45,7 +45,7 @@ class Configuration(dict):
|
||||||
|
self['ssh_key'] = None
|
||||||
|
self['sos_cmd'] = 'sosreport --batch'
|
||||||
|
self['no_local'] = False
|
||||||
|
- self['tmp_dir'] = None
|
||||||
|
+ self['tmp_dir'] = '/var/tmp'
|
||||||
|
self['out_dir'] = '/var/tmp/'
|
||||||
|
self['nodes'] = []
|
||||||
|
self['debug'] = False
|
||||||
|
diff --git a/soscollector/sos_collector.py b/soscollector/sos_collector.py
|
||||||
|
index 55cd0ae..93048d9 100644
|
||||||
|
--- a/soscollector/sos_collector.py
|
||||||
|
+++ b/soscollector/sos_collector.py
|
||||||
|
@@ -209,7 +209,7 @@ class SosCollector():
|
||||||
|
if self.config['verbose']:
|
||||||
|
self.console.debug(msg)
|
||||||
|
|
||||||
|
- def create_tmp_dir(self, location='/tmp'):
|
||||||
|
+ def create_tmp_dir(self, location='/var/tmp'):
|
||||||
|
'''Creates a temp directory to transfer sosreports to'''
|
||||||
|
tmpdir = tempfile.mkdtemp(prefix='sos-collector-', dir=location)
|
||||||
|
self.config['tmp_dir'] = tmpdir
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
Summary: Capture sosreports from multiple nodes simultaneously
|
Summary: Capture sosreports from multiple nodes simultaneously
|
||||||
Name: sos-collector
|
Name: sos-collector
|
||||||
Version: 1.7
|
Version: 1.8
|
||||||
Release: 5%{?dist}
|
Release: 2%{?dist}
|
||||||
Source0: http://people.redhat.com/jhunsake/sos-collector/%{name}-%{version}.tar.gz
|
Source0: http://people.redhat.com/jhunsake/sos-collector/%{name}-%{version}.tar.gz
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -10,12 +10,7 @@ Requires: sos >= 3.0
|
|||||||
Obsoletes: clustersos < 1.2.2-2
|
Obsoletes: clustersos < 1.2.2-2
|
||||||
Provides: clustersos = %{version}-%{release}
|
Provides: clustersos = %{version}-%{release}
|
||||||
|
|
||||||
Patch0: sos-collector-none-cluster-fix.patch
|
Patch0: sos-collector-temp-location.patch
|
||||||
Patch1: sos-collector-nested-container-fix.patch
|
|
||||||
Patch2: sos-collector-rhcos-image.patch
|
|
||||||
Patch3: sos-collector-pexpect.patch
|
|
||||||
Patch4: sos-collector-rhhiv-profile.patch
|
|
||||||
Patch5: sos-collector-rhhi-list.patch
|
|
||||||
|
|
||||||
%if 0%{?rhel} == 7
|
%if 0%{?rhel} == 7
|
||||||
BuildRequires: python-devel
|
BuildRequires: python-devel
|
||||||
@ -40,11 +35,6 @@ is run on the nodes.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
%patch1 -p1
|
|
||||||
%patch2 -p1
|
|
||||||
%patch3 -p1
|
|
||||||
%patch4 -p1
|
|
||||||
%patch5 -p1
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%if 0%{?rhel} == 7
|
%if 0%{?rhel} == 7
|
||||||
@ -83,6 +73,13 @@ install -p -m644 man/en/sos-collector.1 ${RPM_BUILD_ROOT}%{_mandir}/man1/
|
|||||||
%license LICENSE
|
%license LICENSE
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jan 07 2020 Jake Hunsaker <jhunsake@redhat.com> - 1.8-2
|
||||||
|
- Resolves: RHBZ#1750756
|
||||||
|
|
||||||
|
* Mon Oct 14 2019 Jake Hunsaker <jhunsake@redhat.com> - 1.8-1
|
||||||
|
- Rebase to upstream 1.8
|
||||||
|
- Resolves: RHBZ#1751633
|
||||||
|
|
||||||
* Fri May 24 2019 Jake Hunsaker <jhunsake@redhat.com> - 1.7-5
|
* Fri May 24 2019 Jake Hunsaker <jhunsake@redhat.com> - 1.7-5
|
||||||
- Fix local execution with pexpect
|
- Fix local execution with pexpect
|
||||||
- Fix list output exception
|
- Fix list output exception
|
||||||
|
Loading…
Reference in New Issue
Block a user