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