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