Bug 1352880

Summary: gluster volume info --xml returns 0 for nonexistent volume
Product: [Community] GlusterFS Reporter: Samikshan Bairagya <sbairagy>
Component: glusterdAssignee: bugs <bugs>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.8.0CC: amukherj, bugs, jholloway, nlevinki, sasundar, sbairagy, vbellur
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: glusterfs-3.8.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1321836 Environment:
Last Closed: 2016-07-08 14:42:35 UTC Type: Bug
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: 1319886, 1321836    
Bug Blocks:    

Description Samikshan Bairagya 2016-07-05 11:17:01 UTC
+++ This bug was initially created as a clone of Bug #1321836 +++

+++ This bug was initially created as a clone of Bug #1319886 +++

Description of problem:
gluster volume info <nonexistent_volname> --xml and gluster volume status <nonexistent_volname> --xml return 0

Version-Release number of selected component (if applicable):
3.7.5-19 and earlier

How reproducible:
Everytime

Steps to Reproduce:
1. Start glusterd
2. Execute gluster volume info <nonexistent_volume> --xml
     # gluster volume info sdksjsdjl --xml; echo $?
3. Execute gluster volume status <nonexistent_volume> --xml
     # gluster volume info sdksjsdjl --xml; echo $?

Actual results:
Both commands output a return code of 0.
Without --xml, they return 1.

Expected results:
Both commands with nonexistent volume and --xml option should return a non-zero returncode (preferably 1 to match command without --xml)

Additional info:
[root@x ~]# gluster volume info sdksjsdjl --xml; echo $?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cliOutput>
  <opRet>0</opRet>
  <opErrno>0</opErrno>
  <opErrstr/>
  <volInfo>
    <volumes>
      <count>0</count>
    </volumes>
  </volInfo>
</cliOutput>
0

[root@x ~]# gluster volume status sdksjsdjl --xml; echo $?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cliOutput>
  <opRet>-1</opRet>
  <opErrno>30800</opErrno>
  <opErrstr>Volume sdksjsdjl does not exist</opErrstr>
  <cliOp>volStatus</cliOp>
  <output>Volume sdksjsdjl does not exist</output>
</cliOutput>
0

[root@x ~]# gluster volume info sdksjsdjl; echo $?
Volume sdksjsdjl does not exist
1

[root@x ~]# gluster volume status sdksjsdjl; echo $?
Volume sdksjsdjl does not exist
1


--- Additional comment from Vijay Bellur on 2016-03-29 07:34:13 EDT ---

REVIEW: http://review.gluster.org/13843 (Fix opRet value for volume info --xml call on non-existent volume) posted (#1) for review on master by Samikshan Bairagya (samikshan)

--- Additional comment from Vijay Bellur on 2016-06-08 05:48:26 EDT ---

REVIEW: http://review.gluster.org/13843 (Fix opRet value for volume info --xml call on non-existent volume) posted (#2) for review on master by Samikshan Bairagya (samikshan)

--- Additional comment from Vijay Bellur on 2016-06-17 10:01:28 EDT ---

REVIEW: http://review.gluster.org/13843 (Fix opRet value for volume info --xml call on non-existent volume) posted (#3) for review on master by Samikshan Bairagya (samikshan)

--- Additional comment from Vijay Bellur on 2016-06-21 03:11:11 EDT ---

COMMIT: http://review.gluster.org/13843 committed in master by Atin Mukherjee (amukherj) 
------
commit a6e551122c603ab0cba798e7e2b30d3a15191b68
Author: Samikshan Bairagya <samikshan>
Date:   Tue Mar 29 16:24:07 2016 +0530

    Fix opRet value for volume info --xml call on non-existent volume
    
    The opRet field was being assigned to 0 in the XML output when a
    gluster volume info --xml call is made on a non-existent volume.
    This change assigns a value of -1 to opRet for volume info calls
    for non-existent volumes. Other fields like opErrno and opErrstr
    are also assigned relevant values
    
    Change-Id: I3920c602328f74252c87bb521f5a43d4bdc7d44d
    BUG: 1321836
    Signed-off-by: Samikshan Bairagya <samikshan>
    Reviewed-on: http://review.gluster.org/13843
    Smoke: Gluster Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.org>
    Reviewed-by: darshan n <dnarayan>
    Reviewed-by: Atin Mukherjee <amukherj>
    NetBSD-regression: NetBSD Build System <jenkins.org>

Comment 1 Vijay Bellur 2016-07-05 11:28:54 UTC
REVIEW: http://review.gluster.org/14863 (Fix opRet value for volume info --xml call on non-existent volume) posted (#2) for review on release-3.8 by Samikshan Bairagya (samikshan)

Comment 2 Vijay Bellur 2016-07-07 04:17:53 UTC
COMMIT: http://review.gluster.org/14863 committed in release-3.8 by Atin Mukherjee (amukherj) 
------
commit 1b5ed7e2ee3a3ac7d85e649b4ed3adc170f3a9a1
Author: Samikshan Bairagya <samikshan>
Date:   Tue Mar 29 16:24:07 2016 +0530

    Fix opRet value for volume info --xml call on non-existent volume
    
    The opRet field was being assigned to 0 in the XML output when a
    gluster volume info --xml call is made on a non-existent volume.
    This change assigns a value of -1 to opRet for volume info calls
    for non-existent volumes. Other fields like opErrno and opErrstr
    are also assigned relevant values
    
    > Reviewed-on: http://review.gluster.org/13843
    > Smoke: Gluster Build System <jenkins.org>
    > CentOS-regression: Gluster Build System <jenkins.org>
    > Reviewed-by: darshan n <dnarayan>
    > Reviewed-by: Atin Mukherjee <amukherj>
    > NetBSD-regression: NetBSD Build System <jenkins.org>
    
    (cherry picked from commit a6e551122c603ab0cba798e7e2b30d3a15191b68)
    
    Change-Id: I3920c602328f74252c87bb521f5a43d4bdc7d44d
    BUG: 1352880
    Signed-off-by: Samikshan Bairagya <samikshan>
    Reviewed-on: http://review.gluster.org/14863
    NetBSD-regression: NetBSD Build System <jenkins.org>
    Smoke: Gluster Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.org>
    Reviewed-by: Atin Mukherjee <amukherj>

Comment 3 Niels de Vos 2016-07-08 14:42:35 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.8.1, please open a new bug report.

glusterfs-3.8.1 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] http://thread.gmane.org/gmane.comp.file-systems.gluster.packaging/156
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user