Bug 888442 - The glusterd init script returns 1 regardless of success/fail
Summary: The glusterd init script returns 1 regardless of success/fail
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Gluster Storage
Classification: Red Hat Storage
Component: glusterd
Version: 2.0
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Raghavendra Talur
QA Contact: Jonathan Holloway
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-18 17:34 UTC by Jonathan Holloway
Modified: 2013-09-23 22:43 UTC (History)
5 users (show)

Fixed In Version: glusterfs-3.4.0qa8
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-23 22:39:23 UTC
Embargoed:


Attachments (Terms of Use)

Description Jonathan Holloway 2012-12-18 17:34:12 UTC
Description of problem:
The glusterd init script returns 1 regardless of success/fail

Version-Release number of selected component (if applicable):
glusterfs-server-3.4.0qa5-1.el6rhs.x86_64

How reproducible:
always

Steps to Reproduce:
1. service glusterd stop (if running)
2. service glusterd start; echo $?
  
Actual results:
the init script returns 1 with both pass or fail of glusterd startup

Expected results:
The init script returns 0 with successful glusterd start
The init script returns 1 with unsuccessful glusterd start

Additional info:

The issue appears to be in the way the init script handles the return of the start() function.

With the line in the start() function...
[ $RETVAL -ne 0 ] && exit $RETVAL

     If RETVAL is 1, the line exits the script immediately with 1
     If RETVAL is 0, the && condition is not met and start() falls through with a return value of 1

The line after the start function call assigns that return code to RETVAL and then the script exits with $RETVAL (which is the 1 the failed conditional returns and not the 0 the deamon glusterd command returns)

case $1 in
    start)
        start
        RETVAL=$?
        ;;
...
exit $RETVAL

Prior versions did not assign RETVAL after the return of the start() function and ended the script with an exit 0

Comment 2 Raghavendra Talur 2012-12-21 09:23:28 UTC
http://review.gluster.org/4349 for review

Comment 3 Vijay Bellur 2013-01-19 01:37:00 UTC
CHANGE: http://review.gluster.org/4349 (extras: Don't update RETVAL with invalid value.) merged in master by Anand Avati (avati)

Comment 4 Amar Tumballi 2013-02-15 12:06:03 UTC
marking it fixed for 2.1.0. Moving to MODIFIED. Won't change it in 2.0.z right now.

Comment 5 Scott Haines 2013-03-08 20:56:18 UTC
Per 03/05 email exchange w/ PM, targeting for Arches.

Comment 6 Scott Haines 2013-04-11 16:36:49 UTC
Per 04-10-2013 Storage bug triage meeting, targeting for Big Bend.

Comment 7 Jonathan Holloway 2013-08-02 17:08:20 UTC
Tested version: glusterfs-server-3.4.0.14rhs

Steps taken to reproduce/verify:
  1. Stop glusterd
  2. Start glusterd
    [root ~]# service glusterd start; echo $?; service glusterd status
    Starting glusterd:[  OK  ]
    0
    glusterd (pid  31690) is running...

  3. Stop glusterd
    [root ~]# service glusterd stop; echo $?
    Stopping glusterd:[  OK  ]
    0

  4. Edit /etc/glusterfs/glusterd.vol and add line with xxxxxxxxxxxx
    [root ~]# service glusterd start; echo $?; service glusterd status
    Starting glusterd:[FAILED]
    1
    glusterd is stopped

  5. Remove erroneous line from /etc/glusterfs/glusterd.vol
  6. Start glusterd
    [root ~]# service glusterd start; echo $?; service glusterd status
    Starting glusterd:[  OK  ]
    0
    glusterd (pid  31887) is running...

  7. ps to confirm process is running.

Result: Unable to reproduce original issue. Fail returns 1. Success returns 0 as expected. Moving to verified.

Comment 8 Scott Haines 2013-09-23 22:39:23 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, and where to find the updated files, follow the link below.

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

http://rhn.redhat.com/errata/RHBA-2013-1262.html

Comment 9 Scott Haines 2013-09-23 22:43:43 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, and where to find the updated files, follow the link below.

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

http://rhn.redhat.com/errata/RHBA-2013-1262.html


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