diff options
| author | Pranith K <pranithk@gluster.com> | 2010-09-29 03:59:19 +0000 | 
|---|---|---|
| committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-29 06:17:52 -0700 | 
| commit | 6689104ce7eed29c7878c124fa13caecaa1245ef (patch) | |
| tree | 0ff8df60e5cd5609feda520351209b1f5d4cb71b /cli/src/cli-cmd-volume.c | |
| parent | 95dd4ae4dc2a8a3b3673e60c1fa6cbdbb9409d2c (diff) | |
mgmt/glusterd: volume start force
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1736 (implement volume start force)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1736
Diffstat (limited to 'cli/src/cli-cmd-volume.c')
| -rw-r--r-- | cli/src/cli-cmd-volume.c | 33 | 
1 files changed, 22 insertions, 11 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index c7a027a187c..8d846d8732c 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -44,7 +44,7 @@ cli_cmd_volume_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,  void  cli_cmd_volume_start_usage ()  { -        cli_out ("Usage: volume start <VOLNAME>"); +        cli_out ("Usage: volume start <VOLNAME> [force]");  }  void @@ -71,11 +71,12 @@ cli_cmd_volume_info_usage ()          cli_out ("Usage: volume info [all|<VOLNAME>]");  } -void  +void  cli_cmd_volume_set_usage ()  {  	cli_out ("Usage: volume set <VOLNAME> <KEY> <VALUE>");  } +  int  cli_cmd_volume_info_cbk (struct cli_state *state, struct cli_cmd_word *word,                           const char **words, int wordcount) @@ -252,7 +253,6 @@ out:          return ret;  } -  int  cli_cmd_volume_start_cbk (struct cli_state *state, struct cli_cmd_word *word,                            const char **words, int wordcount) @@ -260,29 +260,40 @@ cli_cmd_volume_start_cbk (struct cli_state *state, struct cli_cmd_word *word,          int                     ret = -1;          rpc_clnt_procedure_t    *proc = NULL;          call_frame_t            *frame = NULL; -        char                    *volname = NULL; - +        gf1_cli_start_vol_req    req = {0,};          frame = create_frame (THIS, THIS->ctx->pool);          if (!frame)                  goto out; -        if (wordcount != 3) { +        if (wordcount < 3 || wordcount > 4) {                 cli_cmd_volume_start_usage ();                 goto out;          } -        volname = (char *)words[2]; +        req.volname = (char *)words[2]; +        if (!req.volname) +                goto out; + +        if (wordcount == 4) { +                if (!strcmp("force", words[3])) { +                        req.flags |= GF_CLI_FLAG_OP_FORCE; +                } else { +                        ret = -1; +                        cli_cmd_volume_start_usage (); +                        goto out; +                } +        }          proc = &cli_rpc_prog->proctable[GF1_CLI_START_VOLUME];          if (proc->fn) { -                ret = proc->fn (frame, THIS, volname); +                ret = proc->fn (frame, THIS, &req);          }  out: -        if (!proc && ret && volname) -                cli_out ("Starting Volume %s failed", volname); +        if (!proc && ret && req.volname) +                cli_out ("Starting Volume %s failed", req.volname);          return ret;  } @@ -812,7 +823,7 @@ struct cli_cmd volume_cmds[] = {            cli_cmd_volume_delete_cbk,            "delete volume specified by <VOLNAME>"}, -        { "volume start <VOLNAME>", +        { "volume start <VOLNAME> [force]",            cli_cmd_volume_start_cbk,            "start volume specified by <VOLNAME>"},  | 
