diff options
author | Amar Tumballi <amar@gluster.com> | 2011-11-13 00:18:32 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-11-16 01:45:24 -0800 |
commit | a29ab15988f46fbe98151c37676185de970fb187 (patch) | |
tree | 7e768d2fdcfca5e1f1a26b524c2acfb700067d15 /xlators/mgmt/glusterd | |
parent | 7a97478dd1a343fcc5d9d4eab963882191a3de69 (diff) |
glusterd/cli: rpc cleanup
no more backward compatibility between glusterd <-> glusterd
Change-Id: Ibfcca1c7e315a90b2639c4cba8da19b11875051a
BUG: 3158
Reviewed-on: http://review.gluster.com/610
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shishir Gowda <shishirng@gluster.com>
Reviewed-by: Krishnan Parthasarathi <kp@gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 74 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handshake.c | 26 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 8 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 129 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-sm.c | 20 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-sm.h | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 20 |
7 files changed, 119 insertions, 159 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 04d3525ae..920bafa5b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -2764,10 +2764,6 @@ glusterd_null (rpcsvc_request_t *req) 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}, @@ -2778,10 +2774,28 @@ struct rpcsvc_program gd_svc_mgmt_prog = { .progname = "GlusterD svc mgmt", .prognum = GD_MGMT_PROGRAM, .progver = GD_MGMT_VERSION, - .numactors = GD_MGMT_PROCCNT, + .numactors = GLUSTERD_MGMT_MAXVALUE, .actors = gd_svc_mgmt_actors, }; +rpcsvc_actor_t gd_svc_peer_actors[] = { + [GLUSTERD_FRIEND_NULL] = { "NULL", GLUSTERD_MGMT_NULL, glusterd_null, NULL, NULL}, + [GLUSTERD_PROBE_QUERY] = { "PROBE_QUERY", GLUSTERD_PROBE_QUERY, glusterd_handle_probe_query, NULL, NULL}, + [GLUSTERD_FRIEND_ADD] = { "FRIEND_ADD", GLUSTERD_FRIEND_ADD, glusterd_handle_incoming_friend_req, NULL, NULL}, + [GLUSTERD_FRIEND_REMOVE] = { "FRIEND_REMOVE", GLUSTERD_FRIEND_REMOVE, glusterd_handle_incoming_unfriend_req, NULL, NULL}, + [GLUSTERD_FRIEND_UPDATE] = { "FRIEND_UPDATE", GLUSTERD_FRIEND_UPDATE, glusterd_handle_friend_update, NULL, NULL}, +}; + +struct rpcsvc_program gd_svc_peer_prog = { + .progname = "GlusterD svc peer", + .prognum = GD_FRIEND_PROGRAM, + .progver = GD_FRIEND_VERSION, + .numactors = GLUSTERD_FRIEND_MAXVALUE, + .actors = gd_svc_peer_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}, @@ -2795,8 +2809,6 @@ rpcsvc_actor_t gd_svc_cli_actors[] = { [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}, @@ -2805,7 +2817,6 @@ rpcsvc_actor_t gd_svc_cli_actors[] = { [GLUSTER_CLI_GSYNC_SET] = { "GSYNC_SET", GLUSTER_CLI_GSYNC_SET, glusterd_handle_gsync_set, NULL, NULL}, [GLUSTER_CLI_PROFILE_VOLUME] = { "STATS_VOLUME", GLUSTER_CLI_PROFILE_VOLUME, glusterd_handle_cli_profile_volume, NULL, NULL}, [GLUSTER_CLI_QUOTA] = { "QUOTA", GLUSTER_CLI_QUOTA, glusterd_handle_quota, NULL, NULL}, - [GLUSTER_CLI_LOG_LEVEL] = {"LOG_LEVEL", GLUSTER_CLI_LOG_LEVEL, glusterd_handle_log_level, NULL, NULL}, [GLUSTER_CLI_GETWD] = { "GETWD", GLUSTER_CLI_GETWD, glusterd_handle_getwd, NULL, NULL}, [GLUSTER_CLI_STATUS_VOLUME] = {"STATUS_VOLUME", GLUSTER_CLI_STATUS_VOLUME, glusterd_handle_status_volume, NULL, NULL}, [GLUSTER_CLI_MOUNT] = { "MOUNT", GLUSTER_CLI_MOUNT, glusterd_handle_mount, NULL, NULL}, @@ -2818,51 +2829,6 @@ struct rpcsvc_program gd_svc_cli_prog = { .progname = "GlusterD svc cli", .prognum = GLUSTER_CLI_PROGRAM, .progver = GLUSTER_CLI_VERSION, - .numactors = GLUSTER_CLI_PROCCNT, + .numactors = GLUSTER_CLI_MAXVALUE, .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}, - [GD_MGMT_FRIEND_ADD] = { "FRIEND_ADD", GD_MGMT_FRIEND_ADD, glusterd_handle_incoming_friend_req, NULL, NULL}, - [GD_MGMT_FRIEND_REMOVE] = { "FRIEND_REMOVE", GD_MGMT_FRIEND_REMOVE, glusterd_handle_incoming_unfriend_req, NULL, NULL}, - [GD_MGMT_FRIEND_UPDATE] = { "FRIEND_UPDATE", GD_MGMT_FRIEND_UPDATE, glusterd_handle_friend_update, NULL, NULL}, - [GD_MGMT_CLUSTER_LOCK] = { "CLUSTER_LOCK", GD_MGMT_CLUSTER_LOCK, glusterd_handle_cluster_lock, NULL, NULL}, - [GD_MGMT_CLUSTER_UNLOCK] = { "CLUSTER_UNLOCK", GD_MGMT_CLUSTER_UNLOCK, glusterd_handle_cluster_unlock, NULL, NULL}, - [GD_MGMT_STAGE_OP] = { "STAGE_OP", GD_MGMT_STAGE_OP, glusterd_handle_stage_op, NULL, NULL}, - [GD_MGMT_COMMIT_OP] = { "COMMIT_OP", GD_MGMT_COMMIT_OP, glusterd_handle_commit_op, NULL, NULL}, - [GD_MGMT_CLI_PROBE] = { "CLI_PROBE", GD_MGMT_CLI_PROBE, glusterd_handle_cli_probe, NULL, NULL}, - [GD_MGMT_CLI_CREATE_VOLUME] = { "CLI_CREATE_VOLUME", GD_MGMT_CLI_CREATE_VOLUME, glusterd_handle_create_volume, NULL,NULL}, - [GD_MGMT_CLI_DEFRAG_VOLUME] = { "CLI_DEFRAG_VOLUME", GD_MGMT_CLI_DEFRAG_VOLUME, glusterd_handle_defrag_volume, NULL,NULL}, - [GD_MGMT_CLI_DEPROBE] = { "FRIEND_REMOVE", GD_MGMT_CLI_DEPROBE, glusterd_handle_cli_deprobe, NULL, NULL}, - [GD_MGMT_CLI_LIST_FRIENDS] = { "LIST_FRIENDS", GD_MGMT_CLI_LIST_FRIENDS, glusterd_handle_cli_list_friends, NULL, NULL}, - [GD_MGMT_CLI_START_VOLUME] = { "START_VOLUME", GD_MGMT_CLI_START_VOLUME, glusterd_handle_cli_start_volume, NULL, NULL}, - [GD_MGMT_CLI_STOP_VOLUME] = { "STOP_VOLUME", GD_MGMT_CLI_STOP_VOLUME, glusterd_handle_cli_stop_volume, NULL, NULL}, - [GD_MGMT_CLI_DELETE_VOLUME] = { "DELETE_VOLUME", GD_MGMT_CLI_DELETE_VOLUME, glusterd_handle_cli_delete_volume, NULL, NULL}, - [GD_MGMT_CLI_GET_VOLUME] = { "GET_VOLUME", GD_MGMT_CLI_GET_VOLUME, glusterd_handle_cli_get_volume, NULL, NULL}, - [GD_MGMT_CLI_ADD_BRICK] = { "ADD_BRICK", GD_MGMT_CLI_ADD_BRICK, glusterd_handle_add_brick, NULL, NULL}, - [GD_MGMT_CLI_REPLACE_BRICK] = { "REPLACE_BRICK", GD_MGMT_CLI_REPLACE_BRICK, glusterd_handle_replace_brick, NULL, NULL}, - [GD_MGMT_CLI_REMOVE_BRICK] = { "REMOVE_BRICK", GD_MGMT_CLI_REMOVE_BRICK, glusterd_handle_remove_brick, NULL, NULL}, - [GD_MGMT_CLI_LOG_FILENAME] = { "LOG FILENAME", GD_MGMT_CLI_LOG_FILENAME, glusterd_handle_log_filename, NULL, NULL}, - [GD_MGMT_CLI_LOG_LOCATE] = { "LOG LOCATE", GD_MGMT_CLI_LOG_LOCATE, glusterd_handle_log_locate, NULL, NULL}, - [GD_MGMT_CLI_LOG_ROTATE] = { "LOG FILENAME", GD_MGMT_CLI_LOG_ROTATE, glusterd_handle_log_rotate, NULL, NULL}, - [GD_MGMT_CLI_SET_VOLUME] = { "SET_VOLUME", GD_MGMT_CLI_SET_VOLUME, glusterd_handle_set_volume, NULL, NULL}, - [GD_MGMT_CLI_SYNC_VOLUME] = { "SYNC_VOLUME", GD_MGMT_CLI_SYNC_VOLUME, glusterd_handle_sync_volume, NULL, NULL}, - [GD_MGMT_CLI_RESET_VOLUME] = { "RESET_VOLUME", GD_MGMT_CLI_RESET_VOLUME, glusterd_handle_reset_volume, NULL, NULL}, - [GD_MGMT_CLI_FSM_LOG] = { "FSM_LOG", GD_MGMT_CLI_FSM_LOG, glusterd_handle_fsm_log, NULL, NULL}, - [GD_MGMT_CLI_GSYNC_SET] = {"GSYNC_SET", GD_MGMT_CLI_GSYNC_SET, glusterd_handle_gsync_set, NULL, NULL}, - [GD_MGMT_CLI_PROFILE_VOLUME] = { "STATS_VOLUME", GD_MGMT_CLI_PROFILE_VOLUME, glusterd_handle_cli_profile_volume, NULL, NULL}, - [GD_MGMT_CLI_LOG_LEVEL] = {"LOG_LEVEL", GD_MGMT_CLI_LOG_LEVEL, glusterd_handle_log_level, NULL, NULL}, - [GD_MGMT_CLI_STATUS_VOLUME] = {"STATUS_VOLUME", GD_MGMT_CLI_STATUS_VOLUME, glusterd_handle_status_volume, NULL, NULL} -}; - -struct rpcsvc_program glusterd1_mop_prog = { - .progname = "GlusterD0.0.1", - .prognum = GLUSTERD1_MGMT_PROGRAM, - .progver = GLUSTERD1_MGMT_VERSION, - .numactors = GLUSTERD1_MGMT_PROCCNT, - .actors = glusterd1_mgmt_actors, -}; diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c index 8331a91f6..269c6015a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handshake.c +++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c @@ -36,8 +36,8 @@ #include "protocol-common.h" #include "rpcsvc.h" -extern struct rpc_clnt_program glusterd3_1_mgmt_prog; -extern struct rpc_clnt_program gd_clnt_mgmt_prog; +extern struct rpc_clnt_program gd_peer_prog; +extern struct rpc_clnt_program gd_mgmt_prog; typedef ssize_t (*gfs_serialize_t) (struct iovec outmsg, void *data); @@ -279,16 +279,14 @@ 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; + if ((gd_mgmt_prog.prognum == trav->prognum) && + (gd_mgmt_prog.progver == trav->progver)) { + peerinfo->mgmt = &gd_mgmt_prog; 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; + if ((gd_peer_prog.prognum == trav->prognum) && + (gd_peer_prog.progver == trav->progver)) { + peerinfo->peer = &gd_peer_prog; ret = 0; } if (ret) { @@ -300,12 +298,18 @@ glusterd_set_clnt_mgmt_program (glusterd_peerinfo_t *peerinfo, trav = trav->next; } - if (!ret && peerinfo->mgmt) { + if (peerinfo->mgmt) { gf_log ("", GF_LOG_INFO, "Using Program %s, Num (%d), Version (%d)", peerinfo->mgmt->progname, peerinfo->mgmt->prognum, peerinfo->mgmt->progver); } + if (peerinfo->peer) { + gf_log ("", GF_LOG_INFO, + "Using Program %s, Num (%d), Version (%d)", + peerinfo->peer->progname, peerinfo->peer->prognum, + peerinfo->peer->progver); + } out: return ret; diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 4e780c843..f933bbc37 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -165,7 +165,7 @@ glusterd_brick_op_build_payload (glusterd_op_t op, glusterd_brickinfo_t *brickin gf_log ("", GF_LOG_ERROR, "Out of Memory"); goto out; } - brick_req->op = GF_BRICK_TERMINATE; + brick_req->op = GLUSTERD_BRICK_TERMINATE; brick_req->name = ""; break; case GD_OP_PROFILE_VOLUME: @@ -177,7 +177,7 @@ glusterd_brick_op_build_payload (glusterd_op_t op, glusterd_brickinfo_t *brickin goto out; } - brick_req->op = GF_BRICK_XLATOR_INFO; + brick_req->op = GLUSTERD_BRICK_XLATOR_INFO; brick_req->name = brickinfo->path; break; @@ -188,7 +188,7 @@ glusterd_brick_op_build_payload (glusterd_op_t op, glusterd_brickinfo_t *brickin if (!brick_req) goto out; - brick_req->op = GF_BRICK_XLATOR_HEAL; + brick_req->op = GLUSTERD_BRICK_XLATOR_HEAL; brick_req->name = ""; } break; @@ -2839,7 +2839,7 @@ glusterd_op_ac_send_brick_op (glusterd_op_sm_event_t *event, void *ctx) goto out; } - proc = &priv->gfs_mgmt->proctable[GD_MGMT_BRICK_OP]; + proc = &priv->gfs_mgmt->proctable[GLUSTERD_BRICK_OP]; if (proc->fn) { ret = proc->fn (NULL, this, req_ctx); if (ret) diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c index 92be21f9f..f6b0908ae 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c @@ -45,9 +45,6 @@ extern glusterd_op_info_t opinfo; int32_t -glusterd3_1_brick_op (call_frame_t *frame, xlator_t *this, - void *data); -int32_t glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, int32_t op_errno, rpcsvc_request_t *req, void *op_ctx, char *op_errstr) @@ -1294,8 +1291,8 @@ glusterd3_1_probe (call_frame_t *frame, xlator_t *this, req.hostname = gf_strdup (hostname); req.port = port; - ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->mgmt, - GD_MGMT_PROBE_QUERY, + ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->peer, + GLUSTERD_PROBE_QUERY, NULL, this, glusterd3_1_probe_cbk, (xdrproc_t)xdr_gd1_mgmt_probe_req); @@ -1344,8 +1341,8 @@ glusterd3_1_friend_add (call_frame_t *frame, xlator_t *this, if (ret) goto out; - ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->mgmt, - GD_MGMT_FRIEND_ADD, + ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->peer, + GLUSTERD_FRIEND_ADD, NULL, this, glusterd3_1_friend_add_cbk, (xdrproc_t)xdr_gd1_mgmt_friend_req); @@ -1386,8 +1383,8 @@ glusterd3_1_friend_remove (call_frame_t *frame, xlator_t *this, uuid_copy (req.uuid, priv->uuid); req.hostname = peerinfo->hostname; req.port = peerinfo->port; - ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->mgmt, - GD_MGMT_FRIEND_REMOVE, NULL, + ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->peer, + GLUSTERD_FRIEND_REMOVE, NULL, this, glusterd3_1_friend_remove_cbk, (xdrproc_t)xdr_gd1_mgmt_friend_req); @@ -1432,8 +1429,8 @@ glusterd3_1_friend_update (call_frame_t *frame, xlator_t *this, dummy_frame = create_frame (this, this->ctx->pool); ret = glusterd_submit_request (peerinfo->rpc, &req, dummy_frame, - peerinfo->mgmt, - GD_MGMT_FRIEND_UPDATE, NULL, + peerinfo->peer, + GLUSTERD_FRIEND_UPDATE, NULL, this, glusterd3_1_friend_update_cbk, (xdrproc_t)xdr_gd1_mgmt_friend_update); @@ -1470,7 +1467,7 @@ glusterd3_1_cluster_lock (call_frame_t *frame, xlator_t *this, goto out; ret = glusterd_submit_request (peerinfo->rpc, &req, dummy_frame, - peerinfo->mgmt, GD_MGMT_CLUSTER_LOCK, + peerinfo->mgmt, GLUSTERD_MGMT_CLUSTER_LOCK, NULL, this, glusterd3_1_cluster_lock_cbk, (xdrproc_t)xdr_gd1_mgmt_cluster_lock_req); @@ -1504,7 +1501,7 @@ glusterd3_1_cluster_unlock (call_frame_t *frame, xlator_t *this, goto out; ret = glusterd_submit_request (peerinfo->rpc, &req, dummy_frame, - peerinfo->mgmt, GD_MGMT_CLUSTER_UNLOCK, + peerinfo->mgmt, GLUSTERD_MGMT_CLUSTER_UNLOCK, NULL, this, glusterd3_1_cluster_unlock_cbk, (xdrproc_t)xdr_gd1_mgmt_cluster_unlock_req); @@ -1563,7 +1560,7 @@ glusterd3_1_stage_op (call_frame_t *frame, xlator_t *this, goto out; ret = glusterd_submit_request (peerinfo->rpc, &req, dummy_frame, - peerinfo->mgmt, GD_MGMT_STAGE_OP, + peerinfo->mgmt, GLUSTERD_MGMT_STAGE_OP, NULL, this, glusterd3_1_stage_op_cbk, (xdrproc_t)xdr_gd1_mgmt_stage_op_req); @@ -1625,7 +1622,7 @@ glusterd3_1_commit_op (call_frame_t *frame, xlator_t *this, goto out; ret = glusterd_submit_request (peerinfo->rpc, &req, dummy_frame, - peerinfo->mgmt, GD_MGMT_COMMIT_OP, + peerinfo->mgmt, GLUSTERD_MGMT_COMMIT_OP, NULL, this, glusterd3_1_commit_op_cbk, (xdrproc_t)xdr_gd1_mgmt_commit_op_req); @@ -1718,60 +1715,6 @@ out: return ret; } - -struct rpc_clnt_procedure glusterd3_1_clnt_mgmt_actors[GD_MGMT_MAXVALUE] = { - [GD_MGMT_NULL] = {"NULL", NULL }, - [GD_MGMT_PROBE_QUERY] = { "PROBE_QUERY", glusterd3_1_probe}, - [GD_MGMT_FRIEND_ADD] = { "FRIEND_ADD", glusterd3_1_friend_add }, - [GD_MGMT_CLUSTER_LOCK] = {"CLUSTER_LOCK", glusterd3_1_cluster_lock}, - [GD_MGMT_CLUSTER_UNLOCK] = {"CLUSTER_UNLOCK", glusterd3_1_cluster_unlock}, - [GD_MGMT_STAGE_OP] = {"STAGE_OP", glusterd3_1_stage_op}, - [GD_MGMT_COMMIT_OP] = {"COMMIT_OP", glusterd3_1_commit_op}, - [GD_MGMT_FRIEND_REMOVE] = { "FRIEND_REMOVE", glusterd3_1_friend_remove}, - [GD_MGMT_FRIEND_UPDATE] = { "FRIEND_UPDATE", glusterd3_1_friend_update}, -}; - -struct rpc_clnt_procedure glusterd3_1_fs_mgmt_actors[GD_MGMT_MAXVALUE] = { - [GD_MGMT_NULL] = {"NULL", NULL }, - [GD_MGMT_BRICK_OP] = {"BRICK_OP", glusterd3_1_brick_op}, -}; - -struct rpc_clnt_program glusterd3_1_mgmt_prog = { - .progname = "Mgmt 3.1", - .prognum = GLUSTERD1_MGMT_PROGRAM, - .progver = GLUSTERD1_MGMT_VERSION, - .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, -}; - -struct rpc_clnt_program glusterd_glusterfs_3_1_mgmt_prog = { - .progname = "GlusterFS Mops", - .prognum = GLUSTERFS_PROGRAM, - .progver = GLUSTERFS_VERSION, - .proctable = glusterd3_1_fs_mgmt_actors, - .numproc = GLUSTERFS_PROCCNT, -}; - int32_t glusterd3_1_brick_op (call_frame_t *frame, xlator_t *this, void *data) @@ -1828,7 +1771,7 @@ glusterd3_1_brick_op (call_frame_t *frame, xlator_t *this, } ret = glusterd_submit_request (rpc, req, dummy_frame, - &glusterd_glusterfs_3_1_mgmt_prog, + priv->gfs_mgmt, req->op, NULL, this, glusterd3_1_brick_op_cbk, (xdrproc_t)xdr_gd1_mgmt_brick_op_req); @@ -1854,3 +1797,49 @@ out: gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); return ret; } + +struct rpc_clnt_procedure gd_brick_actors[GLUSTERD_BRICK_MAXVALUE] = { + [GLUSTERD_BRICK_NULL] = {"NULL", NULL }, + [GLUSTERD_BRICK_OP] = {"BRICK_OP", glusterd3_1_brick_op}, +}; + +struct rpc_clnt_procedure gd_peer_actors[GLUSTERD_FRIEND_MAXVALUE] = { + [GLUSTERD_FRIEND_NULL] = {"NULL", NULL }, + [GLUSTERD_PROBE_QUERY] = {"PROBE_QUERY", glusterd3_1_probe}, + [GLUSTERD_FRIEND_ADD] = {"FRIEND_ADD", glusterd3_1_friend_add}, + [GLUSTERD_FRIEND_REMOVE] = {"FRIEND_REMOVE", glusterd3_1_friend_remove}, + [GLUSTERD_FRIEND_UPDATE] = {"FRIEND_UPDATE", glusterd3_1_friend_update}, +}; + +struct rpc_clnt_procedure gd_mgmt_actors[GLUSTERD_MGMT_MAXVALUE] = { + [GLUSTERD_MGMT_NULL] = {"NULL", NULL }, + [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}, +}; + +struct rpc_clnt_program gd_mgmt_prog = { + .progname = "glusterd mgmt", + .prognum = GD_MGMT_PROGRAM, + .progver = GD_MGMT_VERSION, + .proctable = gd_mgmt_actors, + .numproc = GLUSTERD_MGMT_MAXVALUE, +}; + +struct rpc_clnt_program gd_brick_prog = { + .progname = "brick operations", + .prognum = GD_BRICK_PROGRAM, + .progver = GD_BRICK_VERSION, + .proctable = gd_brick_actors, + .numproc = GLUSTERD_BRICK_MAXVALUE, +}; + +struct rpc_clnt_program gd_peer_prog = { + .progname = "Peer mgmt", + .prognum = GD_FRIEND_PROGRAM, + .progver = GD_FRIEND_VERSION, + .proctable = gd_peer_actors, + .numproc = GLUSTERD_FRIEND_MAXVALUE, +}; + diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c index af054c9ae..2518ee0d4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-sm.c @@ -168,7 +168,7 @@ glusterd_broadcast_friend_delete (char *hostname, uuid_t uuid) goto out; list_for_each_entry (peerinfo, &priv->peers, uuid_list) { - if (!peerinfo->connected || !peerinfo->mgmt) + if (!peerinfo->connected || !peerinfo->peer) continue; ret = dict_set_static_ptr (friends, "peerinfo", peerinfo); @@ -177,7 +177,7 @@ glusterd_broadcast_friend_delete (char *hostname, uuid_t uuid) goto out; } - proc = &peerinfo->mgmt->proctable[GLUSTERD_MGMT_FRIEND_UPDATE]; + proc = &peerinfo->peer->proctable[GLUSTERD_FRIEND_UPDATE]; if (proc->fn) { ret = proc->fn (NULL, this, friends); } @@ -286,9 +286,9 @@ glusterd_ac_friend_add (glusterd_friend_sm_event_t *event, void *ctx) GF_ASSERT (conf); - if (!peerinfo->mgmt) + if (!peerinfo->peer) goto out; - proc = &peerinfo->mgmt->proctable[GLUSTERD_MGMT_FRIEND_ADD]; + proc = &peerinfo->peer->proctable[GLUSTERD_FRIEND_ADD]; if (proc->fn) { frame = create_frame (this, this->ctx->pool); if (!frame) { @@ -335,9 +335,9 @@ glusterd_ac_friend_probe (glusterd_friend_sm_event_t *event, void *ctx) goto out; } - if (!peerinfo->mgmt) + if (!peerinfo->peer) goto out; - proc = &peerinfo->mgmt->proctable[GLUSTERD_MGMT_PROBE_QUERY]; + proc = &peerinfo->peer->proctable[GLUSTERD_PROBE_QUERY]; if (proc->fn) { frame = create_frame (this, this->ctx->pool); if (!frame) { @@ -426,9 +426,9 @@ glusterd_ac_send_friend_remove_req (glusterd_friend_sm_event_t *event, goto out; } - if (!peerinfo->mgmt) + if (!peerinfo->peer) goto out; - proc = &peerinfo->mgmt->proctable[GLUSTERD_MGMT_FRIEND_REMOVE]; + proc = &peerinfo->peer->proctable[GLUSTERD_FRIEND_REMOVE]; if (proc->fn) { frame = create_frame (this, this->ctx->pool); if (!frame) { @@ -497,7 +497,7 @@ glusterd_ac_send_friend_update (glusterd_friend_sm_event_t *event, void *ctx) goto out; list_for_each_entry (peerinfo, &priv->peers, uuid_list) { - if (!peerinfo->connected || !peerinfo->mgmt) + if (!peerinfo->connected || !peerinfo->peer) continue; ret = dict_set_static_ptr (friends, "peerinfo", peerinfo); @@ -506,7 +506,7 @@ glusterd_ac_send_friend_update (glusterd_friend_sm_event_t *event, void *ctx) goto out; } - proc = &peerinfo->mgmt->proctable[GLUSTERD_MGMT_FRIEND_UPDATE]; + proc = &peerinfo->peer->proctable[GLUSTERD_FRIEND_UPDATE]; if (proc->fn) { ret = proc->fn (NULL, this, friends); } diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.h b/xlators/mgmt/glusterd/src/glusterd-sm.h index 465ac0105..7baaf0236 100644 --- a/xlators/mgmt/glusterd/src/glusterd-sm.h +++ b/xlators/mgmt/glusterd/src/glusterd-sm.h @@ -97,6 +97,7 @@ struct glusterd_peerinfo_ { struct list_head op_peers_list; struct rpc_clnt *rpc; rpc_clnt_prog_t *mgmt; + rpc_clnt_prog_t *peer; int connected; glusterd_store_handle_t *shandle; glusterd_sm_tr_log_t sm_log; diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index 83bbd1b22..b7e155314 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -51,13 +51,13 @@ #include "glusterd-mountbroker.h" 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; -extern struct rpc_clnt_program glusterd_glusterfs_3_1_mgmt_prog; +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; rpcsvc_cbk_program_t glusterd_cbk_prog = { .progname = "Gluster Callback", @@ -892,27 +892,27 @@ init (xlator_t *this) goto out; } - ret = glusterd_program_register (this, rpc, &glusterd1_mop_prog); + 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, &glusterd1_mop_prog); + 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, &glusterd1_mop_prog); + 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, &glusterd1_mop_prog); + 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; @@ -920,7 +920,7 @@ init (xlator_t *this) ret = glusterd_program_register (this, rpc, &gluster_handshake_prog); if (ret) { - rpcsvc_program_unregister (rpc, &glusterd1_mop_prog); + 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); @@ -938,7 +938,7 @@ init (xlator_t *this) INIT_LIST_HEAD (&conf->volumes); pthread_mutex_init (&conf->mutex, NULL); conf->rpc = rpc; - conf->gfs_mgmt = &glusterd_glusterfs_3_1_mgmt_prog; + conf->gfs_mgmt = &gd_brick_prog; strncpy (conf->workdir, dirname, PATH_MAX); INIT_LIST_HEAD (&conf->xprt_list); |