diff options
author | Dawit Alemu <dalemu@redhat.com> | 2013-11-11 10:58:36 -0500 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-11-26 16:47:03 -0800 |
commit | f73373f1244829d65d001fa3af8fdade192418c9 (patch) | |
tree | 8ad58f17d40f0b9ac3e7204cd367042c61171fb4 /cli | |
parent | 168bb24a60643e2aedb90170c3d8d3c447c5c5c6 (diff) |
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>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 6e22316d1da..b074e6837c5 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -1428,10 +1428,18 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov, done: - if (rsp.op_ret) - cli_err ("volume rebalance: %s: failed: %s", volname, msg); - else - cli_out ("volume rebalance: %s: success: %s", volname, msg); + if (global_state->mode & GLUSTER_MODE_XML) + cli_xml_output_str ("volRebalance", msg, + rsp.op_ret, rsp.op_errno, + rsp.op_errstr); + else { + if (rsp.op_ret) + cli_err ("volume rebalance: %s: failed: %s", volname, + msg); + else + cli_out ("volume rebalance: %s: success: %s", volname, + msg); + } ret = rsp.op_ret; out: |