summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-peer.c20
-rw-r--r--cli/src/cli-rpc-ops.c7
2 files changed, 24 insertions, 3 deletions
diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c
index 3b41195a1..cad520dfc 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>"},
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 1e77ae0ab..f8662ea55 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -1718,6 +1718,7 @@ gf_cli3_1_deprobe (call_frame_t *frame, xlator_t *this,
dict_t *dict = NULL;
char *hostname = NULL;
int port = 0;
+ int flags = 0;
if (!frame || !this || !data) {
ret = -1;
@@ -1733,9 +1734,13 @@ gf_cli3_1_deprobe (call_frame_t *frame, xlator_t *this,
if (ret)
port = CLI_GLUSTERD_PORT;
+ ret = dict_get_int32 (dict, "flags", &flags);
+ if (ret)
+ flags = 0;
+
req.hostname = hostname;
req.port = port;
-
+ req.flags = flags;
ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
GLUSTER_CLI_DEPROBE, NULL,
this, gf_cli3_1_deprobe_cbk,