diff options
| -rw-r--r-- | cli/src/cli-cmd-parser.c | 21 | ||||
| -rw-r--r-- | cli/src/cli3_1-cops.c | 1 | ||||
| -rw-r--r-- | rpc/xdr/src/cli1-xdr.h | 1 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 4 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 15 | 
5 files changed, 33 insertions, 9 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index a6f9cf915a1..d01e4f71196 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -822,8 +822,7 @@ cli_cmd_volume_replace_brick_parse (const char **words, int wordcount,                  goto out;          op_index = 5; -        if ((wordcount < (op_index + 1)) || -            (wordcount > (op_index + 1))) { +        if ((wordcount < (op_index + 1))) {                  ret = -1;                  goto out;          } @@ -842,6 +841,21 @@ cli_cmd_volume_replace_brick_parse (const char **words, int wordcount,                  replace_op = GF_REPLACE_OP_STATUS;          } +        /* commit force option */ +        op_index = 6; + +        if (wordcount > (op_index + 1)) { +                ret = -1; +                goto out; +        } + +        if (wordcount == (op_index + 1)) { +                op = (char *) words[op_index]; +                if (!strcasecmp ("force", op)) { +                        replace_op = GF_REPLACE_OP_COMMIT_FORCE; +                } +        } +          if (replace_op == GF_REPLACE_OP_NONE) {                  ret = -1;                  goto out; @@ -852,6 +866,9 @@ cli_cmd_volume_replace_brick_parse (const char **words, int wordcount,          if (ret)                  goto out; + + +          *options = dict;  out: diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c index 2933edffb01..a4a3304cd58 100644 --- a/cli/src/cli3_1-cops.c +++ b/cli/src/cli3_1-cops.c @@ -1007,6 +1007,7 @@ gf_cli3_1_replace_brick_cbk (struct rpc_req *req, struct iovec *iov,                  break;          case GF_REPLACE_OP_COMMIT: +        case GF_REPLACE_OP_COMMIT_FORCE:                  ret = dict_get_str (dict, "src-brick", &src_brick);                  if (ret) {                          gf_log ("", GF_LOG_DEBUG, diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h index 7369ba86669..f18e2a75068 100644 --- a/rpc/xdr/src/cli1-xdr.h +++ b/rpc/xdr/src/cli1-xdr.h @@ -48,6 +48,7 @@ enum gf1_cli_replace_op {  	GF_REPLACE_OP_PAUSE = 0 + 3,  	GF_REPLACE_OP_ABORT = 0 + 4,  	GF_REPLACE_OP_STATUS = 0 + 5, +	GF_REPLACE_OP_COMMIT_FORCE = 0 + 6,  };  typedef enum gf1_cli_replace_op gf1_cli_replace_op; diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 48dc673edb5..ee547639e0b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -1142,7 +1142,7 @@ glusterd_handle_replace_brick (rpcsvc_request_t *req)          char                            *src_brick = NULL;          char                            *dst_brick = NULL;          int32_t                         op = 0; -        char                            operation[8]; +        char                            operation[256];          GF_ASSERT (req); @@ -1210,6 +1210,8 @@ glusterd_handle_replace_brick (rpcsvc_request_t *req)                          break;                  case GF_REPLACE_OP_STATUS: strcpy (operation, "status");                          break; +                case GF_REPLACE_OP_COMMIT_FORCE: strcpy (operation, "commit-force"); +                        break;                  default:strcpy (operation, "unknown");                          break;          } diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 3109e173b34..b43b88a3bf7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -2639,11 +2639,12 @@ glusterd_op_replace_brick (gd1_mgmt_stage_op_req *req, dict_t *rsp_dict)                  src_brickinfo->port = pmap_registry_search (this,                                        src_brickinfo->path, GF_PMAP_PORT_BRICKSERVER); -                if (!src_brickinfo->port) { -                         gf_log ("", GF_LOG_ERROR, +                if (!src_brickinfo->port && +                    replace_op != GF_REPLACE_OP_COMMIT_FORCE ) { +                        gf_log ("", GF_LOG_ERROR,                                  "Src brick port not available"); -                         ret = -1; -                         goto out; +                        ret = -1; +                        goto out;                  }                  if (rsp_dict) { @@ -2721,6 +2722,7 @@ glusterd_op_replace_brick (gd1_mgmt_stage_op_req *req, dict_t *rsp_dict)  	}          case GF_REPLACE_OP_COMMIT: +        case GF_REPLACE_OP_COMMIT_FORCE:          {                  ret = dict_set_int32 (volinfo->dict, "enable-pump", 0); @@ -2728,7 +2730,8 @@ glusterd_op_replace_brick (gd1_mgmt_stage_op_req *req, dict_t *rsp_dict)                          "Received commit - will be adding dst brick and "                          "removing src brick"); -                if (!glusterd_is_local_addr (dst_brickinfo->hostname)) { +                if (!glusterd_is_local_addr (dst_brickinfo->hostname) && +                    replace_op != GF_REPLACE_OP_COMMIT_FORCE) {                          gf_log ("", GF_LOG_NORMAL,                                  "I AM THE DESTINATION HOST");                          ret = rb_kill_destination_brick (volinfo, dst_brickinfo); @@ -4018,8 +4021,8 @@ glusterd_do_replace_brick (void *data)                  break;          case GF_REPLACE_OP_PAUSE:          case GF_REPLACE_OP_ABORT: -                break;          case GF_REPLACE_OP_COMMIT: +        case GF_REPLACE_OP_COMMIT_FORCE:          case GF_REPLACE_OP_STATUS:                  break;          default:  | 
