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 1443866 - dstat --gpfs fails with various errors
Summary: dstat --gpfs fails with various errors
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: dstat
Version: 6.9
Hardware: Unspecified
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: David Kaspar // Dee'Kej
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks: 1482440 1486551
TreeView+ depends on / blocked
 
Reported: 2017-04-20 07:26 UTC by Renaud Métrich
Modified: 2020-12-14 08:32 UTC (History)
8 users (show)

Fixed In Version: dstat-0.7.0-4.el6
Doc Type: Bug Fix
Doc Text:
Previously, the dstat utility displayed no data when the dstat --gpfs option was used. The bug has been fixed and dstat now displays data correctly when used with General Parallel File System (GPFS).
Clone Of:
: 1482440 1486551 (view as bug list)
Environment:
Last Closed: 2018-06-21 08:44:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Renaud Métrich 2017-04-20 07:26:57 UTC
Description of problem:

When using the "--gpfs" flag, dstat fails with the following error:

# dstat --gpfs
Module dstat_gpfs failed to load. ([Errno 2] No such file or directory)

Once patching the tool (see below in additional infos), the tool still fails, but later:

# dstat --gpfs
Module dstat_gpfs failed to load. (global name 'select' is not defined)

The tool seems completely broken. The tool works well on RHEL7 (dstat-0.7.2-12.el7.noarch)

Version-Release number of selected component (if applicable):

dstat-0.7.0-3.el6.noarch

How reproducible:

Always

Steps to Reproduce:
1. run "dstat --gpfs"


Additional info:

The first error is due to an incorrect use of Python's subprocess.Popen() function in function "dpopen()": "cmd" is specified as is instead of being splitted into arguments. This is required because Popen() calls execve internally. In our case, Popen() tries to execve "/usr/lpp/mmfs/bin/mmpmon -p -s" which is not a valid binary on the system: command needs to be splitted into ["/usr/lpp/mmfs/bin/mmpmon", "-p", "-s"].

Fix provided below:

# diff -u /usr/bin/dstat.orig /usr/bin/dstat
--- /usr/bin/dstat.orig	2017-04-18 16:44:21.249000018 +0200
+++ /usr/bin/dstat	2017-04-18 16:44:47.605998366 +0200
@@ -1693,10 +1693,10 @@
 def dpopen(cmd):
     "Open a pipe for reuse, if already opened, return pipes"
     global pipes
-    import select, subprocess
+    import select, subprocess, shlex
     if 'pipes' not in globals().keys(): pipes = {}
     if cmd not in pipes.keys():
-        p = subprocess.Popen(cmd, bufsize=0,
+        p = subprocess.Popen(shlex.split(cmd), bufsize=0,
                              stdin=subprocess.PIPE,
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE,

Issue coming afterwards has not be investigated.

Comment 7 Kamil Dudka 2017-08-25 12:23:11 UTC
(In reply to Renaud Métrich from comment #0)
> Once patching the tool (see below in additional infos), the tool still
> fails, but later:
> 
> # dstat --gpfs
> Module dstat_gpfs failed to load. (global name 'select' is not defined)

This is caused by 'import select' being local to dpopen().  The above error can be fixed by putting 'import select' to the global scope.  I am not saying that it will make --gpfs work properly though...

In any case, we should include this fix into the eventual testing build, too.

Comment 8 David Kaspar // Dee'Kej 2017-08-25 12:38:24 UTC
So, this is the result of BZ #989779 actually *NOT* being fixed in the RHEL-6.9 release. As Kamil already said, the fix there is not correct.

Thanks to Kamil we have found a reproducer that we can use for this:
 
$ mkdir -p /usr/lpp/mmfs/bin/
$ cat > /usr/lpp/mmfs/bin/mmpmon <<_EOF
#!/bin/sh
echo "test-run"
_EOF
$ chmod +x /usr/lpp/mmfs/bin/mmpmon
$ dstat --gpfs

If we run this on RHEL-6.9, with dstat-0.7.0-3.el6.noarch package, we will see the error:
>> Module dstat_gpfs failed to load. ([Errno 2] No such file or directory)

Then we patch the dstat with fix provided by Renaud:
# diff -u /usr/bin/dstat.orig /usr/bin/dstat
--- /usr/bin/dstat.orig	2017-04-18 16:44:21.249000018 +0200
+++ /usr/bin/dstat	2017-04-18 16:44:47.605998366 +0200
@@ -1693,10 +1693,10 @@
 def dpopen(cmd):
     "Open a pipe for reuse, if already opened, return pipes"
     global pipes
-    import select, subprocess
+    import select, subprocess, shlex
     if 'pipes' not in globals().keys(): pipes = {}
     if cmd not in pipes.keys():
-        p = subprocess.Popen(cmd, bufsize=0,
+        p = subprocess.Popen(shlex.split(cmd), bufsize=0,
                              stdin=subprocess.PIPE,
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE,

After that we will see the second error mentioned in comment #0:
>> Module dstat_gpfs failed to load. (global name 'select' is not defined)

By moving the 'import select' on the global level, we will be able to run the 'dstat --gpfs' without it raising any error.


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