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