diff options
author | Vijay Bellur <vijay@gluster.com> | 2010-08-06 05:25:16 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-08-06 04:09:03 -0700 |
commit | 453cb4bf0b70c876eb468def34054095cfd66359 (patch) | |
tree | 46593e13f4ceb37a4d13a5f420c300b8860e0aa6 /xlators/mgmt/glusterd/src/glusterd.c | |
parent | 3f6e5e670b7c1e30c64f2f11419947bd8982d51b (diff) |
v2[PATCH BUG:1286] glusterd: Regain volume state upon re-start
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1286 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1286
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index cfd07433b15..5b75c93fadd 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -42,6 +42,7 @@ #include "statedump.h" #include "glusterd-sm.h" #include "glusterd-op-sm.h" +#include "glusterd-store.h" static uuid_t glusterd_uuid; @@ -50,17 +51,6 @@ extern struct rpcsvc_program gluster_handshake_prog; extern struct rpc_clnt_program glusterd3_1_mgmt_prog; extern glusterd_op_info_t opinfo; -static int -glusterd_retrieve_uuid () -{ - return -1; -} - -static int -glusterd_store_uuid () -{ - return 0; -} static int glusterd_opinfo_init () @@ -75,22 +65,28 @@ glusterd_opinfo_init () static int glusterd_uuid_init () { - int ret = -1; - char str[50]; + int ret = -1; + char str[50] = {0,}; + glusterd_conf_t *priv = NULL; + priv = THIS->private; ret = glusterd_retrieve_uuid (); if (!ret) { + uuid_unparse (priv->uuid, str); + uuid_copy (glusterd_uuid, priv->uuid); gf_log ("glusterd", GF_LOG_NORMAL, - "retrieved UUID: %s", glusterd_uuid); + "retrieved UUID: %s", str); return 0; } + uuid_generate (glusterd_uuid); uuid_unparse (glusterd_uuid, str); gf_log ("glusterd", GF_LOG_NORMAL, "generated UUID: %s",str); + uuid_copy (priv->uuid, glusterd_uuid); ret = glusterd_store_uuid (); @@ -285,11 +281,14 @@ init (xlator_t *this) if (ret < 0) goto out; + ret = glusterd_restore (); + if (ret < 0) + goto out; + glusterd_friend_sm_init (); glusterd_op_sm_init (); glusterd_opinfo_init (); - memcpy(conf->uuid, glusterd_uuid, sizeof (uuid_t)); ret = 0; out: |