diff options
author | Vijay Bellur <vijay@gluster.com> | 2010-08-09 07:42:02 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-08-11 22:24:43 -0700 |
commit | 5f7018275bf8006ff758817037d03936b8a95d43 (patch) | |
tree | 84f980fce14aa6c167ef031d818b268759efe616 /xlators/mgmt/glusterd/src/glusterd-handler.c | |
parent | b8779318dd2d99e44f54de741beee32f55553e75 (diff) |
glusterd: restore peer information upon restart
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1310 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1310
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index ce4c661826e..df3fd6f071c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -41,6 +41,7 @@ #include "glusterd-sm.h" #include "glusterd-op-sm.h" #include "glusterd-utils.h" +#include "glusterd-store.h" #include "glusterd1.h" #include "cli1.h" @@ -50,18 +51,10 @@ #include <sys/resource.h> #include <inttypes.h> -/* for default_*_cbk functions */ #include "defaults.c" #include "common-utils.h" -/*typedef int32_t (*glusterd_mop_t) (call_frame_t *frame, - gf_hdr_common_t *hdr, size_t hdrlen);*/ - -//static glusterd_mop_t glusterd_ops[GF_MOP_MAXVALUE]; - - - static int glusterd_friend_find_by_hostname (const char *hoststr, glusterd_peerinfo_t **peerinfo) @@ -1417,7 +1410,7 @@ glusterd_handle_friend_update (rpcsvc_request_t *req) ret = glusterd_friend_add (hostname, friend_req.port, GD_FRIEND_STATE_BEFRIENDED, - &uuid, NULL, &peerinfo); + &uuid, NULL, &peerinfo, 0); i++; } @@ -1487,7 +1480,8 @@ glusterd_friend_add (const char *hoststr, int port, glusterd_friend_sm_state_t state, uuid_t *uuid, struct rpc_clnt *rpc, - glusterd_peerinfo_t **friend) + glusterd_peerinfo_t **friend, + gf_boolean_t restore) { int ret = 0; glusterd_conf_t *priv = NULL; @@ -1564,9 +1558,12 @@ glusterd_friend_add (const char *hoststr, int port, } - gf_log ("glusterd", GF_LOG_NORMAL, "connect returned %d", ret); + if (!restore) + ret = glusterd_store_update_peerinfo (peerinfo); + out: + gf_log ("glusterd", GF_LOG_NORMAL, "connect returned %d", ret); return ret; } @@ -1591,7 +1588,7 @@ glusterd_probe_begin (rpcsvc_request_t *req, const char *hoststr, int port) " for host: %s (%d)", hoststr, port); ret = glusterd_friend_add ((char *)hoststr, port, GD_FRIEND_STATE_DEFAULT, - NULL, NULL, &peerinfo); + NULL, NULL, &peerinfo, 0); } ret = glusterd_friend_sm_new_event |