Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 514260

Summary: /etc/init.d/scsi_reserve should produce [FAIL] on failure as it does [ OK ] on success
Product: Red Hat Enterprise Linux 5 Reporter: Jaroslav Kortus <jkortus>
Component: cmanAssignee: Ryan O'Hara <rohara>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: high Docs Contact:
Priority: urgent    
Version: 5.3CC: ccaulfie, cluster-maint, edamato
Target Milestone: rcKeywords: ZStream
Target Release: 5.5   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: cman-2.0.115-22.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-30 08:38:50 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:
Bug Depends On:    
Bug Blocks: 530400    
Attachments:
Description Flags
Modified scsi_reserve init script.
none
Patch for scsci_reserve to handle failures. none

Description Jaroslav Kortus 2009-07-28 15:33:38 UTC
Description of problem:
When /etc/init.d/scsi_reserve is run and it finds errors (like wrong cluster.conf configuration), it should print [FAIL] message to give the admins some clue. Now it just exits with "exit 1" and prints no visible messages. The reason is silently appended to /var/log/messages.

Version-Release number of selected component (if applicable):
cman-2.0.110-1.el5

How reproducible:
always

Steps to Reproduce:
1. run /etc/init.d/scsi_reserve restart on misconfigured cluster
2.
3.
  
Actual results:
Exit code 1 is received, no message printed.

Expected results:
[FAIL] printed out as all the other init scripts do and/or any helpful message what was wrong.

Additional info:

Comment 1 Ryan O'Hara 2009-08-03 20:23:26 UTC
I'm going to attach a modified scsi_reserve init script that calls 'failure' (from /etc/init.d/functions) instead of 'exit 1'. Can you test this and let me know how it works? Thanks.

Comment 2 Ryan O'Hara 2009-08-03 20:24:36 UTC
Created attachment 356076 [details]
Modified scsi_reserve init script.

Here is the modified scsi_reserve init script from the RHEL54 branch.

Comment 3 Jaroslav Kortus 2009-08-13 14:06:25 UTC
The supplied script does not stop with failure, it always succeeds. If failure happens it's echoed in red as expected but then it's overriden by [OK] later in the script. The reason is most probably fact that "failure" call does not exit and the exit is commented out.

Comment 4 Jaroslav Kortus 2009-08-19 14:47:38 UTC
please fix also one typo at line 226, there should be "Restarting" instead of "Retarting".

Comment 5 Ryan O'Hara 2009-10-09 22:20:37 UTC
I have a patch that should fix this problem. Thanks for catching this.

As part of the fix, I had to move the commands that echo the current operations. For example, "echo -n Starting scsi_reserve:". These are now printed at the beginning of the script. This is needed so that if a failure occurs the output looks correct. Note that I also added code to handle invalid operations, in which can I print out the usage.

All places that used to just exit with status 1 will not call failure and echo (for formatting reasons). I've tested this by misconfiguring my cluster.conf, renaming sg_persist such that the binary can't be found, etc. and it appears to work correctly.

One other detail -- I had to move the check to verify that sg_persist binary exist to be the first thing we check. Without this, fence_scsi_test will also test is sg_persist binary exists, and if not, print an error to stdout. Moving the check in scsi_reserve will catch the case where sg_persist does not exist before fence_scsi_test has a chance to do the same.

Comment 6 Ryan O'Hara 2009-10-09 22:22:20 UTC
Created attachment 364298 [details]
Patch for scsci_reserve to handle failures.

Comment 7 Ryan O'Hara 2009-10-12 14:33:47 UTC
Pushed to RHEL55 branch.

commit c4dbd04e08080515c797258f561453acc4bbefb8

Comment 10 Ryan O'Hara 2009-11-16 16:28:13 UTC
Pushed addition fix to call echo after every call to 'failure'. The existing script was missing a few echo calls, which resulted in output being mangled in a few cases.

commit bdb05eefde2a1a898f39cfd2165dcb059b8b0c58

Comment 15 errata-xmlrpc 2010-03-30 08:38:50 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-2010-0266.html