summaryrefslogtreecommitdiffstats
path: root/cli/src/cli3_1-cops.c
diff options
context:
space:
mode:
authorMohammed Junaid Ahmed <junaid@gluster.com>2011-02-10 05:29:34 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-02-10 22:18:06 -0800
commit2e81c881f036d90323fd07d7df07d881723d7a28 (patch)
tree261c45c9faf90f70a8140994adcc02b9cd881220 /cli/src/cli3_1-cops.c
parent08ca1d3c7801d22f1de452f098b0a5df251ca5e7 (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 'cli/src/cli3_1-cops.c')
-rw-r--r--cli/src/cli3_1-cops.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c
index a9881502036..612b04724b0 100644
--- a/cli/src/cli3_1-cops.c
+++ b/cli/src/cli3_1-cops.c
@@ -2396,6 +2396,76 @@ out:
return ret;
}
+int
+gf_cli3_1_gsync_set_cbk (struct rpc_req *req, struct iovec *iov,
+ int count, void *myframe)
+{
+ int ret = 0;
+ gf1_cli_gsync_set_rsp rsp = {0, };
+
+ if (req->rpc_status == -1) {
+ ret = -1;
+ goto out;
+ }
+
+ ret = gf_xdr_to_cli_gsync_set_rsp (*iov, &rsp);
+ if (ret < 0) {
+ gf_log ("", GF_LOG_ERROR,
+ "Unable to get response structure");
+ goto out;
+ }
+
+ if (rsp.op_errstr)
+ cli_out ("%s", rsp.op_errstr);
+ else if (rsp.op_ret)
+ cli_out ("command unsuccessful");
+ else
+ cli_out ("command executed successfully");
+
+out:
+ ret = rsp.op_ret;
+
+ cli_cmd_broadcast_response (ret);
+
+ return ret;
+}
+
+int32_t
+gf_cli3_1_gsync_set (call_frame_t *frame, xlator_t *this,
+ void *data)
+{
+ int ret = 0;
+ dict_t *dict = NULL;
+ gf1_cli_gsync_set_req req;
+
+ if (!frame || !this || !data) {
+ ret = -1;
+ goto out;
+ }
+
+ dict = data;
+
+ ret = dict_allocate_and_serialize (dict,
+ &req.dict.dict_val,
+ (size_t *) &req.dict.dict_len);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "failed to serialize the data");
+
+ goto out;
+ }
+
+ ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
+ GD_MGMT_CLI_GSYNC_SET, NULL,
+ gf_xdr_from_cli_gsync_set_req,
+ this, gf_cli3_1_gsync_set_cbk);
+
+out:
+ return ret;
+}
+
+
+
struct rpc_clnt_procedure gluster3_1_cli_actors[GF1_CLI_MAXVALUE] = {
[GF1_CLI_NULL] = {"NULL", NULL },
[GF1_CLI_PROBE] = { "PROBE_QUERY", gf_cli3_1_probe},
@@ -2420,6 +2490,7 @@ struct rpc_clnt_procedure gluster3_1_cli_actors[GF1_CLI_MAXVALUE] = {
[GF1_CLI_PMAP_PORTBYBRICK] = {"PMAP PORTBYBRICK", gf_cli3_1_pmap_b2p},
[GF1_CLI_SYNC_VOLUME] = {"SYNC_VOLUME", gf_cli3_1_sync_volume},
[GF1_CLI_RESET_VOLUME] = {"RESET_VOLUME", gf_cli3_1_reset_volume},
+ [GF1_CLI_GSYNC_SET] = {"GSYNC_SET", gf_cli3_1_gsync_set},
[GF1_CLI_FSM_LOG] = {"FSM_LOG", gf_cli3_1_fsm_log}
};