diff options
Diffstat (limited to 'glusterfsd/src/glusterfsd-mgmt.c')
-rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 92 |
1 files changed, 11 insertions, 81 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index ac487b94e5f..3404a5931f0 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -33,6 +33,7 @@ #include "xlator.h" #include "syscall.h" #include "monitoring.h" +#include "server.h" static gf_boolean_t is_mgmt_rpc_reconnect = _gf_false; int need_emancipate = 0; @@ -184,15 +185,6 @@ glusterfs_terminate_response_send (rpcsvc_request_t *req, int op_ret) return ret; } -void -glusterfs_autoscale_threads (glusterfs_ctx_t *ctx, int incr) -{ - struct event_pool *pool = ctx->event_pool; - - pool->auto_thread_count += incr; - (void) event_reconfigure_threads (pool, pool->eventthreadcount+incr); -} - int glusterfs_handle_terminate (rpcsvc_request_t *req) { @@ -244,7 +236,7 @@ glusterfs_handle_terminate (rpcsvc_request_t *req) gf_log (THIS->name, GF_LOG_INFO, "terminating after loss of last child %s", xlator_req.name); - glusterfs_mgmt_pmap_signout (glusterfsd_ctx, xlator_req.name); + rpc_clnt_mgmt_pmap_signout (glusterfsd_ctx, xlator_req.name); kill (getpid(), SIGTERM); } else { /* @@ -842,6 +834,8 @@ glusterfs_handle_attach (rpcsvc_request_t *req) xlator_t *nextchild = NULL; glusterfs_graph_t *newgraph = NULL; glusterfs_ctx_t *ctx = NULL; + xlator_t *srv_xl = NULL; + server_conf_t *srv_conf = NULL; GF_ASSERT (req); this = THIS; @@ -879,7 +873,13 @@ glusterfs_handle_attach (rpcsvc_request_t *req) nextchild->name); goto out; } - glusterfs_autoscale_threads (this->ctx, 1); + /* we need a protocol/server xlator as + * nextchild + */ + srv_xl = this->ctx->active->first; + srv_conf = (server_conf_t *)srv_xl->private; + rpcsvc_autoscale_threads (this->ctx, + srv_conf->rpc, 1); } } else { gf_log (this->name, GF_LOG_WARNING, @@ -2718,73 +2718,3 @@ out: return ret; } - -static int -mgmt_pmap_signout_cbk (struct rpc_req *req, struct iovec *iov, int count, - void *myframe) -{ - pmap_signout_rsp rsp = {0,}; - int ret = 0; - - if (-1 == req->rpc_status) { - rsp.op_ret = -1; - rsp.op_errno = EINVAL; - goto out; - } - - ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_pmap_signout_rsp); - if (ret < 0) { - gf_log (THIS->name, GF_LOG_ERROR, "XDR decoding failed"); - rsp.op_ret = -1; - rsp.op_errno = EINVAL; - goto out; - } - - if (-1 == rsp.op_ret) { - gf_log (THIS->name, GF_LOG_ERROR, - "failed to register the port with glusterd"); - goto out; - } -out: - return 0; -} - - -int -glusterfs_mgmt_pmap_signout (glusterfs_ctx_t *ctx, char *brickname) -{ - int ret = 0; - pmap_signout_req req = {0, }; - call_frame_t *frame = NULL; - cmd_args_t *cmd_args = NULL; - char brick_name[PATH_MAX] = {0,}; - - frame = create_frame (THIS, ctx->pool); - cmd_args = &ctx->cmd_args; - - if (!cmd_args->brick_port && (!cmd_args->brick_name || !brickname)) { - gf_log ("fsd-mgmt", GF_LOG_DEBUG, - "portmapper signout arguments not given"); - goto out; - } - - if (cmd_args->volfile_server_transport && - !strcmp(cmd_args->volfile_server_transport, "rdma")) { - snprintf (brick_name, sizeof(brick_name), "%s.rdma", - cmd_args->brick_name); - req.brick = brick_name; - } else { - if (brickname) - req.brick = brickname; - else - req.brick = cmd_args->brick_name; - } - - req.port = cmd_args->brick_port; - req.rdma_port = cmd_args->brick_port2; - ret = mgmt_submit_request (&req, frame, ctx, &clnt_pmap_prog, - GF_PMAP_SIGNOUT, mgmt_pmap_signout_cbk, - (xdrproc_t)xdr_pmap_signout_req); -out: - return ret; -} |