summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli-cmd-parser.c27
-rw-r--r--cli/src/cli-rpc-ops.c37
-rw-r--r--rpc/xdr/src/cli1-xdr.c4
-rw-r--r--rpc/xdr/src/cli1-xdr.h10
-rw-r--r--rpc/xdr/src/cli1-xdr.x9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c338
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c15
8 files changed, 143 insertions, 301 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 70a632751..4a395c849 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1121,11 +1121,11 @@ int32_t
cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
{
int32_t ret = -1;
- int32_t config_type = 0;
dict_t *dict = NULL;
gf1_cli_gsync_set type = GF_GSYNC_OPTION_TYPE_NONE;
char *append_str = NULL;
size_t append_len = 0;
+ char *subop = NULL;
int i = 0;
GF_ASSERT (words);
@@ -1192,34 +1192,32 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
}
if ((strcmp (words[2], "config")) == 0) {
- type = GF_GSYNC_OPTION_TYPE_CONFIGURE;
+ type = GF_GSYNC_OPTION_TYPE_CONFIG;
switch (wordcount) {
case 5:
- config_type = GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL;
+ subop = gf_strdup ("get-all");
break;
case 6:
if (words[5][0] == '!') {
- config_type = GF_GSYNC_OPTION_TYPE_CONFIG_DEL;
- i = 1;
- } else {
- config_type = GF_GSYNC_OPTION_TYPE_CONFIG_GET;
- i = 0;
- }
+ (words[5])++;
+ subop = gf_strdup ("del");
+ } else
+ subop = gf_strdup ("get");
- ret = dict_set_str (dict, "op_name", ((char *)words[5]) + i);
+ ret = dict_set_str (dict, "op_name", ((char *)words[5]));
if (ret < 0)
goto out;
break;
default:
- config_type = GF_GSYNC_OPTION_TYPE_CONFIG_SET;
-
if (wordcount < 7) {
ret = -1;
goto out;
}
+ subop = gf_strdup ("set");
+
ret = dict_set_str (dict, "op_name", (char *)words[5]);
if (ret < 0)
goto out;
@@ -1246,9 +1244,10 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
goto out;
}
- ret = dict_set_int32 (dict, "config_type", config_type);
- if (ret < 0)
+ if (!subop || dict_set_dynstr (dict, "subop", subop) != 0) {
+ ret = -1;
goto out;
+ }
} else {
ret = -1;
goto out;
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index d6c507d2c..34033b1ea 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -2586,7 +2586,7 @@ out:
int
-gf_cli3_1_gsync_get_command (gf1_cli_gsync_set_rsp rsp)
+gf_cli3_1_gsync_config_command (gf1_cli_gsync_set_rsp rsp)
{
char cmd[PATH_MAX] = {0,};
int ret = -1;
@@ -2597,28 +2597,21 @@ gf_cli3_1_gsync_get_command (gf1_cli_gsync_set_rsp rsp)
if (!rsp.gsync_prefix || !rsp.master || !rsp.slave || !rsp.glusterd_workdir)
return -1;
- if (rsp.config_type == GF_GSYNC_OPTION_TYPE_CONFIG_GET) {
- if (!rsp.op_name)
- return -1;
+ if (strcmp (rsp.subop, "get") != 0 && strcmp (rsp.subop, "get-all") != 0) {
+ cli_out (GEOREP" config updated successfully");
+ return 0;
+ }
- snprintf (cmd, PATH_MAX, GSYNCD_PREFIX "/gsyncd -c %s/%s :%s %s"
- " --config-get %s ",
- rsp.glusterd_workdir, GSYNC_CONF,
- rsp.master, rsp.slave, rsp.op_name);
- ret = system (cmd);
+ snprintf (cmd, PATH_MAX,
+ GSYNCD_PREFIX"/gsyncd -c %s/"GSYNC_CONF" :%s %s --config-%s%s%s",
+ rsp.glusterd_workdir, rsp.master, rsp.slave, rsp.subop,
+ *rsp.op_name ? " " : "", rsp.op_name);
+ ret = system (cmd);
/*
* gf_log() failure from system() ?
*/
- } else if (rsp.config_type == GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL) {
- snprintf (cmd, PATH_MAX, GSYNCD_PREFIX"/gsyncd -c %s/%s "
- ":%s %s --config-get-all ",
- rsp.glusterd_workdir, GSYNC_CONF,
- rsp.master, rsp.slave);
-
- ret = system (cmd);
- }
- return 0;
+ return ret ? -1 : 0;
}
int
@@ -2730,12 +2723,8 @@ gf_cli3_1_gsync_set_cbk (struct rpc_req *req, struct iovec *iov,
" has been successful", rsp.master, rsp.slave);
break;
- case GF_GSYNC_OPTION_TYPE_CONFIGURE:
- if(rsp.config_type==GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL
- || rsp.config_type==GF_GSYNC_OPTION_TYPE_CONFIG_GET)
- ret = gf_cli3_1_gsync_get_command (rsp);
- else
- cli_out (GEOREP" config updated successfully");
+ case GF_GSYNC_OPTION_TYPE_CONFIG:
+ ret = gf_cli3_1_gsync_config_command (rsp);
break;
case GF_GSYNC_OPTION_TYPE_STATUS:
diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c
index 0f5dc9866..e0a1e1075 100644
--- a/rpc/xdr/src/cli1-xdr.c
+++ b/rpc/xdr/src/cli1-xdr.c
@@ -749,10 +749,10 @@ xdr_gf1_cli_gsync_set_rsp (XDR *xdrs, gf1_cli_gsync_set_rsp *objp)
return FALSE;
if (!xdr_int (xdrs, &objp->type))
return FALSE;
- if (!xdr_int (xdrs, &objp->config_type))
- return FALSE;
if (!xdr_string (xdrs, &objp->op_name, ~0))
return FALSE;
+ if (!xdr_string (xdrs, &objp->subop, ~0))
+ return FALSE;
if (!xdr_string (xdrs, &objp->master, ~0))
return FALSE;
if (!xdr_string (xdrs, &objp->slave, ~0))
diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h
index 96f8def58..5b6bfd8f1 100644
--- a/rpc/xdr/src/cli1-xdr.h
+++ b/rpc/xdr/src/cli1-xdr.h
@@ -87,12 +87,8 @@ enum gf1_cli_gsync_set {
GF_GSYNC_OPTION_TYPE_NONE = 0,
GF_GSYNC_OPTION_TYPE_START = 1,
GF_GSYNC_OPTION_TYPE_STOP = 2,
- GF_GSYNC_OPTION_TYPE_CONFIGURE = 3,
- GF_GSYNC_OPTION_TYPE_CONFIG_SET = 4,
- GF_GSYNC_OPTION_TYPE_CONFIG_DEL = 5,
- GF_GSYNC_OPTION_TYPE_CONFIG_GET = 6,
- GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL = 7,
- GF_GSYNC_OPTION_TYPE_STATUS = 8,
+ GF_GSYNC_OPTION_TYPE_CONFIG = 3,
+ GF_GSYNC_OPTION_TYPE_STATUS = 4,
};
typedef enum gf1_cli_gsync_set gf1_cli_gsync_set;
@@ -478,8 +474,8 @@ struct gf1_cli_gsync_set_rsp {
int op_errno;
char *op_errstr;
int type;
- int config_type;
char *op_name;
+ char *subop;
char *master;
char *slave;
char *gsync_prefix;
diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x
index 99344a949..154a2c8e3 100644
--- a/rpc/xdr/src/cli1-xdr.x
+++ b/rpc/xdr/src/cli1-xdr.x
@@ -46,11 +46,8 @@ enum gf1_cli_gsync_set {
GF_GSYNC_OPTION_TYPE_NONE,
GF_GSYNC_OPTION_TYPE_START,
GF_GSYNC_OPTION_TYPE_STOP,
- GF_GSYNC_OPTION_TYPE_CONFIGURE,
- GF_GSYNC_OPTION_TYPE_CONFIG_SET,
- GF_GSYNC_OPTION_TYPE_CONFIG_DEL,
- GF_GSYNC_OPTION_TYPE_CONFIG_GET,
- GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL
+ GF_GSYNC_OPTION_TYPE_CONFIG,
+ GF_GSYNC_OPTION_TYPE_STATUS
};
enum gf1_cli_stats_op {
@@ -341,8 +338,8 @@ struct gf1_cli_gsync_set_rsp {
int op_errno;
string op_errstr<>;
int type;
- int config_type;
string op_name<>;
+ string subop<>;
string master<>;
string slave<>;
string gsync_prefix<>;
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index a78c876e3..bf601efcd 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -1752,8 +1752,8 @@ glusterd_handle_gsync_set (rpcsvc_request_t *req)
strncpy (operation, "stop", sizeof (operation));
break;
- case GF_GSYNC_OPTION_TYPE_CONFIGURE:
- strncpy (operation, "configure", sizeof (operation));
+ case GF_GSYNC_OPTION_TYPE_CONFIG:
+ strncpy (operation, "config", sizeof (operation));
break;
case GF_GSYNC_OPTION_TYPE_STATUS:
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 7003c5793..af0a4484c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1844,20 +1844,6 @@ gsync_status (char *master, char *slave, int *status)
}
-int
-gsync_validate_config_type (int32_t config_type)
-{
- switch (config_type) {
- case GF_GSYNC_OPTION_TYPE_CONFIG_SET:
- case GF_GSYNC_OPTION_TYPE_CONFIG_DEL:
- case GF_GSYNC_OPTION_TYPE_CONFIG_GET:
- case GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL:return 0;
- default: return -1;
- }
- return 0;
-}
-
-
int32_t
glusterd_gsync_volinfo_dict_set (glusterd_volinfo_t *volinfo,
char *key, char *value)
@@ -1883,61 +1869,77 @@ out:
}
int
-gsync_validate_config_option (dict_t *dict, int32_t config_type,
- char **op_errstr)
+gsync_verify_config_options (dict_t *dict, char **op_errstr)
{
char cmd[PATH_MAX] = {0,};
- int ret = -1;
char **resopt = NULL;
int i = 0;
+ char *subop = NULL;
char *op_name = NULL;
+ char *op_value = NULL;
gf_boolean_t banned = _gf_true;
- if (config_type == GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL)
+ if (dict_get_str (dict, "subop", &subop) != 0) {
+ gf_log ("", GF_LOG_WARNING, "missing subop");
+ *op_errstr = gf_strdup ("Invalid config request");
+ return -1;
+ }
+
+ if (strcmp (subop, "get-all") == 0)
return 0;
- ret = dict_get_str (dict, "op_name", &op_name);
- if (ret < 0) {
- gf_log ("", GF_LOG_WARNING, "option not specified");
- *op_errstr = gf_strdup ("Please specify the option");
+ if (dict_get_str (dict, "op_name", &op_name) != 0) {
+ gf_log ("", GF_LOG_WARNING, "option name missing");
+ *op_errstr = gf_strdup ("Option name missing");
return -1;
}
snprintf (cmd, PATH_MAX, GSYNCD_PREFIX"/gsyncd --config-check %s", op_name);
- ret = system (cmd);
- if (ret) {
+ if (system (cmd)) {
gf_log ("", GF_LOG_WARNING, "Invalid option %s", op_name);
*op_errstr = gf_strdup ("Invalid option");
- ret = -1;
+ return -1;
}
- if (ret != -1 &&
- (config_type == GF_GSYNC_OPTION_TYPE_CONFIG_SET ||
- config_type == GF_GSYNC_OPTION_TYPE_CONFIG_DEL)) {
- /* match option name against reserved options, modulo -/-
- * difference
- */
- for (resopt = gsync_reserved_opts; *resopt; resopt++) {
- banned = _gf_true;
- for (i = 0; (*resopt)[i] && op_name[i]; i++) {
- if ((*resopt)[i] == op_name[i] ||
- ((*resopt)[i] == '-' && op_name[i] == '_'))
- continue;
- banned = _gf_false;
- }
- if (banned) {
- gf_log ("", GF_LOG_WARNING, "Reserved option %s", op_name);
- *op_errstr = gf_strdup ("Reserved option");
+ if (strcmp (subop, "get") == 0)
+ return 0;
- ret = -1;
- break;
- }
+ if (strcmp (subop, "set") != 0 && strcmp (subop, "del") != 0) {
+ gf_log ("", GF_LOG_WARNING, "unknown subop %s", subop);
+ *op_errstr = gf_strdup ("Invalid config request");
+ return -1;
+ }
+
+ if (strcmp (subop, "set") == 0 &&
+ dict_get_str (dict, "op_value", &op_value) != 0) {
+ gf_log ("", GF_LOG_WARNING, "missing value for set");
+ *op_errstr = gf_strdup ("missing value");
+ }
+
+ /* match option name against reserved options, modulo -/_
+ * difference
+ */
+ for (resopt = gsync_reserved_opts; *resopt; resopt++) {
+ banned = _gf_true;
+ for (i = 0; (*resopt)[i] && op_name[i]; i++) {
+ if ((*resopt)[i] == op_name[i] ||
+ ((*resopt)[i] == '-' && op_name[i] == '_'))
+ continue;
+ banned = _gf_false;
+ }
+ if (banned) {
+ gf_log ("", GF_LOG_WARNING, "Reserved option %s", op_name);
+ *op_errstr = gf_strdup ("Reserved option");
+
+ return -1;
+ break;
}
}
- return ret;
+ return 0;
}
+
static void
_get_status_mst_slv (dict_t *this, char *key, data_t *value, void *data)
{
@@ -2025,38 +2027,6 @@ _remove_gsync_slave (dict_t *this, char *key, data_t *value, void *data)
}
-int
-gsync_verify_config_options (dict_t *dict, char **op_errstr)
-{
- int ret = -1;
- int config_type = 0;
-
- GF_VALIDATE_OR_GOTO ("gsync", dict, out);
- GF_VALIDATE_OR_GOTO ("gsync", op_errstr, out);
-
- ret = dict_get_int32 (dict, "config_type", &config_type);
- if (ret < 0) {
- gf_log ("", GF_LOG_WARNING, "config type is missing");
- *op_errstr = gf_strdup ("config-type missing");
- goto out;
- }
-
- ret = gsync_validate_config_type (config_type);
- if (ret == -1) {
- gf_log ("", GF_LOG_WARNING, "Invalid config type");
- *op_errstr = gf_strdup ("Invalid config type");
- goto out;
- }
-
- ret = gsync_validate_config_option (dict, config_type, op_errstr);
- if (ret < 0)
- goto out;
-
- ret = 0;
-out:
- return ret;
-}
-
static int
glusterd_remove_slave_in_info (glusterd_volinfo_t *volinfo, char *slave,
char *host_uuid, char **op_errstr)
@@ -2451,7 +2421,7 @@ glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr)
if (ret)
goto out;
break;
- case GF_GSYNC_OPTION_TYPE_CONFIGURE:
+ case GF_GSYNC_OPTION_TYPE_CONFIG:
ret = gsync_verify_config_options (dict, op_errstr);
if (ret < 0)
goto out;
@@ -4109,140 +4079,85 @@ out:
}
int
-gsync_config_set (char *master, char *slave,
- dict_t *dict, char **op_errstr)
+glusterd_check_restart_gsync_session (glusterd_volinfo_t *volinfo, char *slave);
+
+int
+glusterd_gsync_configure (glusterd_volinfo_t *volinfo, char *slave,
+ dict_t *dict, char **op_errstr)
{
int32_t ret = -1;
char *op_name = NULL;
char *op_value = NULL;
char cmd[1024] = {0,};
glusterd_conf_t *priv = NULL;
+ char *subop = NULL;
+ char *q1 = NULL;
+ char *q2 = NULL;
- if (THIS == NULL) {
- gf_log ("", GF_LOG_ERROR, "THIS of glusterd not present");
- *op_errstr = gf_strdup ("Error! Glusterd cannot start "GEOREP);
- goto out;
- }
-
- priv = THIS->private;
+ GF_ASSERT (volinfo);
+ GF_ASSERT (slave);
+ GF_ASSERT (op_errstr);
- if (priv == NULL) {
- gf_log ("", GF_LOG_ERROR, "priv of glusterd not present");
- *op_errstr = gf_strdup ("Error! Glusterd cannot start "GEOREP);
+ ret = dict_get_str (dict, "subop", &subop);
+ if (ret != 0)
goto out;
+
+ if (strcmp (subop, "get") == 0 || strcmp (subop, "get-all") == 0) {
+ /* deferred to cli */
+ gf_log ("", GF_LOG_DEBUG, "Returning 0");
+ return 0;
}
ret = dict_get_str (dict, "op_name", &op_name);
- if (ret < 0) {
- gf_log ("", GF_LOG_WARNING, "failed to get the "
- "option name for %s %s", master, slave);
-
- *op_errstr = gf_strdup ("configure command failed, "
- "please check the log-file\n");
+ if (ret != 0)
goto out;
- }
-
- ret = dict_get_str (dict, "op_value", &op_value);
- if (ret < 0) {
- gf_log ("", GF_LOG_WARNING, "failed to get "
- "the option value for %s %s",
- master, slave);
- *op_errstr = gf_strdup ("configure command "
- "failed, please check "
- "the log-file\n");
- goto out;
+ if (strcmp (subop, "set") == 0) {
+ ret = dict_get_str (dict, "op_value", &op_value);
+ if (ret != 0)
+ goto out;
+ q1 = " \"";
+ q2 = "\"";
+ } else {
+ q1 = "";
+ op_value = "";
+ q2 = "";
}
- ret = snprintf (cmd, 1024, GSYNCD_PREFIX"/gsyncd -c %s/%s :%s %s"
- " --config-set %s \" %s \"", priv->workdir,
- GSYNC_CONF, master, slave, op_name, op_value);
- if (ret <= 0) {
- gf_log ("", GF_LOG_WARNING, "failed to "
- "construct the gsyncd command");
-
- *op_errstr = gf_strdup ("configure command failed, "
- "please check the log-file\n");
+ if (THIS)
+ priv = THIS->private;
+ if (priv == NULL) {
+ gf_log ("", GF_LOG_ERROR, "priv of glusterd not present");
+ *op_errstr = gf_strdup ("glusterd defunct");
goto out;
}
+ ret = snprintf (cmd, 1024, GSYNCD_PREFIX"/gsyncd -c %s/"GSYNC_CONF" :%s %s"
+ " --config-%s %s" "%s%s%s", priv->workdir,
+ volinfo->volname, slave, subop, op_name,
+ q1, op_value, q2);
ret = system (cmd);
- if (ret == -1) {
+ if (ret) {
gf_log ("", GF_LOG_WARNING, "gsyncd failed to "
- "set %s option for %s %s peer",
- op_name, master, slave);
+ "%s %s option for %s %s peers",
+ subop, op_name, volinfo->volname, slave);
+
+ gf_asprintf (op_errstr, GEOREP" config-%s failed for %s %s",
+ subop, volinfo->volname, slave);
- *op_errstr = gf_strdup ("configure command "
- "failed, please check "
- "the log-file\n");
goto out;
}
ret = 0;
- *op_errstr = gf_strdup ("config-set successful");
+ gf_asprintf (op_errstr, "config-%s successful", subop);
out:
- return ret;
-}
-
-int
-gsync_config_del (char *master, char *slave,
- dict_t *dict, char **op_errstr)
-{
- int32_t ret = -1;
- char *op_name = NULL;
- char cmd[PATH_MAX] = {0,};
- glusterd_conf_t *priv = NULL;
-
- if (THIS == NULL) {
- gf_log ("", GF_LOG_ERROR, "THIS of glusterd not present");
- *op_errstr = gf_strdup ("Error! Glusterd cannot start "GEOREP);
- goto out;
- }
-
- priv = THIS->private;
-
- if (priv == NULL) {
- gf_log ("", GF_LOG_ERROR, "priv of glusterd not present");
- *op_errstr = gf_strdup ("Error! Glusterd cannot start "GEOREP);
- goto out;
- }
-
- ret = dict_get_str (dict, "op_name", &op_name);
- if (ret < 0) {
- gf_log ("", GF_LOG_WARNING, "failed to get "
- "the option for %s %s", master, slave);
-
- *op_errstr = gf_strdup ("configure command "
- "failed, please check "
- "the log-file\n");
- goto out;
- }
-
- ret = snprintf (cmd, PATH_MAX, GSYNCD_PREFIX"/gsyncd -c %s/%s :%s %s"
- " --config-del %s ", priv->workdir,
- GSYNC_CONF, master, slave, op_name);
- if (ret <= 0) {
- gf_log ("", GF_LOG_WARNING, "failed to "
- "construct the gsyncd command");
- *op_errstr = gf_strdup ("configure command "
- "failed, please check "
- "the log-file\n");
- goto out;
+ if (!ret) {
+ ret = glusterd_check_restart_gsync_session (volinfo, slave);
+ if (ret)
+ *op_errstr = gf_strdup ("internal error");
}
- ret = system (cmd);
- if (ret == -1) {
- gf_log ("", GF_LOG_WARNING, "failed to delete "
- "%s option for %s %s peer", op_name,
- master, slave);
- *op_errstr = gf_strdup ("configure command "
- "failed, please check "
- "the log-file\n");
- goto out;
- }
- ret = 0;
- *op_errstr = gf_strdup ("config-del successful");
-out:
+ gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
return ret;
}
@@ -4387,59 +4302,6 @@ glusterd_check_restart_gsync_session (glusterd_volinfo_t *volinfo, char *slave)
return ret;
}
-int
-glusterd_gsync_configure (glusterd_volinfo_t *volinfo, char *slave,
- dict_t *dict, char **op_errstr)
-{
- int32_t ret = -1;
- int32_t config_type = 0;
-
- GF_ASSERT (volinfo);
- GF_ASSERT (slave);
- GF_ASSERT (op_errstr);
-
- ret = dict_get_int32 (dict, "config_type", &config_type);
- if (ret < 0) {
- gf_log ("", GF_LOG_WARNING, "couldn't get the config-type"
- " for %s %s", volinfo->volname, slave);
- *op_errstr = gf_strdup ("configure command failed, "
- "please check the log-file\n");
- goto out;
- }
-
- if (config_type == GF_GSYNC_OPTION_TYPE_CONFIG_SET) {
- ret = gsync_config_set (volinfo->volname, slave, dict,
- op_errstr);
- if (ret)
- goto out;
- goto config_done;
- }
-
- if (config_type == GF_GSYNC_OPTION_TYPE_CONFIG_DEL) {
- ret = gsync_config_del (volinfo->volname, slave, dict,
- op_errstr);
- goto config_done;
- }
-
- if ((config_type == GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL) ||
- (config_type == GF_GSYNC_OPTION_TYPE_CONFIG_GET))
- goto out;
- else {
- gf_log ("", GF_LOG_WARNING, "Invalid config type");
- *op_errstr = gf_strdup ("Invalid config type");
- ret = -1;
- goto out;
- }
-
- config_done:
- ret = glusterd_check_restart_gsync_session (volinfo, slave);
- if (ret)
- *op_errstr = gf_strdup (GEOREP" conig: Internal error");
-out:
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
- return ret;
-}
-
int32_t
glusterd_marker_create_volfile (glusterd_volinfo_t *volinfo)
{
@@ -4724,7 +4586,7 @@ glusterd_op_gsync_set (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
}
- if (type == GF_GSYNC_OPTION_TYPE_CONFIGURE) {
+ if (type == GF_GSYNC_OPTION_TYPE_CONFIG) {
ret = glusterd_gsync_configure (volinfo, slave, dict,
op_errstr);
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 3b5c3df6b..65ccec4d4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -258,17 +258,19 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret,
case GD_OP_GSYNC_SET:
{
int type = 0;
- int config_type = 0;
char *str = NULL;
char *master = NULL;
char *slave = NULL;
char *op_name = NULL;
+ char *subop = 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.subop = "";
rsp.master = "";
rsp.slave = "";
rsp.glusterd_workdir = conf->workdir;
@@ -280,10 +282,6 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret,
ret = dict_get_int32 (ctx, "type", &type);
if (ret == 0)
rsp.type = type;
- ret = dict_get_int32 (ctx, "config_type",
- &config_type);
- if (ret == 0)
- rsp.config_type = config_type;
ret = dict_get_str (ctx, "master", &master);
if (ret == 0)
rsp.master = master;
@@ -292,10 +290,11 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret,
if (ret == 0)
rsp.slave = slave;
- if (config_type == GF_GSYNC_OPTION_TYPE_CONFIG_GET) {
- ret = dict_get_str (ctx, "op_name", &op_name);
- if (ret == 0)
+ if (type == GF_GSYNC_OPTION_TYPE_CONFIG) {
+ if (dict_get_str (ctx, "op_name", &op_name) == 0)
rsp.op_name = op_name;
+ if (dict_get_str (ctx, "subop", &subop) == 0)
+ rsp.subop = subop;
}
ret = dict_allocate_and_serialize (ctx,