diff options
| author | Dan Lambright <dlambrig@redhat.com> | 2016-05-19 10:43:53 -0400 | 
|---|---|---|
| committer | Atin Mukherjee <amukherj@redhat.com> | 2016-06-13 01:33:50 -0700 | 
| commit | ccb906c8a8139b66130192080020709bfc6d0dc3 (patch) | |
| tree | 7e88219b3851928739730d5aee94086143e77c5b | |
| parent | 53cc21c5a5df434039f587644c336bf4f7264f45 (diff) | |
cluster/tier: fix detach tier error message
Do not refer to obsolete syntax when throwing an error on detach tier.
Throw a warning if the user tries to commit a detach tier before
starting (or completing) the decommission process.
Change-Id: I9df28c1b42b8ab1790e1db5c0cd518432146c1d1
BUG: 1337227
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Reviewed-on: http://review.gluster.org/14438
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
| -rw-r--r-- | cli/src/cli-cmd-parser.c | 2 | ||||
| -rw-r--r-- | cli/src/cli-cmd-volume.c | 2 | ||||
| -rw-r--r-- | cli/src/cli-rpc-ops.c | 10 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 29 | 
4 files changed, 22 insertions, 21 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index b062adfab0f..f60e5fb04a0 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -1848,7 +1848,7 @@ cli_cmd_volume_detach_tier_parse (const char **words, int wordcount,          ret = 0;  out:          if (ret) { -                gf_log ("cli", GF_LOG_ERROR, "Unable to parse detach-tier CLI"); +                gf_log ("cli", GF_LOG_ERROR, "Unable to parse detach tier CLI");                  if (dict)                          dict_unref (dict);          } diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 689eba6d281..b09a6ccbe3d 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -1023,7 +1023,7 @@ out:          if (ret) {                  cli_cmd_sent_status_get (&sent);                  if ((sent == 0) && (parse_error == 0)) -                        cli_out ("Volume detach-tier failed"); +                        cli_out ("Volume detach tier failed");          }          CLI_STACK_DESTROY (frame); diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 67f26991419..12776065128 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -2396,7 +2396,7 @@ gf_cli_detach_tier_cbk (struct rpc_req *req, struct iovec *iov,                  break;          } -        gf_log ("cli", GF_LOG_INFO, "Received resp to detach-tier"); +        gf_log ("cli", GF_LOG_INFO, "Received resp to detach tier");          if (rsp.op_ret && strcmp (rsp.op_errstr, ""))                  snprintf (msg, sizeof (msg), "%s", rsp.op_errstr); @@ -2418,10 +2418,10 @@ gf_cli_detach_tier_cbk (struct rpc_req *req, struct iovec *iov,          }          if (rsp.op_ret) { -                cli_err ("volume detach-tier %s: failed: %s", cmd_str, +                cli_err ("volume detach tier %s: failed: %s", cmd_str,                           msg);          } else { -                cli_out ("volume detach-tier %s: success", cmd_str); +                cli_out ("volume detach tier %s: success", cmd_str);                  if (GF_OP_CMD_DETACH_START == cmd && task_id_str != NULL)                          cli_out ("ID: %s", task_id_str);                  if (GF_OP_CMD_DETACH_COMMIT == cmd) @@ -2558,10 +2558,10 @@ xml_output:          }          if ((cmd == GF_OP_CMD_STOP_DETACH_TIER) && (rsp.op_ret == 0)) { -                cli_out ("'detach-tier' process may be in the middle of a " +                cli_out ("'detach tier' process may be in the middle of a "                           "file migration.\nThe process will be fully stopped "                           "once the migration of the file is complete.\nPlease " -                         "check detach-tier process for completion before " +                         "check detach tier process for completion before "                           "doing any further brick related tasks on the "                           "volume.");          } diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index a90114ab2b3..24317726079 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -1964,15 +1964,25 @@ glusterd_remove_brick_validate_bricks (gf1_op_commands cmd, int32_t brick_count,                          }                          if (cmd == GF_OP_CMD_DETACH_COMMIT) { -                                snprintf (msg, sizeof (msg), "Brick's in Hot " -                                          "tier is not decommissioned yet. Use " -                                          "gluster volume detach-tier <VOLNAME>" -                                          " <start | commit | force>" -                                          " command instead"); +                                snprintf (msg, sizeof (msg), "Bricks in Hot " +                                          "tier are not decommissioned yet. Use " +                                          "gluster volume tier <VOLNAME> " +                                          "detach start to start the decommission process");                                  *errstr = gf_strdup (msg);                                  ret = -1;                                  goto out;                          } +                } else { +                        if (cmd == GF_OP_CMD_DETACH_COMMIT && +                            (volinfo->rebal.defrag_status == GF_DEFRAG_STATUS_STARTED)) { +                                        snprintf (msg, sizeof (msg), "Bricks in Hot " +                                                  "tier are not decommissioned yet. Wait for " +                                                  "the detach to complete using gluster volume " +                                                  "tier <VOLNAME> status."); +                                        *errstr = gf_strdup (msg); +                                        ret = -1; +                                        goto out; +                            }                  }                  if (glusterd_is_local_brick (THIS, volinfo, brickinfo)) { @@ -2237,15 +2247,6 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr)                          ret = -1;                          goto out;                  } - -                if (volinfo->rebal.defrag_status == GF_DEFRAG_STATUS_STARTED) { -                        ret = -1; -                        errstr = gf_strdup("Detach is in progress. Please " -                                           "retry after completion"); -                        gf_msg (this->name, GF_LOG_ERROR, 0, -                                GD_MSG_OIP_RETRY_LATER, "%s", errstr); -                        goto out; -                }                  break;          case GF_OP_CMD_COMMIT:  | 
