RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1843562 - sosreport gluster volume specific commands not collected
Summary: sosreport gluster volume specific commands not collected
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: sos
Version: 8.3
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 8.3
Assignee: Pavel Moravec
QA Contact: Miroslav Hradílek
URL:
Whiteboard:
Depends On: 1843520
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-03 14:36 UTC by Miroslav Hradílek
Modified: 2020-11-04 02:00 UTC (History)
7 users (show)

Fixed In Version: sos-3.9.1-4.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1843520
Environment:
Last Closed: 2020-11-04 01:57:56 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github sosreport sos pull 2106 0 None closed [gluster] fix gluster volume splitlines iteration 2020-09-10 14:06:13 UTC
Red Hat Product Errata RHEA-2020:4534 0 None None None 2020-11-04 01:58:14 UTC

Description Miroslav Hradílek 2020-06-03 14:36:35 UTC
I just confirmed that 
sos-3.9.1-2.el8.noarch (unreleased)

is also affected.

+++ This bug was initially created as a clone of Bug #1843520 +++

Description of problem:
Gluster plugin is supposed to collect additional commands per each volume name found by listing "gluster volume info".

Turns out that after rebase to sos 3.9 gluster plugin was edited and is iterating over string characters rather than lines.
Apart from it not working properly, it is also regression of Bug 1036752.


Version-Release number of selected component (if applicable):
sos-3.9-2.el7.noarch (unreleased)

How reproducible:
100%

Steps to Reproduce:
1. cat foo.sh 
#!/bin/bash
echo "Volume Name: abcd"
2. cp foo.sh /usr/sbin/gluster
3. chmod +x /usr/sbin/gluster
4. sosreport -o gluster --batch
5. tar -tf /var/tmp/sosreport-host-date.tar.xz | grep gluster

Actual results:
sosreport-host-date/sos_commands/gluster/
sosreport-host-date/sos_commands/gluster/gluster_volume_info
sosreport-host-date/sos_commands/gluster/gluster_peer_status
sosreport-host-date/sos_commands/gluster/gluster_pool_list
sosreport-host-date/sos_commands/gluster/gluster_volume_status

Expected results:
sosreport-host-date/sos_commands/gluster/
sosreport-host-date/sos_commands/gluster/gluster_volume_info
sosreport-host-date/sos_commands/gluster/gluster_peer_status
sosreport-host-date/sos_commands/gluster/gluster_pool_list
sosreport-host-date/sos_commands/gluster/gluster_volume_status
sosreport-host-date/sos_commands/gluster/gluster_volume_get_abcd_all
sosreport-host-date/sos_commands/gluster/gluster_volume_geo-replication_abcd_status
sosreport-host-date/sos_commands/gluster/gluster_volume_heal_abcd_info
sosreport-host-date/sos_commands/gluster/gluster_volume_heal_abcd_info_split-brain
sosreport-host-date/sos_commands/gluster/gluster_volume_status_abcd_clients
sosreport-host-date/sos_commands/gluster/gluster_snapshot_list_abcd
sosreport-host-date/sos_commands/gluster/gluster_volume_quota_abcd_list
sosreport-host-date/sos_commands/gluster/gluster_volume_rebalance_abcd_status
sosreport-host-date/sos_commands/gluster/gluster_snapshot_info_abcd
sosreport-host-date/sos_commands/gluster/gluster_snapshot_status_abcd

Additional info:
I believe following changes should fix this but please review.

--- gluster.py	2020-06-03 11:47:35.488111051 +0200
+++ /usr/lib/python2.7/site-packages/sos/plugins/gluster.py	2020-06-03 11:49:54.343111051 +0200
@@ -103,10 +103,10 @@
 
         volume_cmd = self.collect_cmd_output("gluster volume info")
         if volume_cmd['status'] == 0:
-            for line in volume_cmd['output']:
+            for line in volume_cmd['output'].splitlines():
                 if not line.startswith("Volume Name:"):
                     continue
-                volname = line[12:-1]
+                volname = line[12:]
                 self.add_cmd_output([
                     "gluster volume get %s all" % volname,
                     "gluster volume geo-replication %s status" % volname,

Comment 1 Pavel Moravec 2020-06-06 20:59:31 UTC
Thanks for a good spot and also idea of patch, really appreciate it.

The first change is evident, the second should be obvious as well, but.. the "-1" is there from beginning, in particular since 

https://github.com/sosreport/sos/commit/326981727f9682aa1e27ebe6382e1d111b5c47df#diff-21e23db313317029fa799c929cae6d82R40

Bryn, any idea why to truncated the latest character from the lines like:

# gluster volume info
Volume Name: test-volume
Type: Distribute
..

Per https://access.redhat.com/documentation/en-us/red_hat_gluster_storage/3/html/administration_guide/creating_distributed_volumes , the "Volume Name" line does not have a trailing extra char to purge..

Comment 2 Bryn M. Reeves 2020-06-08 12:19:00 UTC
It's accounting for the different behaviour of "fp.read().splitlines()" vs. "fp.readlines()": the former strips the trailing newline from the line whereas the latter does not:

$ echo -e "foo\nbar\nbaz\n" > /tmp/dat
$ python
[...]
>>> fp = open("/tmp/dat", "r")
>>> fp.readlines()
['foo\n', 'bar\n', 'baz\n', '\n']
>>> fp = open("/tmp/dat", "r")
>>> fp.read().splitlines()
['foo', 'bar', 'baz', '']
>>> 

So as we are now using splitlines() instead of readlines() the -1 index should be dropped as Miroslav suggests.

Comment 8 errata-xmlrpc 2020-11-04 01:57:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (sos bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2020:4534


Note You need to log in before you can comment on or make changes to this bug.