summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd.c
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2012-09-03 15:58:26 +0530
committerVijay Bellur <vbellur@redhat.com>2012-10-30 10:18:58 -0700
commitd7cc779da48e484d0edb7bfbd903f941d0ccca32 (patch)
tree1d4cc1e5e3772b35a3861538d10da6229ffc77f8 /xlators/mgmt/glusterd/src/glusterd.c
parent5c272f4d1c4ae67a3cf5a6af17518c82f520c1de (diff)
glusterd: op-version handshake implementation
Brings in a new rpc program MGMT_HANDSHAKE, which implements the op-version handshake. This is required for bringing in the op-version feature as described in http://www.gluster.org/community/documentation/index.php/Features/Opversion Change-Id: I4333fd2714dbbd3a2a3fca5862cbb3c56615529e BUG: 814534 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.org/3688 Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c71
1 files changed, 32 insertions, 39 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 164009bfe4d..cb5ac321c2f 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -51,6 +51,7 @@ extern struct rpcsvc_program gd_svc_mgmt_prog;
extern struct rpcsvc_program gd_svc_peer_prog;
extern struct rpcsvc_program gd_svc_cli_prog;
extern struct rpc_clnt_program gd_brick_prog;
+extern struct rpcsvc_program glusterd_mgmt_hndsk_prog;
rpcsvc_cbk_program_t glusterd_cbk_prog = {
.progname = "Gluster Callback",
@@ -58,6 +59,15 @@ rpcsvc_cbk_program_t glusterd_cbk_prog = {
.progver = GLUSTER_CBK_VERSION,
};
+struct rpcsvc_program *all_programs[] = {
+ &gd_svc_peer_prog,
+ &gd_svc_cli_prog,
+ &gd_svc_mgmt_prog,
+ &gluster_pmap_prog,
+ &gluster_handshake_prog,
+ &glusterd_mgmt_hndsk_prog,
+};
+int rpcsvc_programs_count = (sizeof (all_programs) / sizeof (all_programs[0]));
static int
glusterd_opinfo_init ()
@@ -69,33 +79,38 @@ glusterd_opinfo_init ()
return ret;
}
+
int
glusterd_uuid_init ()
{
int ret = -1;
+ xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
- priv = THIS->private;
+ this = THIS;
+ GF_ASSERT (this);
+ priv = this->private;
ret = glusterd_retrieve_uuid ();
if (ret == 0) {
uuid_copy (glusterd_uuid, priv->uuid);
- gf_log ("glusterd", GF_LOG_INFO,
+ gf_log (this->name, GF_LOG_INFO,
"retrieved UUID: %s", uuid_utoa (priv->uuid));
return 0;
}
uuid_generate (glusterd_uuid);
- gf_log ("glusterd", GF_LOG_INFO,
- "generated UUID: %s", uuid_utoa (glusterd_uuid));
+ gf_log (this->name, GF_LOG_INFO, "generated UUID: %s",
+ uuid_utoa (glusterd_uuid));
+
uuid_copy (priv->uuid, glusterd_uuid);
- ret = glusterd_store_uuid ();
+ ret = glusterd_store_global_info (this);
if (ret) {
- gf_log ("glusterd", GF_LOG_ERROR,
- "Unable to store generated UUID");
+ gf_log (this->name, GF_LOG_ERROR,
+ "Unable to store generated UUID");
return ret;
}
@@ -778,6 +793,7 @@ init (xlator_t *this)
char cmd_log_filename [PATH_MAX] = {0,};
int first_time = 0;
char *mountbroker_root = NULL;
+ int i = 0;
#ifdef DEBUG
char *valgrind_str = NULL;
@@ -920,39 +936,16 @@ init (xlator_t *this)
goto out;
}
- ret = glusterd_program_register (this, rpc, &gd_svc_peer_prog);
- if (ret) {
- goto out;
- }
-
- ret = glusterd_program_register (this, rpc, &gd_svc_cli_prog);
- if (ret) {
- rpcsvc_program_unregister (rpc, &gd_svc_peer_prog);
- goto out;
- }
-
- ret = glusterd_program_register (this, rpc, &gd_svc_mgmt_prog);
- if (ret) {
- rpcsvc_program_unregister (rpc, &gd_svc_peer_prog);
- rpcsvc_program_unregister (rpc, &gd_svc_cli_prog);
- goto out;
- }
-
- ret = glusterd_program_register (this, rpc, &gluster_pmap_prog);
- if (ret) {
- rpcsvc_program_unregister (rpc, &gd_svc_peer_prog);
- rpcsvc_program_unregister (rpc, &gd_svc_cli_prog);
- rpcsvc_program_unregister (rpc, &gd_svc_mgmt_prog);
- goto out;
- }
+ for (i = 0; i < rpcsvc_programs_count; i++) {
+ ret = glusterd_program_register (this, rpc, all_programs[i]);
+ if (ret) {
+ i--;
+ for (; i >= 0; i--)
+ rpcsvc_program_unregister (rpc,
+ all_programs[i]);
- ret = glusterd_program_register (this, rpc, &gluster_handshake_prog);
- if (ret) {
- rpcsvc_program_unregister (rpc, &gd_svc_peer_prog);
- rpcsvc_program_unregister (rpc, &gluster_pmap_prog);
- rpcsvc_program_unregister (rpc, &gd_svc_cli_prog);
- rpcsvc_program_unregister (rpc, &gd_svc_mgmt_prog);
- goto out;
+ goto out;
+ }
}
conf = GF_CALLOC (1, sizeof (glusterd_conf_t),