9f5ccc
From a8d8fc91af226fbf49e9dd1d7d91ad287707c4fe Mon Sep 17 00:00:00 2001
9f5ccc
From: Vishal Pandey <vpandey@redhat.com>
9f5ccc
Date: Wed, 7 Aug 2019 12:53:06 +0530
9f5ccc
Subject: [PATCH 328/335] glusterd: Add warning and abort in case of failures
9f5ccc
 in migration during remove-brick commit
9f5ccc
9f5ccc
Problem -
9f5ccc
Currently remove-brick commit goes through even though there were files
9f5ccc
that failed to migrate or were skipped. There is no warning raised to the user.
9f5ccc
Solution-
9f5ccc
Add a check in the remove brick staging phase to verify if the status of the
9f5ccc
rebalnce process is complete but there has been failures or some skipped files
9f5ccc
while migration, In this case user will be given a warning and remove-brick
9f5ccc
commit. User will need to use the force option to remove the bricks.
9f5ccc
9f5ccc
> Upstream Path Link: https://review.gluster.org/#/c/glusterfs/+/23171/
9f5ccc
> Fixes: bz#1514683
9f5ccc
> Signed-offby- Vishal Pandey <vpandey@redhat.com>
9f5ccc
> Change-Id: I014d0f0afb4b2fac35ab0de52227f98dbae079d5
9f5ccc
9f5ccc
BUG: 1344758
9f5ccc
Change-Id: I014d0f0afb4b2fac35ab0de52227f98dbae079d5
9f5ccc
Signed-off-by: Vishal Pandey <vpandey@redhat.com>
9f5ccc
Reviewed-on: https://code.engineering.redhat.com/gerrit/185831
9f5ccc
Tested-by: RHGS Build Bot <nigelb@redhat.com>
9f5ccc
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
9f5ccc
---
9f5ccc
 xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 11 +++++++++++
9f5ccc
 1 file changed, 11 insertions(+)
9f5ccc
9f5ccc
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
9f5ccc
index ad9a572..c5141de 100644
9f5ccc
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
9f5ccc
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
9f5ccc
@@ -2191,6 +2191,17 @@ glusterd_op_stage_remove_brick(dict_t *dict, char **op_errstr)
9f5ccc
                 goto out;
9f5ccc
             }
9f5ccc
 
9f5ccc
+            if (volinfo->rebal.defrag_status == GF_DEFRAG_STATUS_COMPLETE) {
9f5ccc
+                if (volinfo->rebal.rebalance_failures > 0 ||
9f5ccc
+                    volinfo->rebal.skipped_files > 0) {
9f5ccc
+                    errstr = gf_strdup(
9f5ccc
+                        "use 'force' option as migration "
9f5ccc
+                        "of some files might have been skipped or "
9f5ccc
+                        "has failed");
9f5ccc
+                    goto out;
9f5ccc
+                }
9f5ccc
+            }
9f5ccc
+
9f5ccc
             ret = glusterd_remove_brick_validate_bricks(
9f5ccc
                 cmd, brick_count, dict, volinfo, &errstr, GF_DEFRAG_CMD_NONE);
9f5ccc
             if (ret)
9f5ccc
-- 
9f5ccc
1.8.3.1
9f5ccc