From cb15b3be846d6ff0be450b245aba17ba67457b1e Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Fri, 2 Sep 2016 10:42:44 +0530 Subject: cli: fix volume status xml generation While generating xml, if CLI fails in between xml output doesn't get dumped into stdout. Fix is to invoke cli_xml_output_vol_status_end () in such failures. >Reviewed-on: http://review.gluster.org/15384 >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Smoke: Gluster Build System >Reviewed-by: Samikshan Bairagya >Reviewed-by: Prashanth Pai Change-Id: I7cb3097f5ae23092e6d20f68bd75aa190c31ed88 BUG: 1374290 Signed-off-by: Atin Mukherjee Reviewed-on: http://review.gluster.org/15428 Smoke: Gluster Build System Reviewed-by: Samikshan Bairagya Reviewed-by: Prashanth Pai NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- cli/src/cli-rpc-ops.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 0363c60d345..d88ddd7f136 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -7866,7 +7866,7 @@ gf_cli_status_cbk (struct rpc_req *req, struct iovec *iov, if (ret) { gf_log ("cli", GF_LOG_ERROR, "Error outputting to xml"); - goto out; + goto xml_end; } } if (cmd & GF_CLI_STATUS_TASKS) { @@ -7875,17 +7875,18 @@ gf_cli_status_cbk (struct rpc_req *req, struct iovec *iov, if (ret) { gf_log ("cli", GF_LOG_ERROR,"Error outputting " "to xml"); - goto out; + goto xml_end; } } else { ret = cli_xml_output_vol_status (local, dict); if (ret) { gf_log ("cli", GF_LOG_ERROR, "Error outputting to xml"); - goto out; + goto xml_end; } } +xml_end: if (!local->all) { ret = cli_xml_output_vol_status_end (local); if (ret) { @@ -8134,7 +8135,7 @@ gf_cli_status_volume_all (call_frame_t *frame, xlator_t *this, void *data) if (ret) { gf_log ("cli", GF_LOG_ERROR, "Error outputting to xml"); - goto out; + goto xml_end; } } @@ -8171,6 +8172,7 @@ gf_cli_status_volume_all (call_frame_t *frame, xlator_t *this, void *data) dict_unref (dict); } +xml_end: if (global_state->mode & GLUSTER_MODE_XML) { ret = cli_xml_output_vol_status_end (local); } -- cgit