Bug 1026143 - Gluster rebalance --xml doesn't work
Summary: Gluster rebalance --xml doesn't work
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: cli
Version: 3.4.0
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Kaushal
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-04 03:28 UTC by purpleidea
Modified: 2014-04-17 13:14 UTC (History)
3 users (show)

Fixed In Version: glusterfs-3.4.3
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-17 13:14:57 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)
Print error output in XML format (904 bytes, patch)
2013-11-07 18:10 UTC, Dawit Alemu
no flags Details | Diff

Description purpleidea 2013-11-04 03:28:30 UTC
Description of problem:

Gluster has an awesome --xml flag for (most?) all? command line tools. For the gluster rebalance, in certain corner cases the xml output is not shown.

Example:

[root@vmx2 ~]# /usr/sbin/gluster volume rebalance foo status
volume rebalance: foo: failed: Volume foo is not a distribute volume or contains only 1 brick.
Not performing rebalance
[root@vmx2 ~]# /usr/sbin/gluster volume rebalance foo status --xml
volume rebalance: foo: failed: Volume foo is not a distribute volume or contains only 1 brick.
Not performing rebalance

As you can see, the --xml doesn't provide xml output, and as a result, all my parsers barf when they try and check status of single bricked volumes. Other command line tools _do_ provide error output in xml form, such as peer status.

The reason single brick volumes are important is for situations when a puppet management tool is elastically growing a volume, it is not uncommon for a single server setup to grow one brick at a time as hosts come online.



Version-Release number of selected component (if applicable):

3.4 +

How reproducible:

100%

Steps to Reproduce:
1.
2.
3.

Run above command and look to see if output is xml.

Actual results:

Output is not xml :( <-- First time I'm unhappy that I _didn't_ get xml output :P

Expected results:

xml output.

Additional info:

I really hope someone can squeeze a patch for this into 3.4 or 3.5. The puppet-gluster team would appreciate it.

Cheers,
James

Comment 1 Dawit Alemu 2013-11-07 18:10:32 UTC
Created attachment 821279 [details]
Print error output in XML format

Comment 2 Dawit Alemu 2013-11-07 18:11:20 UTC
With the attached patch, upon error, the following is printed out:

$ /usr/local/sbin/gluster volume rebalance vol1 status --xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cliOutput>
  <opRet>-1</opRet>
  <opErrno>0</opErrno>
  <opErrstr>Volume vol1 is not a distribute volume or contains only 1 brick.
Not performing rebalance</opErrstr>
  <cliOp>volRebalance</cliOp>
  <output>Volume vol1 is not a distribute volume or contains only 1 brick.
Not performing rebalance</output>
</cliOutput>

$ /usr/local/sbin/gluster volume rebalance vol1 status
volume rebalance: vol1: failed: Volume vol1 is not a distribute volume or contains only 1 brick.
Not performing rebalance

Comment 3 purpleidea 2013-11-07 21:13:18 UTC
Awesome!

I didn't test this, but the output looks good.

Thank you very much for the patch. Will this land in 3.4.1 ? If you know the specific version, I'll add the knowledge to the puppet-gluster module structure.

Cheers

James

Comment 4 Kaushal 2013-11-08 07:13:37 UTC
(In reply to Dawit Alemu from comment #1)
> Created attachment 821279 [details]
> Print error output in XML format

Thanks for the patch Dawit. But gluster uses gerrit for patch review and submission. So please use the steps given under 'Review process' at http://www.gluster.org/community/documentation/index.php/Development_Work_Flow .

Comment 5 Anand Avati 2013-11-08 18:42:34 UTC
REVIEW: http://review.gluster.org/6242 (cli: write 'volume rebalance' error message in xml format when --xml is specified) posted (#1) for review on master by Dawit Alemu (dalemu)

Comment 6 Anand Avati 2013-11-11 07:50:37 UTC
COMMIT: http://review.gluster.org/6242 committed in master by Anand Avati (avati) 
------
commit cbb47056ab09ae09eed2550584f190fd5a42fb12
Author: Dawit Alemu <dalemu>
Date:   Fri Nov 8 13:26:52 2013 -0500

    cli: write 'volume rebalance' error message in xml format when
    --xml is specified
    
    When 'volume rebalance' encounters an error the cli prints the
    error message in plain text independent of whether --xml is
    specified. This throws off client application that expect xml
    output (as mentioned in bz1026143).
    
    Now, if the --xml flag is supplied, the cli print 'volume
    rebalance' error messages in xml format.
    
    Change-Id: I16c6a7a4cdd2819eb73422ab849125986dc299a6
    BUG: 1026143
    Signed-off-by: Dawit Alemu <dalemu>
    Reviewed-on: http://review.gluster.org/6242
    Tested-by: Gluster Build System <jenkins.com>
    Reviewed-by: Anand Avati <avati>

Comment 7 Anand Avati 2013-11-11 16:00:48 UTC
REVIEW: http://review.gluster.org/6250 (cli: write 'volume rebalance' error message in xml format when --xml is specified) posted (#1) for review on release-3.4 by Dawit Alemu (dalemu)

Comment 8 Anand Avati 2013-11-27 00:47:11 UTC
COMMIT: http://review.gluster.org/6250 committed in release-3.4 by Anand Avati (avati) 
------
commit f73373f1244829d65d001fa3af8fdade192418c9
Author: Dawit Alemu <dalemu>
Date:   Mon Nov 11 10:58:36 2013 -0500

    cli: write 'volume rebalance' error message in xml format when
    --xml is specified
    
    When 'volume rebalance' encounters an error the cli prints the
    error message in plain text independent of whether --xml is
    specified. This throws off client application that expect xml
    output (as mentioned in bz1026143).
    
    Now, if the --xml flag is supplied, the cli print 'volume
    rebalance' error messages in xml format.
    
    (cherry picked from commit
     cbb47056ab09ae09eed2550584f190fd5a42fb12)
    
    Change-Id: Iec266d56cb2ac34be0ac05a473ae3a08988cca38
    BUG: 1026143
    Signed-off-by: Dawit Alemu <dalemu>
    Reviewed-on: http://review.gluster.org/6250
    Tested-by: Gluster Build System <jenkins.com>
    Reviewed-by: Anand Avati <avati>

Comment 9 purpleidea 2013-11-27 04:46:56 UTC
Awesome!

Thanks all. Will gladly test when this comes out in the 3.4.x rpm builds.

Comment 10 Niels de Vos 2014-04-17 13:14:57 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.4.3, please reopen this bug report.

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

The fix for this bug likely to be included in all future GlusterFS releases i.e. release > 3.4.3. In the same line the recent release i.e. glusterfs-3.5.0 [3] likely to have the fix. You can verify this by reading the comments in this bug report and checking for comments mentioning "committed in release-3.5".

[1] http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/5978
[2] http://news.gmane.org/gmane.comp.file-systems.gluster.user
[3] http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/6137


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