From 1b5ed7e2ee3a3ac7d85e649b4ed3adc170f3a9a1 Mon Sep 17 00:00:00 2001 From: Samikshan Bairagya Date: Tue, 29 Mar 2016 16:24:07 +0530 Subject: Fix opRet value for volume info --xml call on non-existent volume The opRet field was being assigned to 0 in the XML output when a gluster volume info --xml call is made on a non-existent volume. This change assigns a value of -1 to opRet for volume info calls for non-existent volumes. Other fields like opErrno and opErrstr are also assigned relevant values > Reviewed-on: http://review.gluster.org/13843 > Smoke: Gluster Build System > CentOS-regression: Gluster Build System > Reviewed-by: darshan n > Reviewed-by: Atin Mukherjee > NetBSD-regression: NetBSD Build System (cherry picked from commit a6e551122c603ab0cba798e7e2b30d3a15191b68) Change-Id: I3920c602328f74252c87bb521f5a43d4bdc7d44d BUG: 1352880 Signed-off-by: Samikshan Bairagya Reviewed-on: http://review.gluster.org/14863 NetBSD-regression: NetBSD Build System Smoke: Gluster Build System CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee --- cli/src/cli-rpc-ops.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'cli') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 23ec4fbf898..4adf34fd608 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -815,11 +815,6 @@ gf_cli_get_volume_cbk (struct rpc_req *req, struct iovec *iov, gf_log ("cli", GF_LOG_INFO, "Received resp to get vol: %d", rsp.op_ret); - if (rsp.op_ret) { - ret = -1; - goto out; - } - if (!rsp.dict.dict_len) { if (global_state->mode & GLUSTER_MODE_XML) goto xml_output; @@ -869,6 +864,13 @@ gf_cli_get_volume_cbk (struct rpc_req *req, struct iovec *iov, } } + if (rsp.op_ret) { + if (global_state->mode & GLUSTER_MODE_XML) + goto xml_output; + ret = -1; + goto out; + } + xml_output: if (global_state->mode & GLUSTER_MODE_XML) { /* For GET_NEXT_VOLUME output is already begun in -- cgit