diff options
author | hari gowtham <hgowtham@redhat.com> | 2017-04-28 00:09:50 +0530 |
---|---|---|
committer | Raghavendra Talur <rtalur@redhat.com> | 2017-05-30 13:37:09 +0000 |
commit | 28007339ed7638adbb8a076f7d73892a89c7606d (patch) | |
tree | 884226bbe5c1498e26270e24cf5770cae185aa67 | |
parent | 1a90d86296f6529423a4450bc1e0b3bb12e4f0a2 (diff) |
Tier/cli: detach status xml output
Problem: detach status xml output was broken because
of the wrong argument. The status_op sent to verify
whether it is a tier status command was as false.
Fix: the argument being passed was changed from false
to true.
>Change-Id: I8cdd4dd972d6bfbb61c1182cbf4097767f83c7c5
>BUG: 1446362
>Signed-off-by: hari gowtham <hgowtham@redhat.com>
>Reviewed-on: https://review.gluster.org/17131
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>Tested-by: hari gowtham <hari.gowtham005@gmail.com>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
>Reviewed-by: N Balachandran <nbalacha@redhat.com>
Change-Id: I8cdd4dd972d6bfbb61c1182cbf4097767f83c7c5
BUG: 1451587
Signed-off-by: hari gowtham <hgowtham@redhat.com>
Reviewed-on: https://review.gluster.org/17313
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: hari gowtham <hari.gowtham005@gmail.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
-rw-r--r-- | cli/src/cli-rpc-ops.c | 57 | ||||
-rw-r--r-- | tests/basic/tier/new-tier-cmds.t | 9 |
2 files changed, 38 insertions, 28 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index b7c40875253..bb7c3474878 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -2535,42 +2535,43 @@ gf_cli_remove_tier_brick_cbk (struct rpc_req *req, struct iovec *iov, (rsp.op_ret) ? "unsuccessful" : "successful"); ret = rsp.op_ret; - if (rsp.op_ret) { - if (strcmp (rsp.op_errstr, "")) - snprintf (msg, sizeof (msg), "volume tier detach %s: " - "failed: %s", cmd_str, rsp.op_errstr); - else - snprintf (msg, sizeof (msg), "volume tier detach %s: " - "failed", cmd_str); - - cli_err ("%s", msg); - goto out; - - } else { - cli_out ("volume detach tier %s: success", cmd_str); - if (GF_DEFRAG_CMD_DETACH_START == command && - task_id_str != NULL) - cli_out ("ID: %s", task_id_str); - if (GF_DEFRAG_CMD_DETACH_COMMIT == command) - cli_out ("Check the detached bricks to ensure all files" - " are migrated.\nIf files with data are " - "found on the brick path, copy them via a " - "gluster mount point before re-purposing the " - "removed brick. "); - } - if (global_state->mode & GLUSTER_MODE_XML) { ret = cli_xml_output_vol_remove_brick_detach_tier ( - _gf_false, rsp_dict, - rsp.op_ret, rsp.op_errno, - msg, "volDetachTier"); + _gf_true, rsp_dict, + rsp.op_ret, rsp.op_errno, + msg, "volDetachTier"); if (ret) gf_log ("cli", GF_LOG_ERROR, "Error outputting to xml"); goto out; - } + } else { + if (rsp.op_ret) { + if (strcmp (rsp.op_errstr, "")) + snprintf (msg, sizeof (msg), "volume tier " + "detach %s: failed: %s", cmd_str, + rsp.op_errstr); + else + snprintf (msg, sizeof (msg), "volume tier " + "detach %s: failed", cmd_str); + + cli_err ("%s", msg); + goto out; + } else { + cli_out ("volume detach tier %s: success", cmd_str); + if (GF_DEFRAG_CMD_DETACH_START == command && + task_id_str != NULL) + cli_out ("ID: %s", task_id_str); + if (GF_DEFRAG_CMD_DETACH_COMMIT == command) + cli_out ("Check the detached bricks to ensure " + "all files are migrated.\nIf files " + "with data are found on the brick " + "path, copy them via a gluster mount " + "point before re-purposing the " + "removed brick. "); + } + } if (command == GF_DEFRAG_CMD_DETACH_STOP || command == GF_DEFRAG_CMD_DETACH_STATUS) ret = gf_cli_print_rebalance_status (rsp_dict, diff --git a/tests/basic/tier/new-tier-cmds.t b/tests/basic/tier/new-tier-cmds.t index 3c16154265d..d341e62dc51 100644 --- a/tests/basic/tier/new-tier-cmds.t +++ b/tests/basic/tier/new-tier-cmds.t @@ -27,6 +27,11 @@ function tier_daemon_status { | sed -n '/.*<status>\([0-9]*\).*/s//\1/p' } +function detach_xml_status { + $CLI_1 volume tier $V0 detach status --xml | sed -n \ + '/.*<opErrstr>Detach tier status successful/p' | wc -l +} + cleanup; #setup cluster and test volume @@ -52,10 +57,14 @@ TEST ! $CLI_1 volume rebalance $V0 tier status EXPECT "Tier command failed" $CLI_1 volume tier $V0 detach status +EXPECT "0" detach_xml_status + #after starting detach tier the detach tier status should display the status TEST $CLI_1 volume tier $V0 detach start +EXPECT "1" detach_xml_status + EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" tier_detach_status #kill a node |