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
Created attachment 821279 [details] Print error output in XML format
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
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
(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 .
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)
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>
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)
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>
Awesome! Thanks all. Will gladly test when this comes out in the 3.4.x rpm builds.
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