summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorAnuradha <atalur@redhat.com>2015-01-05 16:37:07 +0530
committerRaghavendra Bhat <raghavendra@redhat.com>2015-01-06 02:04:49 -0800
commit59ba78ae1461651e290ce72013786d828545d4c1 (patch)
tree19bc7b37b3d2fff0cd2870acc8d1cd7e93d3f470 /cli
parent50952cda111c84c966dc0427bbdb618e31bf8d78 (diff)
afr : glfs-heal implementation
Backport of http://review.gluster.org/6529 and http://review.gluster.org/9119 Change-Id: Ie420efcb399b5119c61f448b421979c228b27b15 BUG: 1173528 Signed-off-by: Anuradha <atalur@redhat.com> Reviewed-on: http://review.gluster.org/9335 Reviewed-by: Ravishankar N <ravishankar@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-volume.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index df9d0c2ad62..84209adf936 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -16,6 +16,7 @@
#include <sys/socket.h>
#include <netdb.h>
#include <sys/types.h>
+#include <sys/wait.h>
#include <netinet/in.h>
#ifndef _CONFIG_H
@@ -2093,6 +2094,10 @@ cli_cmd_volume_heal_cbk (struct cli_state *state, struct cli_cmd_word *word,
dict_t *options = NULL;
xlator_t *this = NULL;
cli_local_t *local = NULL;
+ int heal_op = 0;
+ runner_t runner = {0};
+ char buff[PATH_MAX] = {0};
+ char *out = NULL;
this = THIS;
frame = create_frame (this, this->ctx->pool);
@@ -2111,13 +2116,33 @@ cli_cmd_volume_heal_cbk (struct cli_state *state, struct cli_cmd_word *word,
parse_error = 1;
goto out;
}
+ ret = dict_get_int32 (options, "heal-op", &heal_op);
+ if (ret < 0)
+ goto out;
- proc = &cli_rpc_prog->proctable[GLUSTER_CLI_HEAL_VOLUME];
+ if (heal_op == GF_AFR_OP_INDEX_SUMMARY) {
+ runinit (&runner);
+ runner_add_args (&runner, SBIN_DIR"/glfsheal", words[2], NULL);
+ runner_redir (&runner, STDOUT_FILENO, RUN_PIPE);
+ ret = runner_start (&runner);
+ if (ret == -1)
+ goto out;
+ while ((out = fgets(buff, sizeof(buff),
+ runner_chio (&runner, STDOUT_FILENO)))) {
+ printf ("%s", out);
+ }
- CLI_LOCAL_INIT (local, words, frame, options);
+ ret = runner_end (&runner);
+ ret = WEXITSTATUS (ret);
+ }
+ else {
+ proc = &cli_rpc_prog->proctable[GLUSTER_CLI_HEAL_VOLUME];
- if (proc->fn) {
- ret = proc->fn (frame, THIS, options);
+ CLI_LOCAL_INIT (local, words, frame, options);
+
+ if (proc->fn) {
+ ret = proc->fn (frame, THIS, options);
+ }
}
out: