From cbb47056ab09ae09eed2550584f190fd5a42fb12 Mon Sep 17 00:00:00 2001 From: Dawit Alemu Date: Fri, 8 Nov 2013 13:26:52 -0500 Subject: 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 Reviewed-on: http://review.gluster.org/6242 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- cli/src/cli-rpc-ops.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'cli/src') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 96984286f..dbc9fef07 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: -- cgit