From 53b8c7470f9e40c60c5eebd1fbad5c6d274f7ee5 Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Sun, 3 Oct 2010 04:14:19 +0000 Subject: mgmt/glusterd: changes for detach everywhere Signed-off-by: Vijay Bellur Signed-off-by: Vijay Bellur BUG: 1765 (peer probe on removed-detached bricks) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1765 --- xlators/mgmt/glusterd/src/glusterd-handler.c | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 67b4ab62c1c..39c1d59240e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -2041,6 +2041,27 @@ out: return ret; } + +int +glusterd_handle_friend_update_delete (dict_t *dict) +{ + char *hostname = NULL; + int32_t ret = -1; + + GF_ASSERT (dict); + + ret = dict_get_str (dict, "hostname", &hostname); + if (ret) + goto out; + + ret = glusterd_friend_remove (NULL, hostname); + +out: + gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + return ret; +} + + int glusterd_handle_friend_update (rpcsvc_request_t *req) { @@ -2060,6 +2081,7 @@ glusterd_handle_friend_update (rpcsvc_request_t *req) int count = 0; uuid_t uuid = {0,}; glusterd_peerctx_args_t args = {0}; + int32_t op = 0; GF_ASSERT (req); @@ -2099,6 +2121,15 @@ glusterd_handle_friend_update (rpcsvc_request_t *req) if (ret) goto out; + ret = dict_get_int32 (dict, "op", &op); + if (ret) + goto out; + + if (GD_FRIEND_UPDATE_DEL == op) { + ret = glusterd_handle_friend_update_delete (dict); + goto out; + } + args.mode = GD_MODE_SWITCH_ON; while ( i <= count) { snprintf (key, sizeof (key), "friend%d.uuid", i); -- cgit