summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-03-16 16:09:42 +0530
committerAnand Avati <avati@redhat.com>2012-03-18 00:33:28 -0700
commit642343cc55e6ea2b0d463d77334c34790c30080f (patch)
tree47aa3e890088463828e936b84ccb56b2fdc49152 /cli
parentf159e2247b58441449ad8da13ddf5cc5d3887b93 (diff)
Self-heald: Handle errors gracefully and show errors to users
Change-Id: I5424ebfadb5b2773ee6f7370cc2867a555aa48dd BUG: 800352 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/2962 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-volume.c4
-rw-r--r--cli/src/cli-rpc-ops.c22
2 files changed, 14 insertions, 12 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 9546831a..4e56f9c6 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 a259addb..b88b523b 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;