aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2022-03-21 12:05:59 -0400
committerJake Hunsaker <jhunsake@redhat.com>2022-03-28 12:42:25 -0400
commit6701a7d77ecc998b018b54ecc00f9fd102ae9518 (patch)
tree6291cd86d63a46f70a2a1b657ee68c7f42654d03
parent3b84b4ccfa9e4924a5a3829d3810568dfb69bf63 (diff)
downloadsos-6701a7d77ecc998b018b54ecc00f9fd102ae9518.tar.gz
[clusters] Allow clusters to not add localhost to node list
For most of our supported clusters, we end up needing to add the local host executing `sos collect` to the node list (unless `--no-local` is used) as that accounts for the primary node that may otherwise be left off. However, this is not helpful for clusters that may reports node names as something other than resolveable names. In those cases, such as with pacemaker, adding the local hostname may result in duplicate collections. Add a toggle to cluster profiles via a new `strict_node_list` class attr that, if True, will skip this addition. This toggle is default `False` to preserve existing behavior, and is now enabled for `pacemaker` specifically. Related: RHBZ#2065821 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/collector/__init__.py3
-rw-r--r--sos/collector/clusters/__init__.py4
-rw-r--r--sos/collector/clusters/pacemaker.py1
3 files changed, 7 insertions, 1 deletions
diff --git a/sos/collector/__init__.py b/sos/collector/__init__.py
index a8bb0064..d898ca34 100644
--- a/sos/collector/__init__.py
+++ b/sos/collector/__init__.py
@@ -1073,7 +1073,8 @@ class SoSCollector(SoSComponent):
for node in self.node_list:
if host == node.split('.')[0]:
self.node_list.remove(node)
- self.node_list.append(self.hostname)
+ if not self.cluster.strict_node_list:
+ self.node_list.append(self.hostname)
self.reduce_node_list()
try:
_node_max = len(max(self.node_list, key=len))
diff --git a/sos/collector/clusters/__init__.py b/sos/collector/clusters/__init__.py
index f3f550ad..f00677b8 100644
--- a/sos/collector/clusters/__init__.py
+++ b/sos/collector/clusters/__init__.py
@@ -57,6 +57,10 @@ class Cluster():
sos_plugin_options = {}
sos_preset = ''
cluster_name = None
+ # set this to True if the local host running collect should *not* be
+ # forcibly added to the node list. This can be helpful in situations where
+ # the host's fqdn and the name the cluster uses are different
+ strict_node_list = False
def __init__(self, commons):
self.primary = None
diff --git a/sos/collector/clusters/pacemaker.py b/sos/collector/clusters/pacemaker.py
index 49d0ce51..bebcb265 100644
--- a/sos/collector/clusters/pacemaker.py
+++ b/sos/collector/clusters/pacemaker.py
@@ -20,6 +20,7 @@ class pacemaker(Cluster):
cluster_name = 'Pacemaker High Availability Cluster Manager'
sos_plugins = ['pacemaker']
packages = ('pacemaker',)
+ strict_node_list = True
option_list = [
('online', True, 'Collect nodes listed as online'),
('offline', True, 'Collect nodes listed as offline'),