summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-handler.c
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2010-09-18 03:31:56 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-18 07:02:03 -0700
commit5c297be9612f76dad6f970092fb6762b4ee4844a (patch)
treef65290e7f12e8d6913f3f3b8d3ffa8dc4cd06618 /xlators/mgmt/glusterd/src/glusterd-handler.c
parentfaa817ea9cb119c7f65fce24f03a172fa4b4ada1 (diff)
Glusterd: gluster volume set <volume> <option> <value>
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1159 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 2c99a60e2..bc015293f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -1641,6 +1641,42 @@ out:
}
int
+glusterd_handle_set_volume (rpcsvc_request_t *req)
+{
+ int32_t ret = -1;
+ gf1_cli_set_vol_req cli_req = {0,};
+ dict_t *dict = NULL;
+
+ GF_ASSERT (req);
+
+ if (!gf_xdr_to_cli_set_vol_req (req->msg[0], &cli_req)) {
+ //failed to decode msg;
+ req->rpc_err = GARBAGE_ARGS;
+ goto out;
+ }
+
+ if (cli_req.dict.dict_len) {
+ /* Unserialize the dictionary */
+ 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;
+ }
+ }
+
+ ret = glusterd_set_volume (req, dict);
+
+out:
+ return ret;
+}
+
+int
glusterd_handle_remove_brick (rpcsvc_request_t *req)
{
int32_t ret = -1;
@@ -2970,6 +3006,29 @@ glusterd_replace_brick (rpcsvc_request_t *req, dict_t *dict)
}
int32_t
+glusterd_set_volume (rpcsvc_request_t *req, dict_t *dict)
+{
+ int32_t ret = -1;
+
+ GF_ASSERT (req);
+ GF_ASSERT (dict);
+
+ glusterd_op_set_op (GD_OP_SET_VOLUME);
+
+ glusterd_op_set_ctx (GD_OP_SET_VOLUME, dict);
+
+ glusterd_op_set_ctx_free (GD_OP_SET_VOLUME, _gf_true);
+
+ glusterd_op_set_cli_op (GD_MGMT_CLI_SET_VOLUME);
+
+ glusterd_op_set_req (req);
+
+ ret = glusterd_op_txn_begin ();
+
+ return ret;
+}
+
+int32_t
glusterd_remove_brick (rpcsvc_request_t *req, dict_t *dict)
{
int32_t ret = -1;