diff options
author | Dawit Alemu <dalemu@redhat.com> | 2013-11-08 13:26:52 -0500 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-11-10 23:50:31 -0800 |
commit | cbb47056ab09ae09eed2550584f190fd5a42fb12 (patch) | |
tree | 5a3435fcff1eb289c4811c65396932ee2e734a64 /cli/src | |
parent | b06ecde2997b72a41b2f2d25d55e61d30ea46bc2 (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.
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>
Diffstat (limited to 'cli/src')
-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 96984286f29..dbc9fef07b4 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -1411,10 +1411,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: |