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