summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-handler.c
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2010-07-27 08:48:49 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-27 07:42:59 -0700
commit26cc6b015bb29f942194d1ca2a3dd21d5483d829 (patch)
treeeba35c888e4354f026a503429f5b9bcada02b1b6 /xlators/mgmt/glusterd/src/glusterd-handler.c
parent232235a9ddeaf33159ee8af809efee440b06c6d1 (diff)
DVM: Changes for remove brick
Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1220 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1220
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index c1ab57119..8fe0b31a6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -816,6 +816,44 @@ out:
}
int
+glusterd_handle_remove_brick (rpcsvc_request_t *req)
+{
+ int32_t ret = -1;
+ gf1_cli_remove_brick_req cli_req = {0,};
+ dict_t *dict = NULL;
+
+ GF_ASSERT (req);
+
+ if (!gf_xdr_to_cli_remove_brick_req (req->msg[0], &cli_req)) {
+ //failed to decode msg;
+ req->rpc_err = GARBAGE_ARGS;
+ goto out;
+ }
+
+ gf_log ("glusterd", GF_LOG_NORMAL, "Received rem brick req");
+
+ if (cli_req.bricks.bricks_len) {
+ /* Unserialize the dictionary */
+ dict = dict_new ();
+
+ ret = dict_unserialize (cli_req.bricks.bricks_val,
+ cli_req.bricks.bricks_len,
+ &dict);
+ if (ret < 0) {
+ gf_log ("glusterd", GF_LOG_ERROR,
+ "failed to "
+ "unserialize req-buffer to dictionary");
+ goto out;
+ }
+ }
+
+ ret = glusterd_remove_brick (req, dict);
+
+out:
+ return ret;
+}
+
+int
glusterd_op_lock_send_resp (rpcsvc_request_t *req, int32_t status)
{
@@ -1587,6 +1625,24 @@ glusterd_add_brick (rpcsvc_request_t *req, dict_t *dict)
}
int32_t
+glusterd_remove_brick (rpcsvc_request_t *req, dict_t *dict)
+{
+ int32_t ret = -1;
+
+ GF_ASSERT (req);
+ GF_ASSERT (dict);
+
+ glusterd_op_set_op (GD_OP_REMOVE_BRICK);
+
+ glusterd_op_set_ctx (GD_OP_REMOVE_BRICK, dict);
+ glusterd_op_set_req (req);
+
+ ret = glusterd_op_txn_begin ();
+
+ return ret;
+}
+
+int32_t
glusterd_list_friends (rpcsvc_request_t *req, dict_t *dict, int32_t flags)
{
int32_t ret = -1;