Bug 1026143 - Gluster rebalance --xml doesn't work
Gluster rebalance --xml doesn't work
Status: CLOSED CURRENTRELEASE
Product: GlusterFS
Classification: Community
Component: cli (Show other bugs)
3.4.0
All Linux
unspecified Severity high
: ---
: ---
Assigned To: Kaushal
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-03 22:28 EST by purpleidea
Modified: 2014-04-17 09:14 EDT (History)
3 users (show)

See Also:
Fixed In Version: glusterfs-3.4.3
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-04-17 09:14:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description purpleidea 2013-11-03 22:28:30 EST
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 13:10:32 EST
Created attachment 821279 [details]
Print error output in XML format
Comment 2 Dawit Alemu 2013-11-07 13:11:20 EST
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 16:13:18 EST
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 02:13:37 EST
(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 13:42:34 EST
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@redhat.com)
Comment 6 Anand Avati 2013-11-11 02:50:37 EST
COMMIT: http://review.gluster.org/6242 committed in master by Anand Avati (avati@redhat.com) 
------
commit cbb47056ab09ae09eed2550584f190fd5a42fb12
Author: Dawit Alemu <dalemu@redhat.com>
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@redhat.com>
    Reviewed-on: http://review.gluster.org/6242
    Tested-by: Gluster Build System <jenkins@build.gluster.com>
    Reviewed-by: Anand Avati <avati@redhat.com>
Comment 7 Anand Avati 2013-11-11 11:00:48 EST
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@redhat.com)
Comment 8 Anand Avati 2013-11-26 19:47:11 EST
COMMIT: http://review.gluster.org/6250 committed in release-3.4 by Anand Avati (avati@redhat.com) 
------
commit f73373f1244829d65d001fa3af8fdade192418c9
Author: Dawit Alemu <dalemu@redhat.com>
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@redhat.com>
    Reviewed-on: http://review.gluster.org/6250
    Tested-by: Gluster Build System <jenkins@build.gluster.com>
    Reviewed-by: Anand Avati <avati@redhat.com>
Comment 9 purpleidea 2013-11-26 23:46:56 EST
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 09:14:57 EDT
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.