| Summary: | fence_scsi: properly log errors for all commands | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Ryan O'Hara <rohara> | ||||
| Component: | fence-agents | Assignee: | Ryan O'Hara <rohara> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Cluster QE <mspqa-list> | ||||
| Severity: | low | Docs Contact: | |||||
| Priority: | low | ||||||
| Version: | 6.1 | CC: | 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: | |||||
| Attachments: |
|
||||||
Created attachment 475217 [details]
Log errors with log_error and redirect stderr to /dev/null.
Pushed to RHEL6 branch. commit b3e375c0554149173390b542de1ef3674da3d128 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 |
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.