From 65a84c9d0d691ac4f7a5f33374140e50746a96af Mon Sep 17 00:00:00 2001 From: Pranith K Date: Tue, 28 Sep 2010 02:47:08 +0000 Subject: mgmt/glusterd: prevent detach of peer with its bricks existing in cluster Signed-off-by: Pranith Kumar K Signed-off-by: Vijay Bellur BUG: 1681 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1681 --- cli/src/cli3_1-cops.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'cli/src') diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c index d92da2913..0984a7936 100644 --- a/cli/src/cli3_1-cops.c +++ b/cli/src/cli3_1-cops.c @@ -155,7 +155,31 @@ gf_cli3_1_deprobe_cbk (struct rpc_req *req, struct iovec *iov, } gf_log ("cli", GF_LOG_NORMAL, "Received resp to deprobe"); - cli_out ("Detach %s", (rsp.op_ret) ? "unsuccessful": "successful"); + if (rsp.op_ret) { + switch (rsp.op_errno) { + case GF_DEPROBE_LOCALHOST: + cli_out ("%s is localhost", + rsp.hostname); + break; + case GF_DEPROBE_NOT_FRIEND: + cli_out ("%s is not part of cluster", + rsp.hostname); + break; + case GF_DEPROBE_BRICK_EXIST: + cli_out ("Brick(s) with the peer %s exist in " + "cluster", rsp.hostname); + break; + default: + cli_out ("Detach returned with unknown errno %d", + rsp.op_errno); + break; + } + cli_out ("Detach unsuccessful"); + gf_log ("glusterd",GF_LOG_ERROR,"Detach failed with op_ret %d" + " and op_errno %d", rsp.op_ret, rsp.op_errno); + } else { + cli_out ("Detach successful"); + } ret = rsp.op_ret; -- cgit