diff options
-rw-r--r-- | rpc/xdr/src/cli1-xdr.x | 3 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 25 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-tier.c | 10 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 2 |
4 files changed, 28 insertions, 12 deletions
diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x index 8a64351c974..0feb9360284 100644 --- a/rpc/xdr/src/cli1-xdr.x +++ b/rpc/xdr/src/cli1-xdr.x @@ -14,7 +14,8 @@ %#include "compat.h" enum gf_cli_defrag_type { - GF_DEFRAG_CMD_START = 1, + GF_DEFRAG_CMD_NONE = 0, + GF_DEFRAG_CMD_START, GF_DEFRAG_CMD_STOP, GF_DEFRAG_CMD_STATUS, GF_DEFRAG_CMD_START_LAYOUT_FIX, diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 7b5264ad8a1..3e358e95795 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -1938,7 +1938,8 @@ int glusterd_remove_brick_validate_bricks (gf1_op_commands cmd, int32_t brick_count, dict_t *dict, glusterd_volinfo_t *volinfo, - char **errstr) + char **errstr, + gf_cli_defrag_type cmd_defrag) { char *brick = NULL; char msg[2048] = {0,}; @@ -1986,7 +1987,7 @@ glusterd_remove_brick_validate_bricks (gf1_op_commands cmd, int32_t brick_count, } if (cmd == GF_OP_CMD_DETACH_COMMIT || - cmd == GF_DEFRAG_CMD_DETACH_COMMIT) { + cmd_defrag == GF_DEFRAG_CMD_DETACH_COMMIT) { snprintf (msg, sizeof (msg), "Bricks in Hot " "tier are not decommissioned yet. Use " "gluster volume tier <VOLNAME> " @@ -1997,7 +1998,7 @@ glusterd_remove_brick_validate_bricks (gf1_op_commands cmd, int32_t brick_count, } } else { if ((cmd == GF_OP_CMD_DETACH_COMMIT || - (cmd == GF_DEFRAG_CMD_DETACH_COMMIT)) && + (cmd_defrag == GF_DEFRAG_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 " @@ -2013,11 +2014,20 @@ glusterd_remove_brick_validate_bricks (gf1_op_commands cmd, int32_t brick_count, switch (cmd) { case GF_OP_CMD_START: case GF_OP_CMD_DETACH_START: + goto check; + case GF_OP_CMD_NONE: + default: + break; + } + + switch (cmd_defrag) { case GF_DEFRAG_CMD_DETACH_START: break; + case GF_DEFRAG_CMD_NONE: default: continue; } +check: if (brickinfo->status != GF_BRICK_STARTED) { snprintf (msg, sizeof (msg), "Found stopped " "brick %s", brick); @@ -2226,7 +2236,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) ret = glusterd_remove_brick_validate_bricks (cmd, brick_count, dict, volinfo, - &errstr); + &errstr, + GF_DEFRAG_CMD_NONE); if (ret) goto out; @@ -2279,7 +2290,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) ret = glusterd_remove_brick_validate_bricks (cmd, brick_count, dict, volinfo, - &errstr); + &errstr, + GF_DEFRAG_CMD_NONE); if (ret) goto out; @@ -2309,7 +2321,8 @@ glusterd_op_stage_remove_brick (dict_t *dict, char **op_errstr) ret = glusterd_remove_brick_validate_bricks (cmd, brick_count, dict, volinfo, - &errstr); + &errstr, + GF_DEFRAG_CMD_NONE); if (ret) goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-tier.c b/xlators/mgmt/glusterd/src/glusterd-tier.c index 03fbbfba8ec..0afdab56c9c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-tier.c +++ b/xlators/mgmt/glusterd/src/glusterd-tier.c @@ -1029,9 +1029,10 @@ glusterd_op_stage_tier (dict_t *dict, char **op_errstr, dict_t *rsp_dict) goto out; } - ret = glusterd_remove_brick_validate_bricks (cmd, brick_count, + ret = glusterd_remove_brick_validate_bricks (GF_OP_CMD_NONE, + brick_count, dict, volinfo, - op_errstr); + op_errstr, cmd); if (ret) goto out; @@ -1104,9 +1105,10 @@ glusterd_op_stage_tier (dict_t *dict, char **op_errstr, dict_t *rsp_dict) goto out; } - ret = glusterd_remove_brick_validate_bricks (cmd, brick_count, + ret = glusterd_remove_brick_validate_bricks (GF_OP_CMD_NONE, + brick_count, dict, volinfo, - op_errstr); + op_errstr, cmd); if (ret) goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 5986b9bf4fd..db13c4c8ad4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -562,7 +562,7 @@ int glusterd_remove_brick_validate_bricks (gf1_op_commands cmd, int32_t brick_count, dict_t *dict, glusterd_volinfo_t *volinfo, - char **errstr); + char **errstr, gf_cli_defrag_type); int glusterd_get_slave_details_confpath (glusterd_volinfo_t *volinfo, dict_t *dict, char **slave_url, |