diff options
-rw-r--r-- | cli/src/cli-cmd-parser.c | 7 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 19 |
2 files changed, 19 insertions, 7 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 547f1d90f01..33a6c0104b0 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -1810,6 +1810,13 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options) if (slavei == 3) masteri = 2; } else if (i <= 3) { + if (!strcmp ((char *)words[wordcount-1], "detail")) { + /* For status detail it is mandatory to provide + * both master and slave */ + ret = -1; + goto out; + } + /* no $s, can only be status cmd * (with either a single $m before it or nothing) * -- these conditions imply that i <= 3 after diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index 4d206eb38b0..8bdb9457462 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -928,7 +928,7 @@ _get_status_mst_slv (dict_t *this, char *key, data_t *value, void *data) char *slave_buf = NULL; char *slave_ip = NULL; char *slave_vol = NULL; - char **errmsg = NULL; + char *errmsg = NULL; char conf_path[PATH_MAX] = ""; int ret = -1; glusterd_conf_t *priv = NULL; @@ -950,10 +950,14 @@ _get_status_mst_slv (dict_t *this, char *key, data_t *value, void *data) return 0; slave++; - ret = glusterd_get_slave_info (slave, &slave_ip, &slave_vol, errmsg); + ret = glusterd_get_slave_info (slave, &slave_ip, &slave_vol, &errmsg); if (ret) { - gf_log ("", GF_LOG_ERROR, - "Unable to fetch slave details."); + if (errmsg) + gf_log ("", GF_LOG_ERROR, "Unable to fetch " + "slave details. Error: %s", errmsg); + else + gf_log ("", GF_LOG_ERROR, + "Unable to fetch slave details."); ret = -1; goto out; } @@ -1767,7 +1771,6 @@ glusterd_mountbroker_check (char **slave_ip, char **op_errstr) GF_ASSERT (slave_ip); GF_ASSERT (*slave_ip); - GF_ASSERT (op_errstr); /* Checking if hostname has user specified */ host = strstr (*slave_ip, "@"); @@ -1786,7 +1789,8 @@ glusterd_mountbroker_check (char **slave_ip, char **op_errstr) errmsg[ret] = '\0'; gf_log ("", GF_LOG_ERROR, "%s", errmsg); ret = -1; - *op_errstr = gf_strdup (errmsg); + if (op_errstr) + *op_errstr = gf_strdup (errmsg); goto out; } @@ -1799,7 +1803,8 @@ glusterd_mountbroker_check (char **slave_ip, char **op_errstr) "Non-root username (%s@%s) not allowed.", username, tmp); errmsg[ret] = '\0'; - *op_errstr = gf_strdup (errmsg); + if (op_errstr) + *op_errstr = gf_strdup (errmsg); gf_log ("", GF_LOG_ERROR, "Non-Root username not allowed."); ret = -1; |