summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli3_1-cops.c34
-rw-r--r--rpc/xdr/src/cli1-xdr.c22
-rw-r--r--rpc/xdr/src/cli1-xdr.h5
-rw-r--r--rpc/xdr/src/cli1.x5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c32
5 files changed, 91 insertions, 7 deletions
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c
index 612b04724..9aa4c2fb5 100644
--- a/cli/src/cli3_1-cops.c
+++ b/cli/src/cli3_1-cops.c
@@ -2397,6 +2397,39 @@ out:
}
int
+gsync_get_command (gf1_cli_gsync_set_rsp rsp)
+{
+ char cmd[1024] = {0,};
+
+ if (rsp.op_ret < 0)
+ return 0;
+
+ if (!rsp.gsync_prefix || !rsp.master || !rsp.slave)
+ return -1;
+
+ if (rsp.type == GF_GSYNC_OPTION_TYPE_CONFIG_GET) {
+ if (!rsp.op_name)
+ return -1;
+
+ snprintf (cmd, 1024, "%s/gsyncd.py %s %s --config-get %s ",
+ rsp.gsync_prefix, rsp.master, rsp.slave,
+ rsp.op_name);
+ system (cmd);
+ goto out;
+ }
+ if (rsp.type == GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL) {
+ snprintf (cmd, 1024, "%s/gsyncd.py %s %s --config-get-all ",
+ rsp.gsync_prefix, rsp.master, rsp.slave);
+
+ system (cmd);
+
+ goto out;
+ }
+out:
+ return 0;
+}
+
+int
gf_cli3_1_gsync_set_cbk (struct rpc_req *req, struct iovec *iov,
int count, void *myframe)
{
@@ -2422,6 +2455,7 @@ gf_cli3_1_gsync_set_cbk (struct rpc_req *req, struct iovec *iov,
else
cli_out ("command executed successfully");
+ gsync_get_command (rsp);
out:
ret = rsp.op_ret;
diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c
index a8da98e97..3a2f6a421 100644
--- a/rpc/xdr/src/cli1-xdr.c
+++ b/rpc/xdr/src/cli1-xdr.c
@@ -661,11 +661,21 @@ xdr_gf1_cli_gsync_set_req (XDR *xdrs, gf1_cli_gsync_set_req *objp)
bool_t
xdr_gf1_cli_gsync_set_rsp (XDR *xdrs, gf1_cli_gsync_set_rsp *objp)
{
- if (!xdr_int (xdrs, &objp->op_ret))
- return FALSE;
- if (!xdr_int (xdrs, &objp->op_errno))
- return FALSE;
- if (!xdr_string (xdrs, &objp->op_errstr, ~0))
- return FALSE;
+ if (!xdr_int (xdrs, &objp->op_ret))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->op_errno))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->op_errstr, ~0))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->op_name, ~0))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->master, ~0))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->slave, ~0))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->gsync_prefix, ~0))
+ return FALSE;
return TRUE;
}
diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h
index 3f77c9e9c..c47494312 100644
--- a/rpc/xdr/src/cli1-xdr.h
+++ b/rpc/xdr/src/cli1-xdr.h
@@ -415,6 +415,11 @@ struct gf1_cli_gsync_set_rsp {
int op_ret;
int op_errno;
char *op_errstr;
+ int type;
+ char *op_name;
+ char *master;
+ char *slave;
+ char *gsync_prefix;
};
typedef struct gf1_cli_gsync_set_rsp gf1_cli_gsync_set_rsp;
diff --git a/rpc/xdr/src/cli1.x b/rpc/xdr/src/cli1.x
index 1bc07a14e..97c50f6fd 100644
--- a/rpc/xdr/src/cli1.x
+++ b/rpc/xdr/src/cli1.x
@@ -300,4 +300,9 @@ struct gf1_cli_gsync_set_rsp {
int op_ret;
int op_errno;
string op_errstr<>;
+ int type;
+ string op_name<>;
+ string master<>;
+ string slave<>;
+ string gsync_prefix<>;
};
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 3a2fbd44c..5adecef83 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -5684,21 +5684,51 @@ glusterd_op_send_cli_response (int32_t op, int32_t op_ret,
}
case GD_MGMT_CLI_GSYNC_SET:
{
+ int config_type;
char *str = NULL;
+ char *master = NULL;
+ char *slave = NULL;
+ char *op_name = NULL;
gf1_cli_gsync_set_rsp rsp = {0,};
ctx = op_ctx;
rsp.op_ret = op_ret;
rsp.op_errno = op_errno;
rsp.op_errstr = "";
+ rsp.op_name = "";
+ rsp.master = "";
+ rsp.slave = "";
+ rsp.gsync_prefix = gf_strdup (GSYNCD_PREFIX);
if (ctx) {
ret = dict_get_str (ctx, "errstr",
&str);
if (ret == 0)
rsp.op_errstr = gf_strdup (str);
+ ret = dict_get_int32 (ctx, "config_type",
+ &config_type);
+ if (ret == 0)
+ rsp.type = config_type;
+ ret = dict_get_str (ctx, "master",
+ &master);
+ if (ret == 0)
+ rsp.master = gf_strdup (master);
+
+ ret = dict_get_str (ctx, "slave",
+ &slave);
+ if (ret == 0)
+ rsp.slave = gf_strdup (slave);
+
+ if (config_type ==
+ GF_GSYNC_OPTION_TYPE_CONFIG_GET) {
+ ret = dict_get_str (ctx, "op_name",
+ &op_name);
+ if (ret == 0)
+ rsp.op_name =
+ gf_strdup (op_name);
+ }
} else if (op_errstr)
rsp.op_errstr = op_errstr;
cli_rsp = &rsp;
- sfunc = gf_xdr_from_cli_sync_volume_rsp;
+ sfunc = gf_xdr_serialize_cli_gsync_set_rsp;
break;
}
}