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