Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 672597

Summary: fence_scsi: properly log errors for all commands
Product: Red Hat Enterprise Linux 6 Reporter: Ryan O'Hara <rohara>
Component: fence-agentsAssignee: Ryan O'Hara <rohara>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: low Docs Contact:
Priority: low    
Version: 6.1CC: cluster-maint, djansa, fdinitto
Target Milestone: rc   
Target Release: 6.1   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: fence-agents-3.0.12-13.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 14:21:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Log errors with log_error and redirect stderr to /dev/null. none

Description Ryan O'Hara 2011-01-25 17:14:33 UTC
There are a number of places in fence_scsi where the script executes a command via Perl's qx function. Most of these are for executing sg_persist commands. Currently the script does nothing more than:

    $out = qx { $cmd };

    die "[error]: $self\n" if ($?>>8);

If an error occurs executing the command, the script simply dies and reports the name of the subroutine. This can be improved in two ways:

1. Redirect stderr to /dev/null.
2. Log any errors with log_error.

Redirecting stderr to /dev/null keeps some garbage from the sg_persist commands from making its way into the logs. This is a very minor change.

Using log_error instead of simply calling die is preferable since it will write a properly formatted to the logfile.

The improved code would do replace the qx and die calls with:

    $out = qx { $cmd 2> /dev/null };
    $err = ($?>>8);

    if ($err != 0) {
        log_error ("$self (err=$err)");
    }

This code  will correctly write the error to the logfile and include the error code, which might be useful for debugging purposes.

Comment 1 Ryan O'Hara 2011-01-25 17:25:14 UTC
Created attachment 475217 [details]
Log errors with log_error and redirect stderr to /dev/null.

Comment 2 Ryan O'Hara 2011-02-03 02:44:53 UTC
Pushed to RHEL6 branch.

commit b3e375c0554149173390b542de1ef3674da3d128

Comment 5 errata-xmlrpc 2011-05-19 14:21:55 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0745.html