diff options
author | Rahul C S <rahulcs@redhat.com> | 2011-12-22 13:17:21 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-12-22 23:13:56 -0800 |
commit | 31fa06932952f0cb706653aa7d0450646009eb07 (patch) | |
tree | 89544b01e3caaf769432e63d4d2fdaccce3c29f5 /xlators | |
parent | d7d9f3d4002d31ceefed6ce80ec7567eca9ba6d3 (diff) |
Improve cli output of gluster volume heal command.
Improving cli outputs according to the type of the volume,
the "heal" action can be performed on the volume.
Also checks if the volume is started & then if the
"self-heal" daemon is not started, prints appropriate
message.
Change-Id: I25b0822e4d518c50e2f1173aa8c7c11ae6b76d3f
BUG: 769774
Signed-off-by: Rahul C S <rahulcs@redhat.com>
Reviewed-on: http://review.gluster.com/2496
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kp@gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 55 |
1 files changed, 23 insertions, 32 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index f36a4d52b70..e3971a2763c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -965,7 +965,6 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) { int ret = 0; char *volname = NULL; - gf_boolean_t exists = _gf_false; gf_boolean_t enabled = _gf_false; glusterd_volinfo_t *volinfo = NULL; char msg[2048]; @@ -974,18 +973,9 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) priv = THIS->private; if (!priv) { + ret = -1; gf_log (THIS->name, GF_LOG_ERROR, "priv is NULL"); - ret = -1; - goto out; - } - - if (!glusterd_shd_is_running ()) { - ret = -1; - snprintf (msg, sizeof (msg), "Self-heal daemon is not " - "running."); - *op_errstr = gf_strdup (msg); - gf_log (THIS->name, GF_LOG_WARNING, "%s", msg); goto out; } @@ -995,38 +985,30 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) goto out; } - exists = glusterd_check_volume_exists (volname); - - if (!exists) { + ret = glusterd_volinfo_find (volname, &volinfo); + if (ret) { + ret = -1; snprintf (msg, sizeof (msg), "Volume %s does not exist", volname); - gf_log ("", GF_LOG_ERROR, "%s", - msg); + gf_log (THIS->name, GF_LOG_ERROR, "%s", msg); *op_errstr = gf_strdup (msg); - ret = -1; - } else { - ret = 0; + goto out; } - ret = glusterd_volinfo_find (volname, &volinfo); - - if (ret) + if (!glusterd_is_volume_replicate (volinfo)) { + ret = -1; + snprintf (msg, sizeof (msg), "Volume %s is not a replicate " + "type volume", volname); + *op_errstr = gf_strdup (msg); + gf_log (THIS->name, GF_LOG_WARNING, "%s", msg); goto out; + } if (!glusterd_is_volume_started (volinfo)) { + ret = -1; snprintf (msg, sizeof (msg), "Volume %s is not started.", volname); gf_log (THIS->name, GF_LOG_WARNING, "%s", msg); *op_errstr = gf_strdup (msg); - ret = -1; - goto out; - } - - if (!glusterd_is_volume_replicate (volinfo)) { - snprintf (msg, sizeof (msg), "Volume %s is not of type." - "replicate", volname); - gf_log (THIS->name, GF_LOG_WARNING, "%s", msg); - *op_errstr = gf_strdup (msg); - ret = -1; goto out; } @@ -1039,12 +1021,21 @@ glusterd_op_stage_heal_volume (dict_t *dict, char **op_errstr) enabled = dict_get_str_boolean (opt_dict, "cluster.self-heal-daemon", 1); if (!enabled) { + ret = -1; snprintf (msg, sizeof (msg), "Self-heal-daemon is " "disabled. Heal will not be triggered on volume %s", volname); gf_log (THIS->name, GF_LOG_WARNING, "%s", msg); *op_errstr = gf_strdup (msg); + goto out; + } + + if (!glusterd_shd_is_running ()) { ret = -1; + snprintf (msg, sizeof (msg), "Self-heal daemon is not " + "running. Check self-heal daemon log file."); + *op_errstr = gf_strdup (msg); + gf_log (THIS->name, GF_LOG_WARNING, "%s", msg); goto out; } |