From 642343cc55e6ea2b0d463d77334c34790c30080f Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Fri, 16 Mar 2012 16:09:42 +0530 Subject: Self-heald: Handle errors gracefully and show errors to users Change-Id: I5424ebfadb5b2773ee6f7370cc2867a555aa48dd BUG: 800352 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/2962 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- cli/src/cli-cmd-volume.c | 4 +++- cli/src/cli-rpc-ops.c | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'cli') diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 9546831ab7c..4e56f9c656c 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -1561,8 +1561,10 @@ cli_cmd_volume_heal_cbk (struct cli_state *state, struct cli_cmd_word *word, int sent = 0; int parse_error = 0; dict_t *options = NULL; + xlator_t *this = NULL; - frame = create_frame (THIS, THIS->ctx->pool); + this = THIS; + frame = create_frame (this, this->ctx->pool); if (!frame) goto out; diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index a259addb160..b88b523b7c7 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -5561,6 +5561,7 @@ cmd_heal_volume_brick_out (dict_t *dict, int brick) char key[256] = {0}; char *hostname = NULL; char *path = NULL; + char *status = NULL; uint64_t i = 0; snprintf (key, sizeof (key), "%d-hostname", brick); @@ -5571,9 +5572,14 @@ cmd_heal_volume_brick_out (dict_t *dict, int brick) ret = dict_get_str (dict, key, &path); if (ret) goto out; + cli_out ("\nBrick %s:%s", hostname, path); snprintf (key, sizeof (key), "%d-count", brick); ret = dict_get_uint64 (dict, key, &num_entries); - cli_out ("\nEntries on %s:%s %"PRIu64, hostname, path, num_entries); + cli_out ("Number of entries: %"PRIu64, num_entries); + snprintf (key, sizeof (key), "%d-status", brick); + ret = dict_get_str (dict, key, &status); + if (status && strlen (status)) + cli_out ("Status: %s", status); for (i = 0; i < num_entries; i++) { snprintf (key, sizeof (key), "%d-%"PRIu64, brick, i); ret = dict_get_str (dict, key, &path); @@ -5645,21 +5651,15 @@ gf_cli3_1_heal_volume_cbk (struct rpc_req *req, struct iovec *iov, if (rsp.op_ret && strcmp (rsp.op_errstr, "")) cli_out ("%s", rsp.op_errstr); else - cli_out ("Starting heal on volume %s has been %s", volname, + cli_out ("Heal operation on volume %s has been %s", volname, (rsp.op_ret) ? "unsuccessful": "successful"); - if (rsp.op_ret) { - ret = rsp.op_ret; - goto out; - } - + ret = rsp.op_ret; if ((heal_op == GF_AFR_OP_HEAL_FULL) || - (heal_op == GF_AFR_OP_HEAL_INDEX)) { - ret = 0; + (heal_op == GF_AFR_OP_HEAL_INDEX)) goto out; - } - dict = dict_new (); + dict = dict_new (); if (!dict) { ret = -1; goto out; -- cgit