diff options
| author | Kaushal M <kaushal@gluster.com> | 2011-09-14 18:29:18 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2011-10-01 05:54:42 -0700 | 
| commit | acea7409a35d03c438ff2738f701add26f0061c9 (patch) | |
| tree | b9a46fcf984a97f55b706f2373dcfdad12f5e81c /cli/src/cli-cmd-peer.c | |
| parent | 795c8996c18f5e8ef5986581644374d0c5068772 (diff) | |
glusterd, cli: adds 'force' for 'peer detach'
Adds add a 'force' option to 'peer detach' to forcefully detach a peer from a
cluster, even when the cluster contains volumes with bricks on the peer.
Change-Id: I134df51c16a07345c8869b318141d427b572eba5
BUG: 3549
Reviewed-on: http://review.gluster.com/429
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kp@gluster.com>
Diffstat (limited to 'cli/src/cli-cmd-peer.c')
| -rw-r--r-- | cli/src/cli-cmd-peer.c | 20 | 
1 files changed, 18 insertions, 2 deletions
diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c index 3b41195a1bb..cad520dfcb5 100644 --- a/cli/src/cli-cmd-peer.c +++ b/cli/src/cli-cmd-peer.c @@ -31,6 +31,7 @@  #include "cli.h"  #include "cli-cmd.h"  #include "cli-mem-types.h" +#include "cli1-xdr.h"  #include "protocol-common.h"  extern struct rpc_clnt *global_rpc; @@ -107,10 +108,11 @@ cli_cmd_peer_deprobe_cbk (struct cli_state *state, struct cli_cmd_word *word,          rpc_clnt_procedure_t *proc  = NULL;          call_frame_t         *frame = NULL;          dict_t               *dict  = NULL; +        int                  flags = 0;          int                  sent = 0;          int                  parse_error = 0; -        if (!(wordcount == 3) ) { +        if ((wordcount < 3) || (wordcount > 4)) {                  cli_usage_out (word->pattern);                  parse_error = 1;                  goto out; @@ -134,6 +136,20 @@ cli_cmd_peer_deprobe_cbk (struct cli_state *state, struct cli_cmd_word *word,                          goto out;          }  */ +        if (wordcount == 4) { +                if (!strcmp("force", words[3])) +                        flags |= GF_CLI_FLAG_OP_FORCE; +                else { +                        ret = -1; +                        cli_usage_out (word->pattern); +                        parse_error = 1; +                        goto out; +                } +        } +        ret = dict_set_int32 (dict, "flags", flags); +        if (ret) +                goto out; +          if (proc->fn) {                  ret = proc->fn (frame, THIS, dict);          } @@ -188,7 +204,7 @@ struct cli_cmd cli_probe_cmds[] = {            cli_cmd_peer_probe_cbk,            "probe peer specified by <HOSTNAME>"}, -        { "peer detach <HOSTNAME>", +        { "peer detach <HOSTNAME> [force]",            cli_cmd_peer_deprobe_cbk,            "detach peer specified by <HOSTNAME>"},  | 
