diff options
author | Mohammed Junaid Ahmed <junaid@gluster.com> | 2011-02-10 05:29:34 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2011-02-10 22:18:06 -0800 |
commit | 2e81c881f036d90323fd07d7df07d881723d7a28 (patch) | |
tree | 261c45c9faf90f70a8140994adcc02b9cd881220 /xlators/mgmt/glusterd/src/glusterd-handler.c | |
parent | 08ca1d3c7801d22f1de452f098b0a5df251ca5e7 (diff) |
gsync: cli support for gsyncd.
Signed-off-by: Junaid <junaid@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1570 (geosync related changes)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index aafae5dad..b1a7ea810 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -1332,6 +1332,42 @@ out: } int +glusterd_handle_gsync_set (rpcsvc_request_t *req) +{ + int32_t ret = 0; + dict_t *dict = NULL; + gf1_cli_gsync_set_req cli_req;// = {0, }; + + GF_ASSERT (req); + + if (!gf_xdr_to_cli_gsync_set_req (req->msg[0], &cli_req)) { + req->rpc_err = GARBAGE_ARGS; + ret = -1; + goto out; + } + + if (cli_req.dict.dict_len) { + dict = dict_new (); + + ret = dict_unserialize (cli_req.dict.dict_val, + cli_req.dict.dict_len, + &dict); + if (ret < 0) { + gf_log ("glusterd", GF_LOG_ERROR, "failed to " + "unserialize req-buffer to dictionary"); + goto out; + } else { + dict->extra_stdfree = cli_req.dict.dict_val; + } + } + + ret = glusterd_gsync_set (req, dict); + +out: + return ret; +} + +int glusterd_handle_set_volume (rpcsvc_request_t *req) { int32_t ret = -1; @@ -3066,6 +3102,25 @@ glusterd_reset_volume (rpcsvc_request_t *req, dict_t *dict) return ret; } +int32_t +glusterd_gsync_set (rpcsvc_request_t *req, dict_t *dict) +{ + int ret = -1; + + glusterd_op_set_op (GD_OP_GSYNC_SET); + + glusterd_op_set_ctx (GD_OP_GSYNC_SET, dict); + + glusterd_op_set_ctx_free (GD_OP_GSYNC_SET, _gf_true); + + glusterd_op_set_cli_op (GD_MGMT_CLI_GSYNC_SET); + + glusterd_op_set_req (req); + + ret = glusterd_op_txn_begin (); + + return ret; +} int32_t |