From 093c66a0af496301e5d28d55f4fe57362cb399d5 Mon Sep 17 00:00:00 2001 From: Vishal Pandey Date: Wed, 7 Aug 2019 12:53:06 +0530 Subject: glusterd: Add warning and abort in case of failures in migration during remove-brick commit Problem - Currently remove-brick commit goes through even though there were files that failed to migrate or were skipped. There is no warning raised to the user. Solution- Add a check in the remove brick staging phase to verify if the status of the rebalnce process is complete but there has been failures or some skipped files while migration, In this case user will be given a warning and remove-brick commit. User will need to use the force option to remove the bricks. Fixes: bz#1514683 Signed-offby- Vishal Pandey Change-Id: I014d0f0afb4b2fac35ab0de52227f98dbae079d5 --- xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 870e30d8f22..5e5421ed2dc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -1883,6 +1883,17 @@ glusterd_op_stage_remove_brick(dict_t *dict, char **op_errstr) goto out; } + if (volinfo->rebal.defrag_status == GF_DEFRAG_STATUS_COMPLETE) { + if (volinfo->rebal.rebalance_failures > 0 || + volinfo->rebal.skipped_files > 0) { + errstr = gf_strdup( + "use 'force' option as migration " + "of some files might have been skipped or " + "has failed"); + goto out; + } + } + ret = glusterd_remove_brick_validate_bricks( cmd, brick_count, dict, volinfo, &errstr, GF_DEFRAG_CMD_NONE); if (ret) -- cgit