summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd-parser.c59
-rw-r--r--cli/src/cli-cmd-volume.c2
-rw-r--r--cli/src/cli3_1-cops.c3
3 files changed, 35 insertions, 29 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 2b7cdd9f612..9de13e56ce7 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -729,42 +729,45 @@ cli_cmd_volume_replace_brick_parse (const char **words, int wordcount,
}
delimiter = strchr ((char *)words[3], ':');
- if (delimiter && delimiter != words[3]
- && *(delimiter+1) == '/') {
+ if (!delimiter || delimiter == words[3]
+ || *(delimiter+1) != '/') {
+ cli_out ("wrong brick type: %s, use "
+ "<HOSTNAME>:<export-dir-abs-path>", words[3]);
+ ret = -1;
+ goto out;
+ } else {
cli_path_strip_trailing_slashes (delimiter + 1);
- ret = dict_set_str (dict, "src-brick", (char *)words[3]);
-
- if (ret)
- goto out;
+ }
+ ret = dict_set_str (dict, "src-brick", (char *)words[3]);
- if (wordcount < 5) {
- ret = -1;
- goto out;
- }
+ if (ret)
+ goto out;
- delimiter = strchr ((char *)words[4], ':');
- if (!delimiter || delimiter == words[4]
- || *(delimiter+1) != '/') {
- cli_out ("wrong brick type: %s, use "
- "<HOSTNAME>:<export-dir-abs-path>", words[4]);
- ret = -1;
- goto out;
- } else {
- cli_path_strip_trailing_slashes (delimiter + 1);
- }
+ if (wordcount < 5) {
+ ret = -1;
+ goto out;
+ }
+ delimiter = strchr ((char *)words[4], ':');
+ if (!delimiter || delimiter == words[4]
+ || *(delimiter+1) != '/') {
+ cli_out ("wrong brick type: %s, use "
+ "<HOSTNAME>:<export-dir-abs-path>", words[4]);
+ ret = -1;
+ goto out;
+ } else {
+ cli_path_strip_trailing_slashes (delimiter + 1);
+ }
- ret = dict_set_str (dict, "dst-brick", (char *)words[4]);
- if (ret)
- goto out;
+ ret = dict_set_str (dict, "dst-brick", (char *)words[4]);
- op_index = 5;
- } else {
- op_index = 3;
- }
+ if (ret)
+ goto out;
- if (wordcount < (op_index + 1)) {
+ op_index = 5;
+ if ((wordcount < (op_index + 1)) ||
+ (wordcount > (op_index + 1))) {
ret = -1;
goto out;
}
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 28104c18704..c8345177823 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -611,7 +611,7 @@ void
cli_cmd_volume_replace_brick_usage ()
{
cli_out("Usage: volume replace-brick <VOLNAME> "
- "(<BRICK> <NEW-BRICK>) start|pause|abort|status");
+ "<BRICK> <NEW-BRICK> start|pause|abort|status");
}
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c
index 53b80c55667..78683ccab0e 100644
--- a/cli/src/cli3_1-cops.c
+++ b/cli/src/cli3_1-cops.c
@@ -937,6 +937,9 @@ gf_cli3_1_replace_brick_cbk (struct rpc_req *req, struct iovec *iov,
break;
}
+ if (rsp.op_ret && (strcmp (rsp.op_errstr, ""))) {
+ rb_operation_str = rsp.op_errstr;
+ }
gf_log ("cli", GF_LOG_NORMAL, "Received resp to replace brick");
cli_out ("%s",