Patchwork [BUG:2333,3/3] glusterd: separate out cli specific programs and mgmt specific programs

login
register
Submitter Amar Tumballi
Date 2011-02-25 14:08:44
Message ID <20110225140844.GA8398@gluster.com>
Download mbox | patch
Permalink /patch/6270/
State Accepted
Delegated to: Anand Avati
Headers show

Comments

Amar Tumballi - 2011-02-25 14:08:44
Signed-off-by: Amar Tumballi <amar@gluster.com>
---
 cli/src/Makefile.am                                |    2 +-
 cli/src/cli-cmd-peer.c                             |    6 +-
 cli/src/cli-cmd-system.c                           |    6 +-
 cli/src/cli-cmd-volume.c                           |   38 ++++----
 cli/src/{cli3_1-cops.c => cli-rpc-ops.c}           |  107 ++++++++++----------
 cli/src/cli.c                                      |    4 +-
 rpc/rpc-lib/src/protocol-common.h                  |   83 +++++++++------
 xlators/mgmt/glusterd/src/Makefile.am              |    2 +-
 xlators/mgmt/glusterd/src/glusterd-handler.c       |   53 ++++++++++
 xlators/mgmt/glusterd/src/glusterd-handshake.c     |   13 ++-
 .../src/{glusterd3_1-mops.c => glusterd-rpc-ops.c} |   22 ++++-
 xlators/mgmt/glusterd/src/glusterd.c               |   21 ++++-
 12 files changed, 237 insertions(+), 120 deletions(-)
 rename cli/src/{cli3_1-cops.c => cli-rpc-ops.c} (95%)
 rename xlators/mgmt/glusterd/src/{glusterd3_1-mops.c => glusterd-rpc-ops.c} (97%)

Patch

diff --git a/cli/src/Makefile.am b/cli/src/Makefile.am
index aa66ed1..f2a0303 100644
--- a/cli/src/Makefile.am
+++ b/cli/src/Makefile.am
@@ -1,7 +1,7 @@ 
 sbin_PROGRAMS = gluster
 
 gluster_SOURCES = cli.c registry.c input.c cli-cmd.c cli-rl.c \
-	 cli-cmd-volume.c cli-cmd-peer.c cli3_1-cops.c cli-cmd-parser.c\
+	 cli-cmd-volume.c cli-cmd-peer.c cli-rpc-ops.c cli-cmd-parser.c\
 	 cli-cmd-system.c cli-cmd-misc.c
 
 gluster_LDADD = $(top_builddir)/libglusterfs/src/libglusterfs.la $(GF_LDADD)\
diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c
index 0c4d54d..c931341 100644
--- a/cli/src/cli-cmd-peer.c
+++ b/cli/src/cli-cmd-peer.c
@@ -57,7 +57,7 @@  cli_cmd_peer_probe_cbk (struct cli_state *state, struct cli_cmd_word *word,
                 goto out;
         }
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_PROBE];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_PROBE];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
@@ -116,7 +116,7 @@  cli_cmd_peer_deprobe_cbk (struct cli_state *state, struct cli_cmd_word *word,
                 goto out;
         }
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_DEPROBE];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_DEPROBE];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
@@ -164,7 +164,7 @@  cli_cmd_peer_status_cbk (struct cli_state *state, struct cli_cmd_word *word,
                 goto out;
         }
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_LIST_FRIENDS];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_LIST_FRIENDS];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
diff --git a/cli/src/cli-cmd-system.c b/cli/src/cli-cmd-system.c
index e92376c..3658389 100644
--- a/cli/src/cli-cmd-system.c
+++ b/cli/src/cli-cmd-system.c
@@ -69,7 +69,7 @@  cli_cmd_getspec_cbk (struct cli_state *state, struct cli_cmd_word *word,
         if (ret)
                 goto out;
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_GETSPEC];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_GETSPEC];
         if (proc->fn) {
                 ret = proc->fn (frame, THIS, dict);
         }
@@ -112,7 +112,7 @@  cli_cmd_pmap_b2p_cbk (struct cli_state *state, struct cli_cmd_word *word,
         if (ret)
                 goto out;
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_PMAP_PORTBYBRICK];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_PMAP_PORTBYBRICK];
         if (proc->fn) {
                 ret = proc->fn (frame, THIS, dict);
         }
@@ -145,7 +145,7 @@  cli_cmd_fsm_log (struct cli_state *state, struct cli_cmd_word *word,
 
         if (wordcount == 3)
                 name = (char*)words[2];
-        proc = &cli_rpc_prog->proctable[GF1_CLI_FSM_LOG];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_FSM_LOG];
         if (proc && proc->fn) {
                 frame = create_frame (THIS, THIS->ctx->pool);
                 if (!frame)
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index e022cce..5039fa2 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -53,7 +53,7 @@  cli_cmd_volume_info_cbk (struct cli_state *state, struct cli_cmd_word *word,
         int                             sent = 0;
         int                             parse_error = 0;
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_GET_VOLUME];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_GET_VOLUME];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
@@ -62,7 +62,7 @@  cli_cmd_volume_info_cbk (struct cli_state *state, struct cli_cmd_word *word,
         if ((wordcount == 2)  || (wordcount == 3 &&
                                   !strcmp (words[2], "all"))) {
                 ctx.flags = GF_CLI_GET_NEXT_VOLUME;
-                proc = &cli_rpc_prog->proctable[GF1_CLI_GET_NEXT_VOLUME];
+                proc = &cli_rpc_prog->proctable[GLUSTER_CLI_GET_NEXT_VOLUME];
         } else if (wordcount == 3) {
                 ctx.flags = GF_CLI_GET_VOLUME;
                 ctx.volname = (char *)words[2];
@@ -70,7 +70,7 @@  cli_cmd_volume_info_cbk (struct cli_state *state, struct cli_cmd_word *word,
                         cli_out ("Invalid volume name");
                         goto out;
                 }
-                proc = &cli_rpc_prog->proctable[GF1_CLI_GET_VOLUME];
+                proc = &cli_rpc_prog->proctable[GLUSTER_CLI_GET_VOLUME];
         } else {
                 cli_usage_out (word->pattern);
                 parse_error = 1;
@@ -129,7 +129,7 @@  cli_cmd_sync_volume_cbk (struct cli_state *state, struct cli_cmd_word *word,
 
         req.hostname = (char *)words[2];
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_SYNC_VOLUME];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_SYNC_VOLUME];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
@@ -160,7 +160,7 @@  cli_cmd_volume_create_cbk (struct cli_state *state, struct cli_cmd_word *word,
         int                     sent = 0;
         int                     parse_error = 0;
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_CREATE_VOLUME];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_CREATE_VOLUME];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
@@ -206,7 +206,7 @@  cli_cmd_volume_delete_cbk (struct cli_state *state, struct cli_cmd_word *word,
 
         question = "Deleting volume will erase all information about the volume. "
                    "Do you want to continue?";
-        proc = &cli_rpc_prog->proctable[GF1_CLI_DELETE_VOLUME];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_DELETE_VOLUME];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
@@ -277,7 +277,7 @@  cli_cmd_volume_start_cbk (struct cli_state *state, struct cli_cmd_word *word,
                 }
         }
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_START_VOLUME];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_START_VOLUME];
 
         if (proc->fn) {
                 ret = proc->fn (frame, THIS, &req);
@@ -381,7 +381,7 @@  cli_cmd_volume_stop_cbk (struct cli_state *state, struct cli_cmd_word *word,
         }
 
         req.flags = flags;
-        proc = &cli_rpc_prog->proctable[GF1_CLI_STOP_VOLUME];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_STOP_VOLUME];
 
         if (proc->fn) {
                 ret = proc->fn (frame, THIS, &req);
@@ -434,7 +434,7 @@  cli_cmd_volume_rename_cbk (struct cli_state *state, struct cli_cmd_word *word,
         if (ret)
                 goto out;
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_RENAME_VOLUME];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_RENAME_VOLUME];
 
         if (proc->fn) {
                 ret = proc->fn (frame, THIS, dict);
@@ -490,7 +490,7 @@  cli_cmd_volume_defrag_cbk (struct cli_state *state, struct cli_cmd_word *word,
         if (ret)
                 goto out;
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_DEFRAG_VOLUME];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_DEFRAG_VOLUME];
 
         if (proc->fn) {
                 ret = proc->fn (frame, THIS, dict);
@@ -521,7 +521,7 @@  cli_cmd_volume_reset_cbk (struct cli_state *state, struct cli_cmd_word *word,
         call_frame_t            *frame = NULL;
         dict_t                  *options = NULL;
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_RESET_VOLUME];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_RESET_VOLUME];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
@@ -566,7 +566,7 @@  cli_cmd_volume_set_cbk (struct cli_state *state, struct cli_cmd_word *word,
         call_frame_t            *frame = NULL;
         dict_t                  *options = NULL;
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_SET_VOLUME];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_SET_VOLUME];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
@@ -622,7 +622,7 @@  cli_cmd_volume_add_brick_cbk (struct cli_state *state,
                 goto out;
         }
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_ADD_BRICK];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_ADD_BRICK];
 
         if (proc->fn) {
                 ret = proc->fn (frame, THIS, options);
@@ -677,7 +677,7 @@  cli_cmd_volume_remove_brick_cbk (struct cli_state *state,
                 goto out;
         }
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_REMOVE_BRICK];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_REMOVE_BRICK];
 
         if (proc->fn) {
                 ret = proc->fn (frame, THIS, options);
@@ -713,7 +713,7 @@  cli_cmd_volume_replace_brick_cbk (struct cli_state *state,
         cli_out ("Command not supported on Solaris");
         goto out;
 #endif
-        proc = &cli_rpc_prog->proctable[GF1_CLI_REPLACE_BRICK];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_REPLACE_BRICK];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
@@ -771,7 +771,7 @@  cli_cmd_log_filename_cbk (struct cli_state *state, struct cli_cmd_word *word,
                 goto out;
         }
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_LOG_FILENAME];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_LOG_FILENAME];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
@@ -816,7 +816,7 @@  cli_cmd_log_locate_cbk (struct cli_state *state, struct cli_cmd_word *word,
                 goto out;
         }
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_LOG_LOCATE];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_LOG_LOCATE];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
@@ -860,7 +860,7 @@  cli_cmd_log_rotate_cbk (struct cli_state *state, struct cli_cmd_word *word,
                 goto out;
         }
 
-        proc = &cli_rpc_prog->proctable[GF1_CLI_LOG_ROTATE];
+        proc = &cli_rpc_prog->proctable[GLUSTER_CLI_LOG_ROTATE];
 
         frame = create_frame (THIS, THIS->ctx->pool);
         if (!frame)
@@ -897,7 +897,7 @@  cli_cmd_volume_gsync_set_cbk (struct cli_state *state, struct cli_cmd_word *word
         rpc_clnt_procedure_t    *proc    = NULL;
         call_frame_t            *frame   = NULL;
 
-        proc = &cli_rpc_prog->proctable [GF1_CLI_GSYNC_SET];
+        proc = &cli_rpc_prog->proctable [GLUSTER_CLI_GSYNC_SET];
         if (proc == NULL) {
                 ret = -1;
                 goto out;
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli-rpc-ops.c
similarity index 95%
rename from cli/src/cli3_1-cops.c
rename to cli/src/cli-rpc-ops.c
index 1f54b86..0a29104 100644
--- a/cli/src/cli3_1-cops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -38,7 +38,7 @@ 
 #include "portmap.h"
 
 extern rpc_clnt_prog_t *cli_rpc_prog;
-extern int      cli_op_ret;
+extern int              cli_op_ret;
 
 char *cli_volume_type[] = {"Distribute",
                            "Stripe",
@@ -1408,7 +1408,7 @@  gf_cli3_1_probe (call_frame_t *frame, xlator_t *this,
         req.port     = port;
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_PROBE, NULL, gf_xdr_from_cli_probe_req,
+                              GLUSTER_CLI_PROBE, NULL, gf_xdr_from_cli_probe_req,
                               this, gf_cli3_1_probe_cbk);
 
 out:
@@ -1444,7 +1444,7 @@  gf_cli3_1_deprobe (call_frame_t *frame, xlator_t *this,
         req.port     = port;
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_DEPROBE, NULL,
+                              GLUSTER_CLI_DEPROBE, NULL,
                               gf_xdr_from_cli_deprobe_req,
                               this, gf_cli3_1_deprobe_cbk);
 
@@ -1468,7 +1468,7 @@  gf_cli3_1_list_friends (call_frame_t *frame, xlator_t *this,
         req.flags = GF_CLI_LIST_ALL;
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_LIST_FRIENDS, NULL,
+                              GLUSTER_CLI_LIST_FRIENDS, NULL,
                               gf_xdr_from_cli_peer_list_req,
                               this, gf_cli3_1_list_friends_cbk);
 
@@ -1547,7 +1547,7 @@  gf_cli3_1_get_volume (call_frame_t *frame, xlator_t *this,
                                            (size_t *)&req.dict.dict_len);
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_GET_VOLUME, NULL,
+                              GLUSTER_CLI_GET_VOLUME, NULL,
                               gf_xdr_from_cli_get_vol_req,
                               this, gf_cli3_1_get_volume_cbk);
 
@@ -1604,7 +1604,7 @@  gf_cli3_1_create_volume (call_frame_t *frame, xlator_t *this,
         }
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_CREATE_VOLUME, NULL,
+                              GLUSTER_CLI_CREATE_VOLUME, NULL,
                               gf_xdr_from_cli_create_vol_req,
                               this, gf_cli3_1_create_volume_cbk);
 
@@ -1646,7 +1646,7 @@  gf_cli3_1_delete_volume (call_frame_t *frame, xlator_t *this,
         req.volname = data;
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_DELETE_VOLUME, NULL,
+                              GLUSTER_CLI_DELETE_VOLUME, NULL,
                               gf_xdr_from_cli_delete_vol_req,
                               this, gf_cli3_1_delete_volume_cbk);
 
@@ -1679,7 +1679,7 @@  gf_cli3_1_start_volume (call_frame_t *frame, xlator_t *this,
         }
 
         ret = cli_cmd_submit (req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_START_VOLUME, NULL,
+                              GLUSTER_CLI_START_VOLUME, NULL,
                               gf_xdr_from_cli_start_vol_req,
                               this, gf_cli3_1_start_volume_cbk);
 
@@ -1712,7 +1712,7 @@  gf_cli3_1_stop_volume (call_frame_t *frame, xlator_t *this,
         }
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_STOP_VOLUME, NULL,
+                              GLUSTER_CLI_STOP_VOLUME, NULL,
                               gf_xdr_from_cli_stop_vol_req,
                               this, gf_cli3_1_stop_volume_cbk);
 
@@ -1806,7 +1806,7 @@  gf_cli3_1_rename_volume (call_frame_t *frame, xlator_t *this,
                 goto out;
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_RENAME_VOLUME, NULL,
+                              GLUSTER_CLI_RENAME_VOLUME, NULL,
                               gf_xdr_from_cli_rename_vol_req,
                               this, gf_cli3_1_rename_volume_cbk);
 
@@ -1847,7 +1847,7 @@  gf_cli3_1_reset_volume (call_frame_t *frame, xlator_t *this,
 
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                               GD_MGMT_CLI_RESET_VOLUME, NULL,
+                               GLUSTER_CLI_RESET_VOLUME, NULL,
                                gf_xdr_from_cli_reset_vol_req,
                                this, gf_cli3_1_reset_volume_cbk);
 
@@ -1888,7 +1888,7 @@  gf_cli3_1_set_volume (call_frame_t *frame, xlator_t *this,
 
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_SET_VOLUME, NULL,
+                              GLUSTER_CLI_SET_VOLUME, NULL,
                               gf_xdr_from_cli_set_vol_req,
                               this, gf_cli3_1_set_volume_cbk);
 
@@ -1933,7 +1933,7 @@  gf_cli3_1_add_brick (call_frame_t *frame, xlator_t *this,
         }
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_ADD_BRICK, NULL,
+                              GLUSTER_CLI_ADD_BRICK, NULL,
                               gf_xdr_from_cli_add_brick_req,
                               this, gf_cli3_1_add_brick_cbk);
 
@@ -1982,7 +1982,7 @@  gf_cli3_1_remove_brick (call_frame_t *frame, xlator_t *this,
         }
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_REMOVE_BRICK, NULL,
+                              GLUSTER_CLI_REMOVE_BRICK, NULL,
                               gf_xdr_from_cli_remove_brick_req,
                               this, gf_cli3_1_remove_brick_cbk);
 
@@ -2077,7 +2077,7 @@  gf_cli3_1_replace_brick (call_frame_t *frame, xlator_t *this,
         }
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_REPLACE_BRICK, NULL,
+                              GLUSTER_CLI_REPLACE_BRICK, NULL,
                               gf_xdr_from_cli_replace_brick_req,
                               this, gf_cli3_1_replace_brick_cbk);
 
@@ -2119,7 +2119,7 @@  gf_cli3_1_log_filename (call_frame_t *frame, xlator_t *this,
                 goto out;
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_LOG_FILENAME, NULL,
+                              GLUSTER_CLI_LOG_FILENAME, NULL,
                               gf_xdr_from_cli_log_filename_req,
                               this, gf_cli3_1_log_filename_cbk);
 
@@ -2154,7 +2154,7 @@  gf_cli3_1_log_locate (call_frame_t *frame, xlator_t *this,
                 req.brick = "";
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_LOG_LOCATE, NULL,
+                              GLUSTER_CLI_LOG_LOCATE, NULL,
                               gf_xdr_from_cli_log_locate_req,
                               this, gf_cli3_1_log_locate_cbk);
 
@@ -2188,7 +2188,7 @@  gf_cli3_1_log_rotate (call_frame_t *frame, xlator_t *this,
                 req.brick = "";
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_LOG_ROTATE, NULL,
+                              GLUSTER_CLI_LOG_ROTATE, NULL,
                               gf_xdr_from_cli_log_rotate_req,
                               this, gf_cli3_1_log_rotate_cbk);
 
@@ -2211,7 +2211,7 @@  gf_cli3_1_sync_volume (call_frame_t *frame, xlator_t *this,
         }
 
         ret = cli_cmd_submit ((gf1_cli_sync_volume_req*)data, frame,
-                              cli_rpc_prog, GD_MGMT_CLI_SYNC_VOLUME,
+                              cli_rpc_prog, GLUSTER_CLI_SYNC_VOLUME,
                               NULL, gf_xdr_from_cli_sync_volume_req,
                               this, gf_cli3_1_sync_volume_cbk);
 
@@ -2386,7 +2386,7 @@  gf_cli3_1_fsm_log (call_frame_t *frame, xlator_t *this, void *data)
                 goto out;
         req.name = data;
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_FSM_LOG, NULL,
+                              GLUSTER_CLI_FSM_LOG, NULL,
                               gf_xdr_from_cli_fsm_log_req,
                               this, gf_cli3_1_fsm_log_cbk);
 
@@ -2637,7 +2637,7 @@  gf_cli3_1_gsync_set (call_frame_t *frame, xlator_t *this,
         }
 
         ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
-                              GD_MGMT_CLI_GSYNC_SET, NULL,
+                              GLUSTER_CLI_GSYNC_SET, NULL,
                               gf_xdr_from_cli_gsync_set_req,
                               this, gf_cli3_1_gsync_set_cbk);
 
@@ -2646,39 +2646,38 @@  out:
 }
 
 
-
-struct rpc_clnt_procedure gluster3_1_cli_actors[GF1_CLI_MAXVALUE] = {
-        [GF1_CLI_NULL]        = {"NULL", NULL },
-        [GF1_CLI_PROBE]  = { "PROBE_QUERY",  gf_cli3_1_probe},
-        [GF1_CLI_DEPROBE]  = { "DEPROBE_QUERY",  gf_cli3_1_deprobe},
-        [GF1_CLI_LIST_FRIENDS]  = { "LIST_FRIENDS",  gf_cli3_1_list_friends},
-        [GF1_CLI_CREATE_VOLUME] = {"CREATE_VOLUME", gf_cli3_1_create_volume},
-        [GF1_CLI_DELETE_VOLUME] = {"DELETE_VOLUME", gf_cli3_1_delete_volume},
-        [GF1_CLI_START_VOLUME] = {"START_VOLUME", gf_cli3_1_start_volume},
-        [GF1_CLI_STOP_VOLUME] = {"STOP_VOLUME", gf_cli3_1_stop_volume},
-        [GF1_CLI_RENAME_VOLUME] = {"RENAME_VOLUME", gf_cli3_1_rename_volume},
-        [GF1_CLI_DEFRAG_VOLUME] = {"DEFRAG_VOLUME", gf_cli3_1_defrag_volume},
-        [GF1_CLI_GET_VOLUME] = {"GET_VOLUME", gf_cli3_1_get_volume},
-        [GF1_CLI_GET_NEXT_VOLUME] = {"GET_NEXT_VOLUME", gf_cli3_1_get_next_volume},
-        [GF1_CLI_SET_VOLUME] = {"SET_VOLUME", gf_cli3_1_set_volume},
-        [GF1_CLI_ADD_BRICK] = {"ADD_BRICK", gf_cli3_1_add_brick},
-        [GF1_CLI_REMOVE_BRICK] = {"REMOVE_BRICK", gf_cli3_1_remove_brick},
-        [GF1_CLI_REPLACE_BRICK] = {"REPLACE_BRICK", gf_cli3_1_replace_brick},
-        [GF1_CLI_LOG_FILENAME] = {"LOG FILENAME", gf_cli3_1_log_filename},
-        [GF1_CLI_LOG_LOCATE] = {"LOG LOCATE", gf_cli3_1_log_locate},
-        [GF1_CLI_LOG_ROTATE] = {"LOG ROTATE", gf_cli3_1_log_rotate},
-        [GF1_CLI_GETSPEC] = {"GETSPEC", gf_cli3_1_getspec},
-        [GF1_CLI_PMAP_PORTBYBRICK] = {"PMAP PORTBYBRICK", gf_cli3_1_pmap_b2p},
-        [GF1_CLI_SYNC_VOLUME] = {"SYNC_VOLUME", gf_cli3_1_sync_volume},
-        [GF1_CLI_RESET_VOLUME] = {"RESET_VOLUME", gf_cli3_1_reset_volume},
-        [GF1_CLI_GSYNC_SET] = {"GSYNC_SET", gf_cli3_1_gsync_set},
-        [GF1_CLI_FSM_LOG] = {"FSM_LOG", gf_cli3_1_fsm_log}
+struct rpc_clnt_procedure gluster_cli_actors[GLUSTER_CLI_MAXVALUE] = {
+        [GLUSTER_CLI_NULL]             = {"NULL", NULL },
+        [GLUSTER_CLI_PROBE]            = {"PROBE_QUERY", gf_cli3_1_probe},
+        [GLUSTER_CLI_DEPROBE]          = {"DEPROBE_QUERY", gf_cli3_1_deprobe},
+        [GLUSTER_CLI_LIST_FRIENDS]     = {"LIST_FRIENDS", gf_cli3_1_list_friends},
+        [GLUSTER_CLI_CREATE_VOLUME]    = {"CREATE_VOLUME", gf_cli3_1_create_volume},
+        [GLUSTER_CLI_DELETE_VOLUME]    = {"DELETE_VOLUME", gf_cli3_1_delete_volume},
+        [GLUSTER_CLI_START_VOLUME]     = {"START_VOLUME", gf_cli3_1_start_volume},
+        [GLUSTER_CLI_STOP_VOLUME]      = {"STOP_VOLUME", gf_cli3_1_stop_volume},
+        [GLUSTER_CLI_RENAME_VOLUME]    = {"RENAME_VOLUME", gf_cli3_1_rename_volume},
+        [GLUSTER_CLI_DEFRAG_VOLUME]    = {"DEFRAG_VOLUME", gf_cli3_1_defrag_volume},
+        [GLUSTER_CLI_GET_VOLUME]       = {"GET_VOLUME", gf_cli3_1_get_volume},
+        [GLUSTER_CLI_GET_NEXT_VOLUME]  = {"GET_NEXT_VOLUME", gf_cli3_1_get_next_volume},
+        [GLUSTER_CLI_SET_VOLUME]       = {"SET_VOLUME", gf_cli3_1_set_volume},
+        [GLUSTER_CLI_ADD_BRICK]        = {"ADD_BRICK", gf_cli3_1_add_brick},
+        [GLUSTER_CLI_REMOVE_BRICK]     = {"REMOVE_BRICK", gf_cli3_1_remove_brick},
+        [GLUSTER_CLI_REPLACE_BRICK]    = {"REPLACE_BRICK", gf_cli3_1_replace_brick},
+        [GLUSTER_CLI_LOG_FILENAME]     = {"LOG FILENAME", gf_cli3_1_log_filename},
+        [GLUSTER_CLI_LOG_LOCATE]       = {"LOG LOCATE", gf_cli3_1_log_locate},
+        [GLUSTER_CLI_LOG_ROTATE]       = {"LOG ROTATE", gf_cli3_1_log_rotate},
+        [GLUSTER_CLI_GETSPEC]          = {"GETSPEC", gf_cli3_1_getspec},
+        [GLUSTER_CLI_PMAP_PORTBYBRICK] = {"PMAP PORTBYBRICK", gf_cli3_1_pmap_b2p},
+        [GLUSTER_CLI_SYNC_VOLUME]      = {"SYNC_VOLUME", gf_cli3_1_sync_volume},
+        [GLUSTER_CLI_RESET_VOLUME]     = {"RESET_VOLUME", gf_cli3_1_reset_volume},
+        [GLUSTER_CLI_FSM_LOG]          = {"FSM_LOG", gf_cli3_1_fsm_log},
+        [GLUSTER_CLI_GSYNC_SET]        = {"GSYNC_SET", gf_cli3_1_gsync_set},
 };
 
-struct rpc_clnt_program cli3_1_prog = {
-        .progname = "CLI 3.1",
-        .prognum  = GLUSTER3_1_CLI_PROGRAM,
-        .progver  = GLUSTER3_1_CLI_VERSION,
-        .proctable  = gluster3_1_cli_actors,
-        .numproc  = GLUSTER3_1_CLI_PROCCNT,
+struct rpc_clnt_program cli_prog = {
+        .progname  = "Gluster CLI",
+        .prognum   = GLUSTER_CLI_PROGRAM,
+        .progver   = GLUSTER_CLI_VERSION,
+        .numproc   = GLUSTER_CLI_PROCCNT,
+        .proctable = gluster_cli_actors,
 };
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 7a0d1ab..7091101 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -101,7 +101,7 @@  struct rpc_clnt *global_rpc;
 rpc_clnt_prog_t *cli_rpc_prog;
 
 
-extern struct rpc_clnt_program cli3_1_prog;
+extern struct rpc_clnt_program cli_prog;
 
 static error_t
 parse_opts (int key, char *arg, struct argp_state *argp_state)
@@ -499,7 +499,7 @@  cli_rpc_init (struct cli_state *state)
 
 
         this = THIS;
-        cli_rpc_prog = &cli3_1_prog;
+        cli_rpc_prog = &cli_prog;
         options = dict_new ();
         if (!options)
                 goto out;
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
index 7b31be2..05781ef 100644
--- a/rpc/rpc-lib/src/protocol-common.h
+++ b/rpc/rpc-lib/src/protocol-common.h
@@ -111,36 +111,6 @@  enum gf_mgmt_procnum_ {
 
 typedef enum gf_mgmt_procnum_ gf_mgmt_procnum;
 
-enum gf_cli_procnum {
-        GF1_CLI_NULL = GD_MGMT_MAXVALUE+1,    /* 0 */
-        GF1_CLI_PROBE,
-        GF1_CLI_DEPROBE,
-        GF1_CLI_LIST_FRIENDS,
-        GF1_CLI_CREATE_VOLUME,
-        GF1_CLI_GET_VOLUME,
-        GF1_CLI_GET_NEXT_VOLUME,
-        GF1_CLI_DELETE_VOLUME,
-        GF1_CLI_START_VOLUME,
-        GF1_CLI_STOP_VOLUME,
-        GF1_CLI_RENAME_VOLUME,
-        GF1_CLI_DEFRAG_VOLUME,
-        GF1_CLI_SET_VOLUME,
-        GF1_CLI_ADD_BRICK,
-        GF1_CLI_REMOVE_BRICK,
-        GF1_CLI_REPLACE_BRICK,
-        GF1_CLI_LOG_FILENAME,
-        GF1_CLI_LOG_LOCATE,
-        GF1_CLI_LOG_ROTATE,
-        GF1_CLI_GETSPEC,
-        GF1_CLI_PMAP_PORTBYBRICK,
-        GF1_CLI_SYNC_VOLUME,
-        GF1_CLI_RESET_VOLUME,
-        GF1_CLI_FSM_LOG,
-        GF1_CLI_GSYNC_SET,
-        GF1_CLI_MAXVALUE,
-};
-
-
 enum gf_pmap_procnum {
         GF_PMAP_NULL = 0,
         GF_PMAP_PORTBYBRICK,
@@ -184,6 +154,49 @@  enum gf_cbk_procnum {
         GF_CBK_MAXVALUE,
 };
 
+enum glusterd_mgmt_procnum {
+        GLUSTERD_MGMT_NULL,    /* 0 */
+        GLUSTERD_MGMT_PROBE_QUERY,
+        GLUSTERD_MGMT_FRIEND_ADD,
+        GLUSTERD_MGMT_CLUSTER_LOCK,
+        GLUSTERD_MGMT_CLUSTER_UNLOCK,
+        GLUSTERD_MGMT_STAGE_OP,
+        GLUSTERD_MGMT_COMMIT_OP,
+        GLUSTERD_MGMT_FRIEND_REMOVE,
+        GLUSTERD_MGMT_FRIEND_UPDATE,
+        GLUSTERD_MGMT_MAXVALUE,
+};
+
+enum gluster_cli_procnum {
+        GLUSTER_CLI_NULL,    /* 0 */
+        GLUSTER_CLI_PROBE,
+        GLUSTER_CLI_DEPROBE,
+        GLUSTER_CLI_LIST_FRIENDS,
+        GLUSTER_CLI_CREATE_VOLUME,
+        GLUSTER_CLI_GET_VOLUME,
+        GLUSTER_CLI_GET_NEXT_VOLUME,
+        GLUSTER_CLI_DELETE_VOLUME,
+        GLUSTER_CLI_START_VOLUME,
+        GLUSTER_CLI_STOP_VOLUME,
+        GLUSTER_CLI_RENAME_VOLUME,
+        GLUSTER_CLI_DEFRAG_VOLUME,
+        GLUSTER_CLI_SET_VOLUME,
+        GLUSTER_CLI_ADD_BRICK,
+        GLUSTER_CLI_REMOVE_BRICK,
+        GLUSTER_CLI_REPLACE_BRICK,
+        GLUSTER_CLI_LOG_FILENAME,
+        GLUSTER_CLI_LOG_LOCATE,
+        GLUSTER_CLI_LOG_ROTATE,
+        GLUSTER_CLI_GETSPEC,
+        GLUSTER_CLI_PMAP_PORTBYBRICK,
+        GLUSTER_CLI_SYNC_VOLUME,
+        GLUSTER_CLI_RESET_VOLUME,
+        GLUSTER_CLI_FSM_LOG,
+        GLUSTER_CLI_GSYNC_SET,
+        GLUSTER_CLI_MAXVALUE,
+};
+
+
 #define GLUSTER3_1_FOP_PROGRAM   1298437 /* Completely random */
 #define GLUSTER3_1_FOP_VERSION   310 /* 3.1.0 */
 #define GLUSTER3_1_FOP_PROCCNT   GFS3_OP_MAXVALUE
@@ -192,9 +205,13 @@  enum gf_cbk_procnum {
 #define GLUSTERD1_MGMT_VERSION   1   /* 0.0.1 */
 #define GLUSTERD1_MGMT_PROCCNT   GD_MGMT_MAXVALUE
 
-#define GLUSTER3_1_CLI_PROGRAM   1298433 /* Completely random */
-#define GLUSTER3_1_CLI_VERSION   1   /* 0.0.1 */
-#define GLUSTER3_1_CLI_PROCCNT   GF1_CLI_MAXVALUE
+#define GD_MGMT_PROGRAM          1238433 /* Completely random */
+#define GD_MGMT_VERSION          1   /* 0.0.1 */
+#define GD_MGMT_PROCCNT          GLUSTERD_MGMT_MAXVALUE
+
+#define GLUSTER_CLI_PROGRAM      1238463 /* Completely random */
+#define GLUSTER_CLI_VERSION      1   /* 0.0.1 */
+#define GLUSTER_CLI_PROCCNT      GLUSTER_CLI_MAXVALUE
 
 #define GLUSTER_HNDSK_PROGRAM    14398633 /* Completely random */
 #define GLUSTER_HNDSK_VERSION    1   /* 0.0.1 */
diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am
index b1859de..84209b6 100644
--- a/xlators/mgmt/glusterd/src/Makefile.am
+++ b/xlators/mgmt/glusterd/src/Makefile.am
@@ -2,7 +2,7 @@  xlator_LTLIBRARIES = glusterd.la
 xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/mgmt
 glusterd_la_LDFLAGS = -module -avoidversion
 glusterd_la_SOURCES = glusterd.c glusterd-handler.c glusterd-sm.c glusterd-op-sm.c \
-	glusterd-utils.c glusterd3_1-mops.c glusterd-store.c glusterd-handshake.c \
+	glusterd-utils.c glusterd-rpc-ops.c glusterd-store.c glusterd-handshake.c \
 	glusterd-pmap.c glusterd-volgen.c glusterd-rebalance.c
 
 glusterd_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la\
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index b8ea6fa..3bcae6b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -3714,6 +3714,59 @@  glusterd_null (rpcsvc_request_t *req)
         return 0;
 }
 
+rpcsvc_actor_t gd_svc_mgmt_actors[] = {
+        [GLUSTERD_MGMT_NULL]           = { "NULL", GLUSTERD_MGMT_NULL, glusterd_null, NULL, NULL},
+        [GLUSTERD_MGMT_PROBE_QUERY]    = { "PROBE_QUERY", GLUSTERD_MGMT_PROBE_QUERY, glusterd_handle_probe_query, NULL, NULL},
+        [GLUSTERD_MGMT_FRIEND_ADD]     = { "FRIEND_ADD", GLUSTERD_MGMT_FRIEND_ADD, glusterd_handle_incoming_friend_req, NULL, NULL},
+        [GLUSTERD_MGMT_FRIEND_REMOVE]  = { "FRIEND_REMOVE", GLUSTERD_MGMT_FRIEND_REMOVE, glusterd_handle_incoming_unfriend_req, NULL, NULL},
+        [GLUSTERD_MGMT_FRIEND_UPDATE]  = { "FRIEND_UPDATE", GLUSTERD_MGMT_FRIEND_UPDATE, glusterd_handle_friend_update, NULL, NULL},
+        [GLUSTERD_MGMT_CLUSTER_LOCK]   = { "CLUSTER_LOCK", GLUSTERD_MGMT_CLUSTER_LOCK, glusterd_handle_cluster_lock, NULL, NULL},
+        [GLUSTERD_MGMT_CLUSTER_UNLOCK] = { "CLUSTER_UNLOCK", GLUSTERD_MGMT_CLUSTER_UNLOCK, glusterd_handle_cluster_unlock, NULL, NULL},
+        [GLUSTERD_MGMT_STAGE_OP]       = { "STAGE_OP", GLUSTERD_MGMT_STAGE_OP, glusterd_handle_stage_op, NULL, NULL},
+        [GLUSTERD_MGMT_COMMIT_OP]      = { "COMMIT_OP", GLUSTERD_MGMT_COMMIT_OP, glusterd_handle_commit_op, NULL, NULL},
+};
+
+struct rpcsvc_program gd_svc_mgmt_prog = {
+        .progname  = "GlusterD svc mgmt",
+        .prognum   = GD_MGMT_PROGRAM,
+        .progver   = GD_MGMT_VERSION,
+        .numactors = GD_MGMT_PROCCNT,
+        .actors    = gd_svc_mgmt_actors,
+};
+
+rpcsvc_actor_t gd_svc_cli_actors[] = {
+        [GLUSTER_CLI_PROBE]         = { "CLI_PROBE", GLUSTER_CLI_PROBE, glusterd_handle_cli_probe, NULL, NULL},
+        [GLUSTER_CLI_CREATE_VOLUME] = { "CLI_CREATE_VOLUME", GLUSTER_CLI_CREATE_VOLUME, glusterd_handle_create_volume, NULL,NULL},
+        [GLUSTER_CLI_DEFRAG_VOLUME] = { "CLI_DEFRAG_VOLUME", GLUSTER_CLI_DEFRAG_VOLUME, glusterd_handle_defrag_volume, NULL,NULL},
+        [GLUSTER_CLI_DEPROBE]       = { "FRIEND_REMOVE", GLUSTER_CLI_DEPROBE, glusterd_handle_cli_deprobe, NULL, NULL},
+        [GLUSTER_CLI_LIST_FRIENDS]  = { "LIST_FRIENDS", GLUSTER_CLI_LIST_FRIENDS, glusterd_handle_cli_list_friends, NULL, NULL},
+        [GLUSTER_CLI_START_VOLUME]  = { "START_VOLUME", GLUSTER_CLI_START_VOLUME, glusterd_handle_cli_start_volume, NULL, NULL},
+        [GLUSTER_CLI_STOP_VOLUME]   = { "STOP_VOLUME", GLUSTER_CLI_STOP_VOLUME, glusterd_handle_cli_stop_volume, NULL, NULL},
+        [GLUSTER_CLI_DELETE_VOLUME] = { "DELETE_VOLUME", GLUSTER_CLI_DELETE_VOLUME, glusterd_handle_cli_delete_volume, NULL, NULL},
+        [GLUSTER_CLI_GET_VOLUME]    = { "GET_VOLUME", GLUSTER_CLI_GET_VOLUME, glusterd_handle_cli_get_volume, NULL, NULL},
+        [GLUSTER_CLI_ADD_BRICK]     = { "ADD_BRICK", GLUSTER_CLI_ADD_BRICK, glusterd_handle_add_brick, NULL, NULL},
+        [GLUSTER_CLI_REPLACE_BRICK] = { "REPLACE_BRICK", GLUSTER_CLI_REPLACE_BRICK, glusterd_handle_replace_brick, NULL, NULL},
+        [GLUSTER_CLI_REMOVE_BRICK]  = { "REMOVE_BRICK", GLUSTER_CLI_REMOVE_BRICK, glusterd_handle_remove_brick, NULL, NULL},
+        [GLUSTER_CLI_LOG_FILENAME]  = { "LOG FILENAME", GLUSTER_CLI_LOG_FILENAME, glusterd_handle_log_filename, NULL, NULL},
+        [GLUSTER_CLI_LOG_LOCATE]    = { "LOG LOCATE", GLUSTER_CLI_LOG_LOCATE, glusterd_handle_log_locate, NULL, NULL},
+        [GLUSTER_CLI_LOG_ROTATE]    = { "LOG FILENAME", GLUSTER_CLI_LOG_ROTATE, glusterd_handle_log_rotate, NULL, NULL},
+        [GLUSTER_CLI_SET_VOLUME]    = { "SET_VOLUME", GLUSTER_CLI_SET_VOLUME, glusterd_handle_set_volume, NULL, NULL},
+        [GLUSTER_CLI_SYNC_VOLUME]   = { "SYNC_VOLUME", GLUSTER_CLI_SYNC_VOLUME, glusterd_handle_sync_volume, NULL, NULL},
+        [GLUSTER_CLI_RESET_VOLUME]  = { "RESET_VOLUME", GLUSTER_CLI_RESET_VOLUME, glusterd_handle_reset_volume, NULL, NULL},
+        [GLUSTER_CLI_FSM_LOG]       = { "FSM_LOG", GLUSTER_CLI_FSM_LOG, glusterd_handle_fsm_log, NULL, NULL},
+        [GLUSTER_CLI_GSYNC_SET]     = { "GSYNC_SET", GLUSTER_CLI_GSYNC_SET, glusterd_handle_gsync_set, NULL, NULL},
+};
+
+struct rpcsvc_program gd_svc_cli_prog = {
+        .progname  = "GlusterD svc cli",
+        .prognum   = GLUSTER_CLI_PROGRAM,
+        .progver   = GLUSTER_CLI_VERSION,
+        .numactors = GLUSTER_CLI_PROCCNT,
+        .actors    = gd_svc_cli_actors,
+};
+
+/* Keeping below programs for backword compatibility */
+
 rpcsvc_actor_t glusterd1_mgmt_actors[] = {
         [GD_MGMT_NULL]        = { "NULL",       GD_MGMT_NULL, glusterd_null, NULL, NULL},
         [GD_MGMT_PROBE_QUERY] = { "PROBE_QUERY", GD_MGMT_PROBE_QUERY, glusterd_handle_probe_query, NULL, NULL},
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index b8218e7..593add7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -37,6 +37,7 @@ 
 #include "rpcsvc.h"
 
 extern struct rpc_clnt_program glusterd3_1_mgmt_prog;
+extern struct rpc_clnt_program gd_clnt_mgmt_prog;
 
 typedef ssize_t (*gfs_serialize_t) (struct iovec outmsg, void *data);
 
@@ -288,6 +289,17 @@  glusterd_set_clnt_mgmt_program (glusterd_peerinfo_t *peerinfo,
 
         while (trav) {
                 /* Select 'programs' */
+                if ((gd_clnt_mgmt_prog.prognum == trav->prognum) &&
+                    (gd_clnt_mgmt_prog.progver == trav->progver)) {
+                        peerinfo->mgmt = &gd_clnt_mgmt_prog;
+                        gf_log ("", GF_LOG_INFO,
+                                "Using Program %s, Num (%"PRId64"), "
+                                "Version (%"PRId64")",
+                                trav->progname, trav->prognum, trav->progver);
+                        ret = 0;
+                        /* Break here, as this gets higher priority */
+                        break;
+                }
                 if ((glusterd3_1_mgmt_prog.prognum == trav->prognum) &&
                     (glusterd3_1_mgmt_prog.progver == trav->progver)) {
                         peerinfo->mgmt = &glusterd3_1_mgmt_prog;
@@ -296,7 +308,6 @@  glusterd_set_clnt_mgmt_program (glusterd_peerinfo_t *peerinfo,
                                 "Version (%"PRId64")",
                                 trav->progname, trav->prognum, trav->progver);
                         ret = 0;
-                        break;
                 }
                 if (ret) {
                         gf_log ("", GF_LOG_TRACE,
diff --git a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
similarity index 97%
rename from xlators/mgmt/glusterd/src/glusterd3_1-mops.c
rename to xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 01f2374..baa4325 100644
--- a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -1151,8 +1151,6 @@  struct rpc_clnt_procedure glusterd3_1_clnt_mgmt_actors[GD_MGMT_MAXVALUE] = {
         [GD_MGMT_FRIEND_UPDATE]  = { "FRIEND_UPDATE",  glusterd3_1_friend_update},
 };
 
-
-
 struct rpc_clnt_program glusterd3_1_mgmt_prog = {
         .progname  = "Mgmt 3.1",
         .prognum   = GLUSTERD1_MGMT_PROGRAM,
@@ -1160,3 +1158,23 @@  struct rpc_clnt_program glusterd3_1_mgmt_prog = {
         .proctable = glusterd3_1_clnt_mgmt_actors,
         .numproc   = GLUSTERD1_MGMT_PROCCNT,
 };
+
+struct rpc_clnt_procedure gd_clnt_mgmt_actors[GLUSTERD_MGMT_MAXVALUE] = {
+        [GLUSTERD_MGMT_NULL]           = {"NULL", NULL },
+        [GLUSTERD_MGMT_PROBE_QUERY]    = {"PROBE_QUERY", glusterd3_1_probe},
+        [GLUSTERD_MGMT_FRIEND_ADD]     = {"FRIEND_ADD", glusterd3_1_friend_add},
+        [GLUSTERD_MGMT_CLUSTER_LOCK]   = {"CLUSTER_LOCK", glusterd3_1_cluster_lock},
+        [GLUSTERD_MGMT_CLUSTER_UNLOCK] = {"CLUSTER_UNLOCK", glusterd3_1_cluster_unlock},
+        [GLUSTERD_MGMT_STAGE_OP]       = {"STAGE_OP", glusterd3_1_stage_op},
+        [GLUSTERD_MGMT_COMMIT_OP]      = {"COMMIT_OP", glusterd3_1_commit_op},
+        [GLUSTERD_MGMT_FRIEND_REMOVE]  = {"FRIEND_REMOVE", glusterd3_1_friend_remove},
+        [GLUSTERD_MGMT_FRIEND_UPDATE]  = {"FRIEND_UPDATE", glusterd3_1_friend_update},
+};
+
+struct rpc_clnt_program gd_clnt_mgmt_prog = {
+        .progname  = "glusterd clnt mgmt",
+        .prognum   = GD_MGMT_PROGRAM,
+        .progver   = GD_MGMT_VERSION,
+        .numproc   = GD_MGMT_PROCCNT,
+        .proctable = gd_clnt_mgmt_actors,
+};
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 50092f9..6757135 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -48,6 +48,8 @@ 
 
 static uuid_t glusterd_uuid;
 extern struct rpcsvc_program glusterd1_mop_prog;
+extern struct rpcsvc_program gd_svc_mgmt_prog;
+extern struct rpcsvc_program gd_svc_cli_prog;
 extern struct rpcsvc_program gluster_handshake_prog;
 extern struct rpcsvc_program gluster_pmap_prog;
 extern glusterd_op_info_t opinfo;
@@ -352,16 +354,33 @@  init (xlator_t *this)
                 goto out;
         }
 
+        ret = glusterd_program_register (this, rpc, &gd_svc_cli_prog);
+        if (ret) {
+                rpcsvc_program_unregister (rpc, &glusterd1_mop_prog);
+                goto out;
+        }
+
+        ret = glusterd_program_register (this, rpc, &gd_svc_mgmt_prog);
+        if (ret) {
+                rpcsvc_program_unregister (rpc, &glusterd1_mop_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, &glusterd1_mop_prog);
+                rpcsvc_program_unregister (rpc, &gd_svc_cli_prog);
+                rpcsvc_program_unregister (rpc, &gd_svc_mgmt_prog);
                 goto out;
         }
 
         ret = glusterd_program_register (this, rpc, &gluster_handshake_prog);
         if (ret) {
                 rpcsvc_program_unregister (rpc, &glusterd1_mop_prog);
-                rpcsvc_program_unregister (rpc, &gluster_handshake_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;
         }